Fix some parameterization bug

This commit is contained in:
obdev
2023-06-01 03:17:29 +00:00
committed by ob-robot
parent c27fb22c59
commit b190ac23b9
2 changed files with 6 additions and 1 deletions

View File

@ -964,6 +964,7 @@ STRING_VALUE %prec LOWER_THAN_COMP
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
ParseNode *concat_node = NULL;
make_name_node(concat_node, result->malloc_pool_, "concat");
concat_node->reserved_ = 1; /* mark special concat */
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
}
| NATIONAL_LITERAL

View File

@ -1807,6 +1807,8 @@ int ObSqlParameterization::mark_tree(ParseNode *tree ,SqlInfo &sql_info)
if (OB_FAIL(mark_args(node[1], mark_arr, ARGS_NUMBER_TWO, sql_info))) {
SQL_PC_LOG(WARN, "fail to mark arg", K(ret));
}
} else if ((0 == func_name.case_compare("concat")) && 1 == node[0]->reserved_) {
sql_info.ps_need_parameterized_ = false;
}
}
} else if (T_OP_LIKE == tree->type_) {
@ -2219,6 +2221,7 @@ int ObSqlParameterization::transform_minus_op(ObIAllocator &alloc, ParseNode *tr
}
} else if (T_OP_MUL == tree->children_[1]->type_
|| T_OP_DIV == tree->children_[1]->type_
|| T_OP_INT_DIV == tree->children_[1]->type_
|| (lib::is_mysql_mode() && T_OP_MOD == tree->children_[1]->type_)) {
/* '0 - 2 * 3' should be transformed to '0 + (-2) * 3' */
/* '0 - 2 / 3' should be transformed to '0 + (-2) / 3' */
@ -2297,7 +2300,8 @@ int ObSqlParameterization::find_leftest_const_node(ParseNode &cur_node, ParseNod
const_node = &cur_node;
} else if (1 == cur_node.is_assigned_from_child_) {
// do nothing
} else if (T_OP_MUL == cur_node.type_ || T_OP_DIV == cur_node.type_ || T_OP_MOD == cur_node.type_) {
} else if (T_OP_MUL == cur_node.type_ || T_OP_DIV == cur_node.type_
|| T_OP_INT_DIV == cur_node.type_ || T_OP_MOD == cur_node.type_) {
/* 对于1 - (2-3)/4,语法树为 */
/* - */
/* / \ */