[CP] fix oracle distinct to_char column order by column resolver bug.

This commit is contained in:
SevenJ-swj
2024-03-06 08:20:48 +00:00
committed by ob-robot
parent 34d34272d7
commit 210aa3cee7

View File

@ -943,7 +943,18 @@ int ObSelectResolver::check_order_by()
for (int64_t i = 0; OB_SUCC(ret) && i < select_items.count(); ++i) {
ObRawExpr *expr = select_items.at(i).expr_;
if (OB_FAIL(select_item_exprs.push_back(expr))) {
LOG_WARN("fail to push back expr", K(ret));
LOG_WARN("fail to push back expr", K(ret));
// Support non-standard semantics in oracle
//
} else if (T_FUN_SYS_TO_CHAR == expr->get_expr_type() && expr->get_param_count() == 1) {
if (OB_ISNULL(expr->get_param_expr(0))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("to_char has no child expr", K(ret));
} else if (expr->get_param_expr(0)->get_result_type().is_number()) {
if (OB_FAIL(select_item_exprs.push_back(expr->get_param_expr(0)))) {
LOG_WARN("fail to push back expr", K(ret));
}
}
}
}
if (OB_SUCC(ret)) {