Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
4acae240
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4acae240
编写于
7月 28, 2021
作者:
W
wangt1xiuyi
提交者:
wangzelin.wzl
7月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support full non_reserved_word can be as alias name
上级
6e9e639a
变更
3
展开全部
显示空白变更内容
内联
并排
Showing
3 changed file
with
8274 addition
and
8042 deletion
+8274
-8042
src/sql/parser/gen_parser.sh
src/sql/parser/gen_parser.sh
+1
-1
src/sql/parser/sql_parser_mysql_mode.y
src/sql/parser/sql_parser_mysql_mode.y
+93
-6
src/sql/parser/sql_parser_mysql_mode_tab.c
src/sql/parser/sql_parser_mysql_mode_tab.c
+8180
-8035
未找到文件。
src/sql/parser/gen_parser.sh
浏览文件 @
4acae240
src/sql/parser/sql_parser_mysql_mode.y
浏览文件 @
4acae240
...
@@ -343,7 +343,7 @@ END_P SET_VAR DELIMITER
...
@@ -343,7 +343,7 @@ END_P SET_VAR DELIMITER
%type <node> index_hint_definition index_hint_list
%type <node> index_hint_definition index_hint_list
%type <node> tracing_num_list
%type <node> tracing_num_list
%type <node> qb_name_option
%type <node> qb_name_option
%type <node> join_condition inner_join_type opt_inner outer_join_type opt_outer natural_join_type
%type <node> join_condition inner_join_type opt_inner outer_join_type opt_outer natural_join_type
except_full_outer_join_type opt_full_table_factor
%type <ival> string_length_i opt_string_length_i opt_string_length_i_v2 opt_int_length_i opt_bit_length_i opt_datetime_fsp_i opt_unsigned_i opt_zerofill_i opt_year_i opt_time_func_fsp_i
%type <ival> string_length_i opt_string_length_i opt_string_length_i_v2 opt_int_length_i opt_bit_length_i opt_datetime_fsp_i opt_unsigned_i opt_zerofill_i opt_year_i opt_time_func_fsp_i
%type <node> opt_float_precision opt_number_precision
%type <node> opt_float_precision opt_number_precision
%type <node> opt_equal_mark opt_default_mark read_only_or_write not not2 opt_disk_alias
%type <node> opt_equal_mark opt_default_mark read_only_or_write not not2 opt_disk_alias
...
@@ -8692,29 +8692,67 @@ joined_table:
...
@@ -8692,29 +8692,67 @@ joined_table:
/**
/**
* ref: https://dev.mysql.com/doc/refman/8.0/en/join.html
* ref: https://dev.mysql.com/doc/refman/8.0/en/join.html
*/
*/
table_reference inner_join_type table_factor %prec LOWER_ON
table_reference inner_join_type
opt_full_
table_factor %prec LOWER_ON
{
{
JOIN_MERGE_NODES($1, $3);
JOIN_MERGE_NODES($1, $3);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, NULL, NULL);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, NULL, NULL);
}
}
| table_reference inner_join_type table_factor ON expr
| table_reference inner_join_type
opt_full_
table_factor ON expr
{
{
JOIN_MERGE_NODES($1, $3);
JOIN_MERGE_NODES($1, $3);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, $5, NULL);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, $5, NULL);
}
}
| table_reference inner_join_type table_factor USING '(' column_list ')'
| table_reference inner_join_type
opt_full_
table_factor USING '(' column_list ')'
{
{
JOIN_MERGE_NODES($1, $3);
JOIN_MERGE_NODES($1, $3);
ParseNode *condition_node = NULL;
ParseNode *condition_node = NULL;
merge_nodes(condition_node, result, T_COLUMN_LIST, $6);
merge_nodes(condition_node, result, T_COLUMN_LIST, $6);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, condition_node, NULL);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, condition_node, NULL);
}
}
| table_reference
outer_join_type
table_factor join_condition
| table_reference
except_full_outer_join_type opt_full_
table_factor join_condition
{
{
JOIN_MERGE_NODES($1, $3);
JOIN_MERGE_NODES($1, $3);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, $4, NULL);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $2, $1, $3, $4, NULL);
}
}
| table_reference natural_join_type table_factor
| table_reference FULL JOIN opt_full_table_factor join_condition
{
JOIN_MERGE_NODES($1, $4);
malloc_terminal_node($$, result->malloc_pool_, T_JOIN_FULL);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $$, $1, $4, $5, NULL);
}
| table_reference FULL OUTER JOIN opt_full_table_factor join_condition
{
JOIN_MERGE_NODES($1, $5);
malloc_terminal_node($$, result->malloc_pool_, T_JOIN_FULL);
malloc_non_terminal_node($$, result->malloc_pool_, T_JOINED_TABLE, 5, $$, $1, $5, $6, NULL);
}
| table_reference FULL %prec LOWER_COMMA
{
if ($1->type_ == T_ORG) {
ParseNode *name_node = NULL;
make_name_node(name_node, result->malloc_pool_, "full");
malloc_non_terminal_node($$, result->malloc_pool_, T_ALIAS, $1->num_child_ + 1);
for (int i = 0; i <= $1->num_child_; ++i) {
if (i == 0) {
$$->children_[i] = $1->children_[i];
} else if (i == 1) {
$$->children_[i] = name_node;
} else {
$$->children_[i] = $1->children_[i - 1];
}
}
} else if ($1->type_ == T_ALIAS && $1->children_[1] != NULL &&
strlen($1->children_[1]->str_value_) == 0) {
ParseNode *name_node = NULL;
make_name_node(name_node, result->malloc_pool_, "full");
$1->children_[1] = name_node;
$$ = $1;
} else {
yyerror(&@2, result, "occur multi alias name\n");
YYERROR;
}
}
| table_reference natural_join_type opt_full_table_factor
{
{
JOIN_MERGE_NODES($1, $3);
JOIN_MERGE_NODES($1, $3);
...
@@ -8725,6 +8763,39 @@ table_reference inner_join_type table_factor %prec LOWER_ON
...
@@ -8725,6 +8763,39 @@ table_reference inner_join_type table_factor %prec LOWER_ON
}
}
;
;
opt_full_table_factor:
table_factor %prec LOWER_COMMA
{
$$ = $1;
}
| table_factor FULL
{
if ($1->type_ == T_ORG) {
ParseNode *name_node = NULL;
make_name_node(name_node, result->malloc_pool_, "full");
malloc_non_terminal_node($$, result->malloc_pool_, T_ALIAS, $1->num_child_ + 1);
for (int i = 0; i <= $1->num_child_; ++i) {
if (i == 0) {
$$->children_[i] = $1->children_[i];
} else if (i == 1) {
$$->children_[i] = name_node;
} else {
$$->children_[i] = $1->children_[i - 1];
}
}
} else if ($1->type_ == T_ALIAS && $1->children_[1] != NULL &&
strlen($1->children_[1]->str_value_) == 0) {
ParseNode *name_node = NULL;
make_name_node(name_node, result->malloc_pool_, "full");
$1->children_[1] = name_node;
$$ = $1;
} else {
yyerror(&@2, result, "occur multi alias name\n");
YYERROR;
}
}
;
natural_join_type:
natural_join_type:
NATURAL outer_join_type
NATURAL outer_join_type
{
{
...
@@ -8778,6 +8849,22 @@ FULL opt_outer JOIN
...
@@ -8778,6 +8849,22 @@ FULL opt_outer JOIN
}
}
;
;
except_full_outer_join_type:
LEFT opt_outer JOIN
{
/* make bison mute */
(void)($2);
malloc_terminal_node($$, result->malloc_pool_, T_JOIN_LEFT);
}
| RIGHT opt_outer JOIN
{
/* make bison mute */
(void)($2);
malloc_terminal_node($$, result->malloc_pool_, T_JOIN_RIGHT);
}
;
opt_outer:
opt_outer:
OUTER { $$ = NULL; }
OUTER { $$ = NULL; }
| /* EMPTY */ { $$ = NULL; }
| /* EMPTY */ { $$ = NULL; }
...
...
src/sql/parser/sql_parser_mysql_mode_tab.c
浏览文件 @
4acae240
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录