فهرست منبع

HUE-5670 [editor] Add autocompletion support for Kudu

This adds new column options and partition improvements related to creating Kudu tables.
Johan Ahlen 8 سال پیش
والد
کامیت
0b726dd

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/aceSqlWorker.js

@@ -14,8 +14,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-importScripts('/static/desktop/js/autocomplete/sql.js?version=9');
-importScripts('/static/desktop/js/sqlFunctions.js?version=9');
+importScripts('/static/desktop/js/autocomplete/sql.js?version=10');
+importScripts('/static/desktop/js/sqlFunctions.js?version=10');
 
 (function () {
 

+ 9 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql.jisonlex

@@ -209,12 +209,15 @@
 <impala>'FUNCTION'                         { return '<impala>FUNCTION'; }
 <impala>'FUNCTIONS'                        { return '<impala>FUNCTIONS'; }
 <impala>'GROUP'                            { return '<impala>GROUP'; }
+<impala>'HASH'                             { return '<impala>HASH'; }
 <impala>'INCREMENTAL'                      { return '<impala>INCREMENTAL'; }
 <impala>'INSERT'                           { determineCase(yytext); return '<impala>INSERT'; }
 <impala>'INTERVAL'                         { return '<impala>INTERVAL'; }
 <impala>'INIT_FN'                          { return '<impala>INIT_FN'; }
 <impala>'INVALIDATE'                       { determineCase(yytext); return '<impala>INVALIDATE'; }
 <impala>'INPATH'                           { this.begin('hdfs'); return '<impala>INPATH'; }
+<impala>'KEY'                              { return '<impala>KEY'; }
+<impala>'KUDU'                             { return '<impala>KUDU'; }
 <impala>'LAST'                             { return '<impala>LAST'; }
 <impala>LIKE\s+PARQUET                     { this.begin('hdfs'); return '<impala>LIKE_PARQUET'; }
 <impala>'LIMIT'                            { return '<impala>LIMIT'; }
@@ -230,6 +233,7 @@
 <impala>'PARTITIONED'                      { return '<impala>PARTITIONED'; }
 <impala>'PARTITIONS'                       { return '<impala>PARTITIONS'; }
 <impala>'PREPARE_FN'                       { return '<impala>PREPARE_FN'; }
+<impala>'PRIMARY'                          { return '<impala>PRIMARY'; }
 <impala>'RCFILE'                           { return '<impala>RCFILE'; }
 <impala>'REAL'                             { return '<impala>REAL'; }
 <impala>'REFRESH'                          { determineCase(yytext); return '<impala>REFRESH'; }
@@ -255,11 +259,16 @@
 <impala>'UPDATE_FN'                        { return '<impala>UPDATE_FN'; }
 <impala>'URI'                              { return '<impala>URI'; }
 <impala>'USING'                            { return '<impala>USING'; }
+<impala>PARTITION\s+VALUE\s                { return '<impala>PARTITION_VALUE'; }
 
 // Non-reserved Keywords
 <impala>'ANALYTIC'                         { return '<impala>ANALYTIC'; }
 <impala>'ANTI'                             { return '<impala>ANTI'; }
+<impala>'BLOCK_SIZE'                       { return '<impala>BLOCK_SIZE'; }
+<impala>'COMPRESSION'                      { return '<impala>COMPRESSION'; }
 <impala>'CURRENT'                          { return '<impala>CURRENT'; }
+<impala>'DEFAULT'                          { return '<impala>DEFAULT'; }
+<impala>'ENCODING'                         { return '<impala>ENCODING'; }
 <impala>'GRANT'                            { return '<impala>GRANT'; }
 <impala>'ROLE'                             { return '<impala>ROLE'; }
 <impala>'ROLES'                            { return '<impala>ROLES'; }

+ 239 - 6
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_create.jison

@@ -219,6 +219,9 @@ TableDefinitionRightPart_EDIT
        }
        if (!$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
          keywords.push({ value: 'PARTITIONED BY', weight: 9 });
+         if (isImpala()) {
+           keywords.push({ value: 'PARTITION BY', weight: 9 });
+         }
        }
        if (isImpala() && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
          keywords.push({ value: 'WITH SERDEPROPERTIES', weight: 8 });
@@ -298,14 +301,22 @@ ParenthesizedColumnSpecificationList_EDIT
 
 ColumnSpecificationList
  : ColumnSpecification
- | ColumnSpecificationList ',' ColumnSpecification  -> $3
+ | ColumnSpecificationList ',' ImpalaPrimaryKeySpecification                              -> $3
+ | ColumnSpecificationList ',' ColumnSpecification                                        -> $3
  ;
 
 ColumnSpecificationList_EDIT
  : ColumnSpecification_EDIT
  | ColumnSpecification_EDIT ',' ColumnSpecificationList
+ | ColumnSpecificationList ',' ImpalaPrimaryKeySpecification_EDIT
  | ColumnSpecificationList ',' ColumnSpecification_EDIT
  | ColumnSpecificationList ',' ColumnSpecification_EDIT ',' ColumnSpecificationList
+ | ColumnSpecificationList ',' 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['PRIMARY KEY']);
+     }
+   }
  | ColumnSpecification 'CURSOR'
    {
      checkForKeywords($1);
@@ -325,20 +336,91 @@ ColumnSpecificationList_EDIT
  ;
 
 ColumnSpecification
- : ColumnIdentifier ColumnDataType OptionalComment
+ : ColumnIdentifier ColumnDataType OptionalColumnOptions
    {
-     if (!$3) {
-       $$ = { suggestKeywords: ['COMMENT'] };
+     var keywords = [];
+     if (isImpala()) {
+       if (!$3['primary']) {
+         keywords.push('PRIMARY KEY');
+       }
+       if (!$3['encoding']) {
+         keywords.push('ENCODING');
+       }
+       if (!$3['compression']) {
+         keywords.push('COMPRESSION');
+       }
+       if (!$3['default']) {
+         keywords.push('DEFAULT');
+       }
+       if (!$3['block_size']) {
+         keywords.push('BLOCK_SIZE');
+       }
+       if (!$3['null']) {
+         keywords.push('NOT NULL');
+         keywords.push('NULL');
+       }
+     }
+     if (!$3['comment']) {
+       keywords.push('COMMENT');
+     }
+     if (keywords.length > 0) {
+       $$ = { suggestKeywords: keywords };
      }
    }
  ;
 
 ColumnSpecification_EDIT
- : ColumnIdentifier 'CURSOR' OptionalComment
+ : ColumnIdentifier 'CURSOR' OptionalColumnOptions
    {
      suggestKeywords(getColumnDataTypeKeywords());
    }
- | ColumnIdentifier ColumnDataType_EDIT OptionalComment
+ | ColumnIdentifier ColumnDataType_EDIT OptionalColumnOptions
+ | ColumnIdentifier ColumnDataType ColumnOptions_EDIT
+ ;
+
+OptionalColumnOptions
+ :                      -> {}
+ | ColumnOptions
+ ;
+
+ColumnOptions
+ : ColumnOption
+   {
+     $$ = {};
+     $$[$1] = true;
+   }
+ | ColumnOptions ColumnOption
+   {
+     $1[$2] = true;
+   }
+ ;
+
+ColumnOptions_EDIT
+ : ColumnOption_EDIT
+ | ColumnOption_EDIT ColumnOptions
+ | ColumnOptions ColumnOption_EDIT
+ | ColumnOptions ColumnOption_EDIT ColumnOptions
+ ;
+
+ColumnOption
+ : ImpalaPrimaryKey                                          -> 'primary'
+ | '<impala>ENCODING' RegularIdentifier                      -> 'encoding'
+ | '<impala>COMPRESSION' RegularIdentifier                   -> 'compression'
+ | '<impala>DEFAULT' NonParenthesizedValueExpressionPrimary  -> 'default'
+ | '<impala>BLOCK_SIZE' UnsignedNumericLiteral               -> 'block_size'
+ | 'NOT' 'NULL'                                              -> 'null'
+ | 'NULL'                                                    -> 'null'
+ | Comment                                                   -> 'comment'
+ ;
+
+ColumnOption_EDIT
+ : ImpalaPrimaryKey_EDIT
+ | 'NOT' 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['NULL']);
+     }
+   }
  ;
 
 ColumnDataType
@@ -493,6 +575,27 @@ GreaterThanOrError
  | error
  ;
 
+ImpalaPrimaryKeySpecification
+ : ImpalaPrimaryKey ParenthesizedColumnList
+ ;
+
+ImpalaPrimaryKeySpecification_EDIT
+ : ImpalaPrimaryKey_EDIT
+ | ImpalaPrimaryKey_EDIT ParenthesizedColumnList
+ | ImpalaPrimaryKey ParenthesizedColumnList_EDIT
+ ;
+
+ImpalaPrimaryKey
+ : '<impala>PRIMARY' '<impala>KEY'
+ ;
+
+ImpalaPrimaryKey_EDIT
+ : '<impala>PRIMARY' 'CURSOR'
+   {
+     suggestKeywords(['KEY']);
+   }
+ ;
+
 OptionalPartitionedBy
  :
  | PartitionedBy
@@ -500,6 +603,8 @@ OptionalPartitionedBy
 
 PartitionedBy
  : HiveOrImpalaPartitioned 'BY' ParenthesizedColumnSpecificationList
+ | 'PARTITION' 'BY' 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList
+ | 'PARTITION' 'BY' '<impala>HASH' ParenthesizedColumnList '<impala>PARTITIONS' UnsignedNumericLiteral
  ;
 
 PartitionedBy_EDIT
@@ -513,6 +618,133 @@ PartitionedBy_EDIT
    }
  | HiveOrImpalaPartitioned 'BY' ParenthesizedColumnSpecificationList_EDIT
  | HiveOrImpalaPartitioned ParenthesizedColumnSpecificationList_EDIT
+ | 'PARTITION' 'CURSOR'
+   {
+     suggestKeywords(['BY']);
+   }
+ | 'PARTITION' 'BY' 'CURSOR'
+   {
+     suggestKeywords(['HASH', 'RANGE']);
+   }
+ | 'PARTITION' 'BY' 'RANGE' ParenthesizedColumnList_EDIT
+ | 'PARTITION' 'BY' 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList_EDIT
+ | 'PARTITION' 'BY' '<impala>HASH' ParenthesizedColumnList_EDIT
+ | 'PARTITION' 'BY' '<impala>HASH' ParenthesizedColumnList 'CURSOR'
+   {
+     suggestKeywords(['PARTITIONS']);
+   }
+ | 'PARTITION' 'BY' '<impala>HASH' ParenthesizedColumnList_EDIT '<impala>PARTITIONS' UnsignedNumericLiteral
+ ;
+
+ParenthesizedPartitionValuesList
+ : '(' PartitionValueList ')'
+ ;
+
+ParenthesizedPartitionValuesList_EDIT
+ : '(' 'CURSOR' RightParenthesisOrError
+   {
+     if (isImpala()) {
+       suggestKeywords(['PARTITION']);
+     }
+   }
+ |'(' PartitionValueList_EDIT RightParenthesisOrError
+ ;
+
+PartitionValueList
+ : PartitionValue
+ | PartitionValueList ',' PartitionValue
+ ;
+
+PartitionValueList_EDIT
+ : PartitionValue_EDIT
+ | PartitionValueList ',' 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['PARTITION']);
+     }
+   }
+ | PartitionValueList ',' 'CURSOR' ',' PartitionValueList
+   {
+     if (isImpala()) {
+       suggestKeywords(['PARTITION']);
+     }
+   }
+ | PartitionValueList ',' PartitionValue_EDIT
+ | PartitionValueList ',' PartitionValue_EDIT ',' PartitionValueList
+ ;
+
+PartitionValue
+ : 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression
+ | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES'
+ | '<impala>PARTITION_VALUE' '=' ValueExpression
+ ;
+
+PartitionValue_EDIT
+ : 'PARTITION' 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['VALUE', 'VALUES']);
+     }
+   }
+ | '<impala>PARTITION_VALUE' 'CURSOR'
+   {
+     suggestKeywords(['=']);
+   }
+ | '<impala>PARTITION_VALUE' '=' 'CURSOR'
+   {
+     suggestFunctions();
+   }
+ | 'PARTITION' ValueExpression_EDIT
+   {
+     if ($2.endsWithLessThanOrEqual && isImpala()) {
+      suggestKeywords(['VALUES']);
+     }
+   }
+ | 'PARTITION' ValueExpression 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['<', '<=']);
+     }
+   }
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'CURSOR'
+   {
+    if (isImpala()) {
+      suggestKeywords(['VALUES']);
+    }
+   }
+ | 'PARTITION' ValueExpression_EDIT LessThanOrEqualTo 'VALUES'
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['<', '<=']);
+     }
+   }
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo 'CURSOR'
+   {
+     if (isImpala()) {
+      suggestFunctions();
+     }
+   }
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
+ | 'PARTITION' 'VALUES' 'CURSOR'
+   {
+     if (isImpala()) {
+       suggestKeywords(['<', '<=']);
+     }
+   }
+ | 'PARTITION' 'VALUES' LessThanOrEqualTo 'CURSOR'
+   {
+     if (isImpala()) {
+      suggestFunctions();
+     }
+   }
+ | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
+ ;
+
+LessThanOrEqualTo
+ : '<'
+ | 'COMPARISON_OPERATOR' // This is fine for autocompletion
  ;
 
 OptionalClusteredBy
@@ -701,6 +933,7 @@ FileFormat
  | '<hive>SEQUENCEFILE'
  | '<hive>TEXTFILE'
  | '<impala>AVRO'
+ | '<impala>KUDU'
  | '<impala>PARQUET'
  | '<impala>RCFILE'
  | '<impala>SEQUENCEFILE'

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 6 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_main.jison


+ 2 - 2
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_valueExpression.jison

@@ -188,7 +188,7 @@ ValueExpression_EDIT
    {
      valueExpressionSuggest($1, $2);
      applyTypeToSuggestions($1.types);
-     $$ = { types: [ 'BOOLEAN' ] , typeSet: true };
+     $$ = { types: [ 'BOOLEAN' ] , typeSet: true, endsWithLessThanOrEqual: true };
    }
  | ValueExpression '>' PartialBacktickedOrAnyCursor
    {
@@ -200,7 +200,7 @@ ValueExpression_EDIT
    {
      valueExpressionSuggest($1, $2);
      applyTypeToSuggestions($1.types);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
+     $$ = { types: [ 'BOOLEAN' ], typeSet: true, endsWithLessThanOrEqual: $2 === '<='  };
    }
  | ValueExpression '=' ValueExpression_EDIT
    {

+ 2 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_valueExpression_dev.jison

@@ -334,9 +334,10 @@ HiveOrImpalaRightSquareBracket
  | '<impala>]'
  ;
 
-HiveOrImpalaPartitioned
+HiveOrImpalaPartitionedOrPartition
  : '<hive>PARTITIONED'
  | '<impala>PARTITIONED'
+ | '<impala>PARTITION'
  ;
 
 HiveOrImpalaStored

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sql.js


+ 1 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/sql_support.js

@@ -900,7 +900,7 @@ var suggestFileFormats = function () {
   if (isHive()) {
     suggestKeywords(['AVRO', 'INPUTFORMAT', 'ORC', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']);
   } else {
-    suggestKeywords(['AVRO', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']);
+    suggestKeywords(['AVRO', 'KUDU', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']);
   }
 };
 

+ 3 - 3
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter2.js

@@ -1110,10 +1110,10 @@ var SqlAutocompleter2 = (function () {
     ADD: true, AGGREGATE: true, ALL: true, ALTER: true, AND: true, API_VERSION: true, AS: true, ASC: true, AVRO: true, BETWEEN: true, BIGINT: true, BINARY: true, BOOLEAN: true, BY: true, CACHED: true, CASE: true, CAST: true, CHANGE: true, CHAR: true, CLASS: true, CLOSE_FN: true,
     COLUMN: true, COLUMNS: true, COMMENT: true, COMPUTE: true, CREATE: true, CROSS: true, DATA: true, DATABASE: true, DATABASES: true, DATE: true, DATETIME: true, DECIMAL: true, DELIMITED: true, DESC: true, DESCRIBE: true, DISTINCT: true, DIV: true, DOUBLE: true, DROP: true, ELSE: true, END: true,
     ESCAPED: true, EXISTS: true, EXPLAIN: true, EXTERNAL: true, FALSE: true, FIELDS: true, FILEFORMAT: true, FINALIZE_FN: true, FIRST: true, FLOAT: true, FORMAT: true, FORMATTED: true, FROM: true, FULL: true, FUNCTION: true, FUNCTIONS: true, GROUP: true, HAVING: true, IF: true, IN: true, INCREMENTAL: true,
-    INIT_FN: true, INNER: true, INPATH: true, INSERT: true, INT: true, INTEGER: true, INTERMEDIATE: true, INTERVAL: true, INTO: true, INVALIDATE: true, IS: true, JOIN: true, LAST: true, LEFT: true, LIKE: true, LIMIT: true, LINES: true, LOAD: true, LOCATION: true, MERGE_FN: true, METADATA: true,
-    NOT: true, NULL: true, NULLS: true, OFFSET: true, ON: true, OR: true, ORDER: true, OUTER: true, OVERWRITE: true, PARQUET: true, PARQUETFILE: true, PARTITION: true, PARTITIONED: true, PARTITIONS: true, PREPARE_FN: true, PRODUCED: true, RCFILE: true, REAL: true, REFRESH: true, REGEXP: true, RENAME: true,
+    INIT_FN: true, INNER: true, INPATH: true, INSERT: true, INT: true, INTEGER: true, INTERMEDIATE: true, INTERVAL: true, INTO: true, INVALIDATE: true, IS: true, JOIN: true, KEY: true, KUDU: true, LAST: true, LEFT: true, LIKE: true, LIMIT: true, LINES: true, LOAD: true, LOCATION: true, MERGE_FN: true, METADATA: true,
+    NOT: true, NULL: true, NULLS: true, OFFSET: true, ON: true, OR: true, ORDER: true, OUTER: true, OVERWRITE: true, PARQUET: true, PARQUETFILE: true, PARTITION: true, PARTITIONED: true, PARTITIONS: true, PREPARE_FN: true, PRIMARY: true, PRODUCED: true, RCFILE: true, REAL: true, REFRESH: true, REGEXP: true, RENAME: true,
     REPLACE: true, RETURNS: true, RIGHT: true, RLIKE: true, ROW: true, SCHEMA: true, SCHEMAS: true, SELECT: true, SEMI: true, SEQUENCEFILE: true, SERDEPROPERTIES: true, SERIALIZE_FN: true, SET: true, SHOW: true, SMALLINT: true, STATS: true, STORED: true, STRAIGHT_JOIN: true, STRING: true, SYMBOL: true, TABLE: true,
-    TABLES: true, TBLPROPERTIES: true, TERMINATED: true, TEXTFILE: true, THEN: true, TIMESTAMP: true, TINYINT: true, TO: true, TRUE: true, UNCACHED: true, UNION: true, UPDATE_FN: true, USE: true, USING: true, VALUES: true, VIEW: true, WHEN: true, WHERE: true, WITH: true,
+    TABLES: true, TBLPROPERTIES: true, TERMINATED: true, TEXTFILE: true, THEN: true, TIMESTAMP: true, TINYINT: true, TO: true, TRUE: true, UNCACHED: true, UNION: true, UPDATE_FN: true, USE: true, USING: true, VALUES: true, VIEW: true, WHEN: true, WHERE: true, WITH: true
   };
 
   SqlAutocompleter2.prototype.backTickIfNeeded = function (text) {

+ 3 - 3
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter3.js

@@ -64,10 +64,10 @@ var SqlAutocompleter3 = (function () {
     ADD: true, AGGREGATE: true, ALL: true, ALTER: true, AND: true, API_VERSION: true, AS: true, ASC: true, AVRO: true, BETWEEN: true, BIGINT: true, BINARY: true, BOOLEAN: true, BY: true, CACHED: true, CASE: true, CAST: true, CHANGE: true, CHAR: true, CLASS: true, CLOSE_FN: true,
     COLUMN: true, COLUMNS: true, COMMENT: true, COMPUTE: true, CREATE: true, CROSS: true, DATA: true, DATABASE: true, DATABASES: true, DATE: true, DATETIME: true, DECIMAL: true, DELIMITED: true, DESC: true, DESCRIBE: true, DISTINCT: true, DIV: true, DOUBLE: true, DROP: true, ELSE: true, END: true,
     ESCAPED: true, EXISTS: true, EXPLAIN: true, EXTERNAL: true, FALSE: true, FIELDS: true, FILEFORMAT: true, FINALIZE_FN: true, FIRST: true, FLOAT: true, FORMAT: true, FORMATTED: true, FROM: true, FULL: true, FUNCTION: true, FUNCTIONS: true, GROUP: true, HAVING: true, IF: true, IN: true, INCREMENTAL: true,
-    INIT_FN: true, INNER: true, INPATH: true, INSERT: true, INT: true, INTEGER: true, INTERMEDIATE: true, INTERVAL: true, INTO: true, INVALIDATE: true, IS: true, JOIN: true, LAST: true, LEFT: true, LIKE: true, LIMIT: true, LINES: true, LOAD: true, LOCATION: true, MERGE_FN: true, METADATA: true,
-    NOT: true, NULL: true, NULLS: true, OFFSET: true, ON: true, OR: true, ORDER: true, OUTER: true, OVERWRITE: true, PARQUET: true, PARQUETFILE: true, PARTITION: true, PARTITIONED: true, PARTITIONS: true, PREPARE_FN: true, PRODUCED: true, RCFILE: true, REAL: true, REFRESH: true, REGEXP: true, RENAME: true,
+    INIT_FN: true, INNER: true, INPATH: true, INSERT: true, INT: true, INTEGER: true, INTERMEDIATE: true, INTERVAL: true, INTO: true, INVALIDATE: true, IS: true, JOIN: true, KEY: true, KUDU: true, LAST: true, LEFT: true, LIKE: true, LIMIT: true, LINES: true, LOAD: true, LOCATION: true, MERGE_FN: true, METADATA: true,
+    NOT: true, NULL: true, NULLS: true, OFFSET: true, ON: true, OR: true, ORDER: true, OUTER: true, OVERWRITE: true, PARQUET: true, PARQUETFILE: true, PARTITION: true, PARTITIONED: true, PARTITIONS: true, PREPARE_FN: true, PRIMARY: true, PRODUCED: true, RCFILE: true, REAL: true, REFRESH: true, REGEXP: true, RENAME: true,
     REPLACE: true, RETURNS: true, RIGHT: true, RLIKE: true, ROW: true, SCHEMA: true, SCHEMAS: true, SELECT: true, SEMI: true, SEQUENCEFILE: true, SERDEPROPERTIES: true, SERIALIZE_FN: true, SET: true, SHOW: true, SMALLINT: true, STATS: true, STORED: true, STRAIGHT_JOIN: true, STRING: true, SYMBOL: true, TABLE: true,
-    TABLES: true, TBLPROPERTIES: true, TERMINATED: true, TEXTFILE: true, THEN: true, TIMESTAMP: true, TINYINT: true, TO: true, TRUE: true, UNCACHED: true, UNION: true, UPDATE_FN: true, USE: true, USING: true, VALUES: true, VIEW: true, WHEN: true, WHERE: true, WITH: true,
+    TABLES: true, TBLPROPERTIES: true, TERMINATED: true, TEXTFILE: true, THEN: true, TIMESTAMP: true, TINYINT: true, TO: true, TRUE: true, UNCACHED: true, UNION: true, UPDATE_FN: true, USE: true, USING: true, VALUES: true, VIEW: true, WHEN: true, WHERE: true, WITH: true
   };
 
   /**

+ 351 - 4
desktop/core/src/desktop/static/desktop/spec/autocomplete/sqlSpecCreate.js

@@ -1258,9 +1258,9 @@
             afterCursor: ', boo INT) AS SELECT * FROM baa;',
             dialect: 'impala',
             hasLocations: true,
+            containsKeywords: ['COMMENT'],
             expectedResult: {
-              lowerCase: false,
-              suggestKeywords: ['COMMENT']
+              lowerCase: false
             }
           });
         });
@@ -1277,14 +1277,14 @@
           });
         });
 
-        it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
+        it('should suggest keywords for "CREATE TABLE foo (id int) STORED AS |"', function () {
           assertAutoComplete({
             beforeCursor: 'CREATE TABLE foo (id int) STORED AS ',
             afterCursor: '',
             dialect: 'impala',
             expectedResult: {
               lowerCase: false,
-              suggestKeywords: ['AVRO', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']
+              suggestKeywords: ['AVRO', 'KUDU', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']
             }
           });
         });
@@ -1508,6 +1508,353 @@
             }
           });
         });
+
+        it('should handle "CREATE TABLE IF NOT EXISTS tbl (i INT PRIMARY KEY, b INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE IF NOT EXISTS tbl (i INT PRIMARY KEY, b INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE IF NOT EXISTS tbl (i INT PRIMARY KEY, b INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) PARTITION BY RANGE (a, b) (PARTITION 1 <= VALUES < 2) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE IF NOT EXISTS tbl (i INT PRIMARY KEY, b INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) PARTITION BY RANGE (a, b) (PARTITION 1 <= VALUES < 2) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE IF NOT EXISTS tbl (i INT PRIMARY KEY, b INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) PARTITION BY RANGE (a) (PARTITION VALUE = 50, PARTITION 50 < VALUES <= 100) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE IF NOT EXISTS tbl (i INT PRIMARY KEY, b INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) PARTITION BY RANGE (a) (PARTITION VALUE = 50, PARTITION 50 < VALUES <= 100) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE IF NOT EXISTS tbl (i INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) PARTITION BY HASH (a, b) PARTITIONS 10 STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE IF NOT EXISTS tbl (i INT ENCODING bla COMPRESSION zip DEFAULT 10 BLOCK_SIZE 4 NOT NULL,' +
+            ' PRIMARY KEY (b)) PARTITION BY HASH (a, b) PARTITIONS 10 STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE foo (i INT) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE foo (i INT PRIMARY KEY) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE foo (i INT, j INT, PRIMARY KEY (i, j)) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT, j INT, PRIMARY KEY (i, j)) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE foo (i INT PRIMARY KEY, PRIMARY KEY(i)) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, PRIMARY KEY(i)) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) STORED AS KUDU;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) STORED AS KUDU;',
+            afterCursor: '',
+            dialect: 'impala',
+            containsKeywords: ['SELECT'],
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['BLOCK_SIZE', 'COMMENT', 'COMPRESSION', 'DEFAULT', 'ENCODING', 'NOT NULL', 'NULL', 'PRIMARY KEY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT BLOCK_SIZE 10 NOT NULL |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT BLOCK_SIZE 10 NOT NULL ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['COMMENT', 'COMPRESSION', 'DEFAULT', 'ENCODING', 'PRIMARY KEY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT BLOCK_SIZE 10 NOT NULL PRIMARY |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT BLOCK_SIZE 10 NOT NULL PRIMARY ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['KEY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['KEY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT, "', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT, ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['PRIMARY KEY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT, PRIMARY |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT, PRIMARY ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['KEY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) STORED AS |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) STORED AS ',
+            afterCursor: '',
+            dialect: 'impala',
+            noErrors: true,
+            containsKeywords: ['KUDU'],
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) ',
+            afterCursor: '',
+            dialect: 'impala',
+            noErrors: true,
+            containsKeywords: ['PARTITION BY', 'PARTITIONED BY', 'STORED AS'],
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION ',
+            afterCursor: '',
+            dialect: 'impala',
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['BY']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY ',
+            afterCursor: '',
+            dialect: 'impala',
+            noErrors: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['HASH', 'RANGE']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['PARTITION']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['VALUE', 'VALUES']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION 1 |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION 1 ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['<', '<=']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION 1 < |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION 1 < ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['VALUES'],
+              suggestFunctions: { types: ['NUMBER']}
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION VALUE |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION VALUE ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['=']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION VALUE = |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION VALUE = ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestFunctions: {}
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION cos(10) < VALUES, PARTITION VALUES |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY RANGE (i) (PARTITION cos(10) < VALUES, PARTITION VALUES ',
+            afterCursor: '',
+            dialect: 'impala',
+            hasLocations: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['<', '<=']
+            }
+          });
+        });
+
+        it('should suggest keywords for "CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY HASH (i) |"', function () {
+          assertAutoComplete({
+            beforeCursor: 'CREATE TABLE foo (i INT PRIMARY KEY, j INT PRIMARY KEY) PARTITION BY  HASH (i) ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['PARTITIONS']
+            }
+          });
+        });
       });
 
       describe('Hive specific', function () {

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است