ソースを参照

HUE-9219 [parser] Improve PartitionBy rules in impala (#1088)

* HUE-9219 [parser] Improve PartitionBy rules in impala

* Update partitionBy test cases in impala

Co-authored-by: Romain Rigaux <romain.rigaux@gmail.com>
Xiao Kang 5 年 前
コミット
b861b1d8f0

+ 6 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/sql_create.jison

@@ -560,7 +560,13 @@ PartitionedBy
  | 'PARTITION' 'BY' HashClauses
  | 'PARTITION' 'BY' HashClauses ',' RangeClause
  | 'PARTITION' 'BY' RangeClause
+ | 'PARTITIONED' 'BY' '(' ColumnIdentifierList ')'
  ;
+ 
+ ColumnIdentifierList
+: ColumnIdentifier ',' ColumnIdentifierList
+| ColumnIdentifier
+;
 
 PartitionedBy_EDIT
  : 'PARTITIONED' 'CURSOR'

ファイルの差分が大きいため隠しています
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/impala/impalaAutocompleteParser.js


ファイルの差分が大きいため隠しています
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/impala/impalaSyntaxParser.js


+ 5 - 5
desktop/core/src/desktop/js/parse/sql/impala/test/impalaAutocompleteParser.Create.test.js

@@ -651,7 +651,7 @@ describe('impalaAutocompleteParser.js CREATE statements', () => {
       assertAutoComplete({
         beforeCursor:
           'CREATE EXTERNAL TABLE IF NOT EXISTS foo.bar ' +
-          "PARTITIONED BY (foo int COMMENT 'col_comment', bar int COMMENT 'col_comment') " +
+          'PARTITIONED BY (foo, bar) ' +
           'SORT BY (foo, bar) ' +
           "COMMENT 'table_comment' " +
           "ROW FORMAT DELIMITED FIELDS TERMINATED BY 'c' ESCAPED BY 'c' " +
@@ -896,11 +896,11 @@ describe('impalaAutocompleteParser.js CREATE statements', () => {
       });
     });
 
-    it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED BY (boo INT, baa BIGINT |, boo INT) AS SELECT * FROM baa;"', () => {
+    it('should suggest keywords for "CREATE TABLE foo PARTITIONED BY (boo, baa, boo) AS | SELECT * FROM baa;"', () => {
       assertAutoComplete({
-        beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED BY (boo INT, baa BIGINT ',
-        afterCursor: ', boo INT) AS SELECT * FROM baa;',
-        containsKeywords: ['COMMENT'],
+        beforeCursor: 'CREATE TABLE foo PARTITIONED BY (boo, baa, boo) AS  ',
+        afterCursor: '',
+        containsKeywords: ['SELECT'],
         expectedResult: {
           lowerCase: false
         }

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません