fix const_name function error checking

This commit is contained in:
raywill
2023-04-18 04:15:08 +00:00
committed by ob-robot
parent 9a57e64e56
commit 52e0115965
2 changed files with 10 additions and 3 deletions

View File

@ -5817,7 +5817,7 @@ int ObRawExprResolverImpl::process_fun_sys_node(const ParseNode *node, ObRawExpr
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (OB_FAIL(process_sys_func_params(*func_expr))) { if (OB_FAIL(process_sys_func_params(*func_expr, current_columns_count))) {
LOG_WARN("fail process sys func params", K(ret)); LOG_WARN("fail process sys func params", K(ret));
} }
} }
@ -5867,12 +5867,19 @@ int ObRawExprResolverImpl::process_fun_sys_node(const ParseNode *node, ObRawExpr
return ret; return ret;
} }
int ObRawExprResolverImpl::process_sys_func_params(ObSysFunRawExpr &func_expr) int ObRawExprResolverImpl::process_sys_func_params(ObSysFunRawExpr &func_expr, int current_columns_count)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
const ObExprOperatorType expr_type = ObExprOperatorFactory::get_type_by_name(func_expr.get_func_name()); const ObExprOperatorType expr_type = ObExprOperatorFactory::get_type_by_name(func_expr.get_func_name());
switch (expr_type) switch (expr_type)
{ {
case T_FUN_SYS_NAME_CONST:
if (current_columns_count != ctx_.columns_->count()) {
ret = OB_INVALID_ARGUMENT;
LOG_USER_ERROR(OB_INVALID_ARGUMENT, N_NAME_CONST);
LOG_WARN("params of name_const contain column references", K(ret));
}
break;
case T_FUN_SYS_UUID2BIN: case T_FUN_SYS_UUID2BIN:
case T_FUN_SYS_BIN2UUID: case T_FUN_SYS_BIN2UUID:
if (2 == func_expr.get_param_count()) { if (2 == func_expr.get_param_count()) {

View File

@ -202,7 +202,7 @@ private:
const ParseNode *expr_node, const ParseNode *expr_node,
ObRawExpr *&expr); ObRawExpr *&expr);
private: private:
int process_sys_func_params(ObSysFunRawExpr &func_expr); int process_sys_func_params(ObSysFunRawExpr &func_expr, int current_columns_count);
int transform_ratio_afun_to_arg_div_sum(const ParseNode *ratio_to_report, ParseNode *&div); int transform_ratio_afun_to_arg_div_sum(const ParseNode *ratio_to_report, ParseNode *&div);
int convert_any_or_all_expr(ObRawExpr *&expr, bool &happened); int convert_any_or_all_expr(ObRawExpr *&expr, bool &happened);
int get_opposite_string(const common::ObString &orig_string, common::ObString &new_string, common::ObIAllocator &allocator); int get_opposite_string(const common::ObString &orig_string, common::ObString &new_string, common::ObIAllocator &allocator);