bugfix cherry-pick to opensource release
This commit is contained in:
@ -96,7 +96,8 @@
|
||||
%left AND AND_OP
|
||||
%left BETWEEN CASE WHEN THEN ELSE
|
||||
%nonassoc LOWER_THAN_COMP
|
||||
%left COMP_EQ COMP_NSEQ COMP_GE COMP_GT COMP_LE COMP_LT COMP_NE IS LIKE IN REGEXP
|
||||
%left COMP_EQ COM P_NSEQ COMP_GE COMP_GT COMP_LE COMP_LT COMP_NE IS LIKE IN REGEXP
|
||||
%nonassoc STRING_VALUE
|
||||
%right ESCAPE /*for conflict for escape*/
|
||||
%left '|'
|
||||
%left '&'
|
||||
@ -108,8 +109,9 @@
|
||||
%left CNNOP
|
||||
%left NEG '~'
|
||||
%nonassoc LOWER_PARENS
|
||||
//%nonassoc STRING_VALUE
|
||||
%left '(' ')'
|
||||
%nonassoc HIGHER_PARENS TRANSACTION/*for simple_expr conflict*/
|
||||
%nonassoc HIGHER_PARENS TRANSACTION /*for simple_expr conflict*/
|
||||
%left '.'
|
||||
%right NOT NOT2
|
||||
%right BINARY COLLATE
|
||||
@ -232,7 +234,7 @@ END_P SET_VAR DELIMITER
|
||||
|
||||
LAG LANGUAGE LAST LAST_VALUE LEAD LEADER LEAVES LESS LEAK LEAK_MOD LEAK_RATE LINESTRING LIST_
|
||||
LISTAGG LOCAL LOCALITY LOCATION LOCKED LOCKS LOGFILE LOGONLY_REPLICA_NUM LOGS LOCK_ LOGICAL_READS
|
||||
LEVEL
|
||||
LEVEL LN LOG
|
||||
|
||||
MAJOR MANUAL MASTER MASTER_AUTO_POSITION MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD
|
||||
MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT
|
||||
@ -397,14 +399,14 @@ END_P SET_VAR DELIMITER
|
||||
%type <node> opt_index_name opt_key_or_index opt_index_options opt_primary opt_all
|
||||
%type <node> charset_key database_key charset_name charset_name_or_default collation_name databases_or_schemas trans_param_name trans_param_value
|
||||
%type <node> set_names_stmt set_charset_stmt
|
||||
%type <node> charset_introducer opt_charset_introducer complex_string_literal literal number_literal now_or_signed_literal signed_literal
|
||||
%type <node> charset_introducer complex_string_literal literal number_literal now_or_signed_literal signed_literal
|
||||
%type <node> create_tablegroup_stmt drop_tablegroup_stmt alter_tablegroup_stmt default_tablegroup
|
||||
%type <node> set_transaction_stmt transaction_characteristics transaction_access_mode isolation_level
|
||||
%type <node> lock_tables_stmt unlock_tables_stmt lock_type lock_table_list lock_table opt_local
|
||||
%type <node> purge_stmt
|
||||
%type <node> tenant_name_list opt_tenant_list tenant_list_tuple cache_type flush_scope opt_zone_list
|
||||
%type <node> into_opt into_clause field_opt field_term field_term_list line_opt line_term line_term_list into_var_list into_var
|
||||
%type <node> string_list text_string
|
||||
%type <node> string_list text_string string_val_list
|
||||
%type <node> balance_task_type opt_balance_task_type
|
||||
%type <node> list_expr list_partition_element list_partition_expr list_partition_list list_partition_option opt_list_partition_list opt_list_subpartition_list list_subpartition_list list_subpartition_element drop_partition_name_list
|
||||
%type <node> primary_zone_name locality_name change_tenant_name_or_tenant_id distribute_method opt_distribute_method
|
||||
@ -711,30 +713,25 @@ column_name
|
||||
}
|
||||
;
|
||||
|
||||
opt_charset_introducer:
|
||||
/*empty*/
|
||||
{
|
||||
$$ = NULL;
|
||||
}
|
||||
| charset_introducer
|
||||
{
|
||||
$$ = $1;
|
||||
};
|
||||
|
||||
/* literal string with */
|
||||
complex_string_literal:
|
||||
opt_charset_introducer STRING_VALUE
|
||||
STRING_VALUE %prec LOWER_THAN_COMP
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_VARCHAR, 2, NULL, $1);
|
||||
$$->str_value_ = $1->str_value_;
|
||||
$$->str_len_ = $1->str_len_;
|
||||
$$->raw_text_ = $1->raw_text_;
|
||||
$$->text_len_ = $1->text_len_;
|
||||
@$.first_column = @1.first_column;
|
||||
@$.last_column = @1.last_column;
|
||||
}
|
||||
| charset_introducer STRING_VALUE
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_VARCHAR, 2, $1, $2);
|
||||
$$->str_value_ = $2->str_value_;
|
||||
$$->str_len_ = $2->str_len_;
|
||||
$$->raw_text_ = $2->raw_text_;
|
||||
$$->text_len_ = $2->text_len_;
|
||||
if (NULL == $1)
|
||||
{
|
||||
@$.first_column = @2.first_column;
|
||||
@$.last_column = @2.last_column;
|
||||
}
|
||||
}
|
||||
| charset_introducer HEX_STRING_VALUE
|
||||
{
|
||||
@ -1013,7 +1010,19 @@ bit_expr IN in_expr
|
||||
//In the resolver, if only two children are found, the escape parameter will be set to '\'
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 2, $1, $3);
|
||||
}
|
||||
| bit_expr LIKE simple_expr ESCAPE simple_expr %prec LIKE
|
||||
| bit_expr LIKE STRING_VALUE string_val_list %prec LOWER_THAN_COMP
|
||||
{
|
||||
//在resolver时,如果发现只有两个children,会将escape 参数设置为‘\’
|
||||
ParseNode *str_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $3, $4);
|
||||
ParseNode *string_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 2, $1, concat_node);
|
||||
}
|
||||
| bit_expr LIKE simple_expr ESCAPE simple_expr %prec LIKE
|
||||
{
|
||||
// If escape is an empty string '', the default value'\' is used
|
||||
if (OB_UNLIKELY(T_VARCHAR == $5->type_ && 0 == $5->str_len_)) {
|
||||
@ -1026,12 +1035,74 @@ bit_expr IN in_expr
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 3, $1, $3, $5);
|
||||
}
|
||||
}
|
||||
| bit_expr LIKE STRING_VALUE string_val_list ESCAPE simple_expr %prec LIKE
|
||||
{
|
||||
// 如果escape 为空串 '', 则使用默认值'\'
|
||||
ParseNode *str_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $3, $4);
|
||||
ParseNode *string_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
|
||||
if (OB_UNLIKELY(T_VARCHAR == $6->type_ && 0 == $6->str_len_)) {
|
||||
ParseNode *node = NULL;
|
||||
malloc_terminal_node(node, result->malloc_pool_, T_VARCHAR);
|
||||
node->str_value_ = "\\";
|
||||
node->str_len_ = 1;
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 3, $1, concat_node, node);
|
||||
} else {
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 3, $1, concat_node, $6);
|
||||
}
|
||||
}
|
||||
| bit_expr LIKE simple_expr ESCAPE STRING_VALUE string_val_list %prec LIKE
|
||||
{
|
||||
ParseNode *escape_node = NULL;
|
||||
malloc_non_terminal_node(escape_node, result->malloc_pool_, T_LINK_NODE, 2, $5, $6);
|
||||
ParseNode *escape_list_node = NULL;
|
||||
merge_nodes(escape_list_node, result, T_EXPR_LIST, escape_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, escape_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 3, $1, $3, concat_node);
|
||||
}
|
||||
| bit_expr LIKE STRING_VALUE string_val_list ESCAPE STRING_VALUE string_val_list %prec LIKE
|
||||
{
|
||||
ParseNode *str_node = NULL;
|
||||
ParseNode *escape_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $3, $4);
|
||||
malloc_non_terminal_node(escape_node, result->malloc_pool_, T_LINK_NODE, 2, $6, $7);
|
||||
ParseNode *string_list_node = NULL;
|
||||
ParseNode *escape_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
merge_nodes(escape_list_node, result, T_EXPR_LIST, escape_node);
|
||||
ParseNode *concat_node1 = NULL;
|
||||
ParseNode *concat_node2 = NULL;
|
||||
make_name_node(concat_node1, result->malloc_pool_, "concat");
|
||||
make_name_node(concat_node2, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node1, result->malloc_pool_, T_FUN_SYS, 2, concat_node1, string_list_node);
|
||||
malloc_non_terminal_node(concat_node2, result->malloc_pool_, T_FUN_SYS, 2, concat_node2, escape_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_LIKE, 3, $1, concat_node1, concat_node2);
|
||||
}
|
||||
| bit_expr not LIKE simple_expr
|
||||
{
|
||||
(void)($2);
|
||||
//In the resolver, if only two children are found, the escape parameter will be set to '\'
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 2, $1, $4);
|
||||
}
|
||||
| bit_expr not LIKE STRING_VALUE string_val_list %prec LOWER_THAN_COMP
|
||||
{
|
||||
(void)($2);
|
||||
//在resolver时,如果发现只有两个children,会将escape 参数设置为‘\’
|
||||
ParseNode *str_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $4, $5);
|
||||
ParseNode *string_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 2, $1, concat_node);
|
||||
}
|
||||
| bit_expr not LIKE simple_expr ESCAPE simple_expr %prec LIKE
|
||||
{
|
||||
(void)($2);
|
||||
@ -1046,19 +1117,104 @@ bit_expr IN in_expr
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 3, $1, $4, $6);
|
||||
}
|
||||
}
|
||||
| bit_expr not LIKE STRING_VALUE string_val_list ESCAPE simple_expr %prec LIKE
|
||||
{
|
||||
(void)($2);
|
||||
ParseNode *str_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $4, $5);
|
||||
ParseNode *string_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
|
||||
// 如果escape 为空串 '', 则使用默认值'\'
|
||||
if (OB_UNLIKELY(T_VARCHAR == $7->type_ && 0 == $7->str_len_)) {
|
||||
ParseNode *node = NULL;
|
||||
malloc_terminal_node(node, result->malloc_pool_, T_VARCHAR);
|
||||
node->str_value_ = "\\";
|
||||
node->str_len_ = 1;
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 3, $1, concat_node, node);
|
||||
} else {
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 3, $1, concat_node, $7);
|
||||
}
|
||||
}
|
||||
| bit_expr not LIKE simple_expr ESCAPE STRING_VALUE string_val_list %prec LIKE
|
||||
{
|
||||
(void)($2);
|
||||
ParseNode *escape_node = NULL;
|
||||
malloc_non_terminal_node(escape_node, result->malloc_pool_, T_LINK_NODE, 2, $6, $7);
|
||||
ParseNode *escape_list_node = NULL;
|
||||
merge_nodes(escape_list_node, result, T_EXPR_LIST, escape_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, escape_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 3, $1, $4, concat_node);
|
||||
}
|
||||
| bit_expr not LIKE STRING_VALUE string_val_list ESCAPE STRING_VALUE string_val_list %prec LIKE
|
||||
{
|
||||
(void)($2);
|
||||
ParseNode *str_node = NULL;
|
||||
ParseNode *escape_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $4, $5);
|
||||
malloc_non_terminal_node(escape_node, result->malloc_pool_, T_LINK_NODE, 2, $7, $8);
|
||||
ParseNode *string_list_node = NULL;
|
||||
ParseNode *escape_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
merge_nodes(escape_list_node, result, T_EXPR_LIST, escape_node);
|
||||
ParseNode *concat_node1 = NULL;
|
||||
ParseNode *concat_node2 = NULL;
|
||||
make_name_node(concat_node1, result->malloc_pool_, "concat");
|
||||
make_name_node(concat_node2, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node1, result->malloc_pool_, T_FUN_SYS, 2, concat_node1, string_list_node);
|
||||
malloc_non_terminal_node(concat_node2, result->malloc_pool_, T_FUN_SYS, 2, concat_node2, escape_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_LIKE, 3, $1, concat_node1, concat_node2);
|
||||
}
|
||||
| bit_expr REGEXP bit_expr
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_REGEXP, 2, $1, $3);
|
||||
}
|
||||
| bit_expr REGEXP STRING_VALUE string_val_list %prec LOWER_THAN_COMP
|
||||
{
|
||||
ParseNode *str_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $3, $4);
|
||||
ParseNode *string_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_REGEXP, 2, $1, concat_node);
|
||||
}
|
||||
| bit_expr not REGEXP bit_expr
|
||||
{
|
||||
(void)($2);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_REGEXP, 2, $1, $4);
|
||||
}
|
||||
| bit_expr not REGEXP STRING_VALUE string_val_list %prec LOWER_THAN_COMP
|
||||
{
|
||||
(void)($2);
|
||||
ParseNode *str_node = NULL;
|
||||
malloc_non_terminal_node(str_node, result->malloc_pool_, T_LINK_NODE, 2, $4, $5);
|
||||
ParseNode *string_list_node = NULL;
|
||||
merge_nodes(string_list_node, result, T_EXPR_LIST, str_node);
|
||||
ParseNode *concat_node = NULL;
|
||||
make_name_node(concat_node, result->malloc_pool_, "concat");
|
||||
malloc_non_terminal_node(concat_node, result->malloc_pool_, T_FUN_SYS, 2, concat_node, string_list_node);
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_OP_NOT_REGEXP, 2, $1, concat_node);
|
||||
}
|
||||
| bit_expr %prec LOWER_THAN_COMP
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
string_val_list:
|
||||
STRING_VALUE
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| string_val_list STRING_VALUE
|
||||
{
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_LINK_NODE, 2, $1, $2);
|
||||
};
|
||||
|
||||
bit_expr:
|
||||
bit_expr '|' bit_expr %prec '|'
|
||||
{
|
||||
@ -2231,6 +2387,47 @@ MOD '(' expr ',' expr ')'
|
||||
make_name_node($$, result->malloc_pool_, "char");
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS, 2, $$, params_node);
|
||||
}
|
||||
| LOG '(' expr ',' expr ')'
|
||||
{
|
||||
ParseNode *params = NULL;
|
||||
malloc_non_terminal_node(params, result->malloc_pool_, T_EXPR_LIST, 2, $3, $5);
|
||||
make_name_node($$, result->malloc_pool_, "log");
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS, 2, $$, params);
|
||||
}
|
||||
| LOG '(' expr ')'
|
||||
{
|
||||
ParseNode *param_node = NULL;
|
||||
malloc_terminal_node(param_node, result->malloc_pool_, T_SFU_DOUBLE);
|
||||
int64_t len = strlen("2.718281828459045");
|
||||
param_node->str_value_ = parse_strndup("2.718281828459045", len, result->malloc_pool_);
|
||||
if (OB_UNLIKELY(NULL == param_node->str_value_)) {
|
||||
yyerror(NULL, result, "No more space for mallocing string\n");
|
||||
YYABORT_NO_MEMORY;
|
||||
}
|
||||
param_node->str_len_ = len;
|
||||
ParseNode *param_list_node = NULL;
|
||||
malloc_non_terminal_node(param_list_node, result->malloc_pool_, T_LINK_NODE, 2, param_node, $3);
|
||||
merge_nodes(param_list_node, result, T_EXPR_LIST, param_list_node);
|
||||
make_name_node($$, result->malloc_pool_, "log");
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS, 2, $$, param_list_node);
|
||||
}
|
||||
| LN '(' expr ')'
|
||||
{
|
||||
ParseNode *param_node = NULL;
|
||||
malloc_terminal_node(param_node, result->malloc_pool_, T_SFU_DOUBLE);
|
||||
int64_t len = strlen("2.718281828459045");
|
||||
param_node->str_value_ = parse_strndup("2.718281828459045", len, result->malloc_pool_);
|
||||
if (OB_UNLIKELY(NULL == param_node->str_value_)) {
|
||||
yyerror(NULL, result, "No more space for mallocing string\n");
|
||||
YYABORT_NO_MEMORY;
|
||||
}
|
||||
param_node->str_len_ = len;
|
||||
ParseNode *param_list_node = NULL;
|
||||
malloc_non_terminal_node(param_list_node, result->malloc_pool_, T_LINK_NODE, 2, param_node, $3);
|
||||
merge_nodes(param_list_node, result, T_EXPR_LIST, param_list_node);
|
||||
make_name_node($$, result->malloc_pool_, "log");
|
||||
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS, 2, $$, param_list_node);
|
||||
}
|
||||
| function_name '(' opt_expr_as_list ')'
|
||||
{
|
||||
if (NULL != $3)
|
||||
@ -12611,10 +12808,12 @@ ACCOUNT
|
||||
| LINESTRING
|
||||
| LIST_
|
||||
| LISTAGG
|
||||
| LN
|
||||
| LOCAL
|
||||
| LOCALITY
|
||||
| LOCKED
|
||||
| LOCKS
|
||||
| LOG
|
||||
| LOGFILE
|
||||
| LOGONLY_REPLICA_NUM
|
||||
| LOGS
|
||||
|
||||
Reference in New Issue
Block a user