You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2020/02/14 13:06:14 UTC

[incubator-doris] branch master updated: [FIX] Fix a sqlparser conflict imported by PR #2725 (#2906)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 5386c92  [FIX] Fix a sqlparser conflict imported by PR #2725 (#2906)
5386c92 is described below

commit 5386c92383c83f91ce001aabaff58e3e274ee55a
Author: yangzhg <78...@qq.com>
AuthorDate: Fri Feb 14 21:06:01 2020 +0800

    [FIX] Fix a sqlparser conflict imported by PR #2725 (#2906)
    
    Fix a sqlparser conflict imported by pr #2725, in that pr add some time unit to keyword
    I have moved those to time_unit
---
 fe/src/main/cup/sql_parser.cup | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/fe/src/main/cup/sql_parser.cup b/fe/src/main/cup/sql_parser.cup
index 2f640e6..84fd110 100644
--- a/fe/src/main/cup/sql_parser.cup
+++ b/fe/src/main/cup/sql_parser.cup
@@ -194,7 +194,7 @@ parser code {:
 :};
 
 // Total keywords of doris
-terminal String KW_ADD, KW_ADMIN, KW_AFTER, KW_AGGREGATE, KW_ALL, KW_ALTER, KW_AND, KW_ANTI, KW_AS, KW_ASC, KW_AUTHORS, 
+terminal String KW_ADD, KW_ADMIN, KW_AFTER, KW_AGGREGATE, KW_ALL, KW_ALTER, KW_AND, KW_ANTI, KW_AS, KW_ASC, KW_AUTHORS,
     KW_BACKEND, KW_BACKUP, KW_BETWEEN, KW_BEGIN, KW_BIGINT, KW_BITMAP, KW_BITMAP_UNION, KW_BOOLEAN, KW_BOTH, KW_BROKER, KW_BACKENDS, KW_BY, KW_BUILTIN,
     KW_CANCEL, KW_CASE, KW_CAST, KW_CHAIN, KW_CHAR, KW_CHARSET, KW_CLUSTER, KW_CLUSTERS,
     KW_COLLATE, KW_COLLATION, KW_COLUMN, KW_COLUMNS, KW_COMMENT, KW_COMMIT, KW_COMMITTED,
@@ -425,7 +425,7 @@ nonterminal GroupByClause group_by_clause, grouping_elements;
 //
 nonterminal String keyword, ident, ident_or_text, variable_name, text_or_password,
         charset_name_or_default, old_or_new_charset_name_or_default, opt_collate,
-        collation_name_or_default, type_func_name_keyword, type_function_name, opt_file_format;
+        collation_name_or_default, type_func_name_keyword, type_function_name, opt_file_format, time_unit;
 
 nonterminal String opt_db, opt_partition_name, procedure_or_function, opt_comment, opt_engine;
 nonterminal ColumnDef.DefaultValue opt_default_value;
@@ -3922,7 +3922,7 @@ timestamp_arithmetic_expr ::=
 
     RESULT = new TimestampArithmeticExpr(functionName.getFunction(), l.get(0), v, u);
   :}
-  | function_name:functionName LPAREN keyword:u COMMA expr:e1 COMMA expr:e2 RPAREN
+  | function_name:functionName LPAREN time_unit:u COMMA expr:e1 COMMA expr:e2 RPAREN
   {:
     RESULT = new TimestampArithmeticExpr(functionName.getFunction(), e2, e1, u);
   :}
@@ -4499,20 +4499,6 @@ keyword ::=
     {: RESULT = id; :}
     | KW_DYNAMIC:id
     {: RESULT = id; :}
-    | KW_YEAR:id
-    {: RESULT = id; :}
-    | KW_MONTH:id
-    {: RESULT = id; :}
-    | KW_WEEK:id
-    {: RESULT = id; :}
-    | KW_DAY:id
-    {: RESULT = id; :}
-    | KW_HOUR:id
-    {: RESULT = id; :}
-    | KW_MINUTE:id
-    {: RESULT = id; :}
-    | KW_SECOND:id
-    {: RESULT = id; :}
     ;
 
 // Identifier that contain keyword
@@ -4539,6 +4525,23 @@ ident_or_text ::=
     :}
     ;
 
+time_unit ::=
+    KW_YEAR:id
+    {: RESULT = id; :}
+    | KW_MONTH:id
+    {: RESULT = id; :}
+    | KW_WEEK:id
+    {: RESULT = id; :}
+    | KW_DAY:id
+    {: RESULT = id; :}
+    | KW_HOUR:id
+    {: RESULT = id; :}
+    | KW_MINUTE:id
+    {: RESULT = id; :}
+    | KW_SECOND:id
+    {: RESULT = id; :}
+    ;
+
 // TODO(zhaochun): Select for SQL-2003 (http://savage.net.au/SQL/sql-2003-2.bnf.html)
 
 // Specify a table derived from the result of a <table expression>.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org