Ver Fonte

HUE-9429 [editor] Extract and split CREATE and analyze type statements for Impala

Johan Ahlen há 5 anos atrás
pai
commit
2f509089c8
18 ficheiros alterados com 1496 adições e 1367 exclusões
  1. 0 1
      desktop/core/src/desktop/js/parse/jison/sql/impala/alter/alter_table.jison
  2. 2 2
      desktop/core/src/desktop/js/parse/jison/sql/impala/comment/comment_on.jison
  3. 2 66
      desktop/core/src/desktop/js/parse/jison/sql/impala/compute/compute_stats.jison
  4. 208 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_aggregate_function.jison
  5. 457 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_common.jison
  6. 77 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_database.jison
  7. 67 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_function.jison
  8. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_role.jison
  9. 443 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_table.jison
  10. 89 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_view.jison
  11. 49 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/invalidate/invalidate_metadata.jison
  12. 57 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/refresh/refresh.jison
  13. 0 1287
      desktop/core/src/desktop/js/parse/jison/sql/impala/sql_create.jison
  14. 0 1
      desktop/core/src/desktop/js/parse/jison/sql/impala/sql_insert.jison
  15. 0 4
      desktop/core/src/desktop/js/parse/jison/sql/impala/sql_main.jison
  16. 22 6
      desktop/core/src/desktop/js/parse/jison/sql/impala/structure.json
  17. 0 0
      desktop/core/src/desktop/js/parse/sql/impala/impalaAutocompleteParser.js
  18. 0 0
      desktop/core/src/desktop/js/parse/sql/impala/impalaSyntaxParser.js

+ 0 - 1
desktop/core/src/desktop/js/parse/jison/sql/impala/alter/alter_table.jison

@@ -208,7 +208,6 @@ OptionalColumn
  | 'COLUMN'
  ;
 
-
 ParenthesizedStatsList
  : '(' StatsList ')'
  ;

+ 2 - 2
desktop/core/src/desktop/js/parse/jison/sql/impala/alter/comment_on.jison → desktop/core/src/desktop/js/parse/jison/sql/impala/comment/comment_on.jison

@@ -14,11 +14,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-AlterStatement
+DataDefinition
  : CommentOn
  ;
 
-AlterStatement_EDIT
+DataDefinition_EDIT
  : CommentOn_EDIT
  ;
 

+ 2 - 66
desktop/core/src/desktop/js/parse/jison/sql/impala/sql_analyze.jison → desktop/core/src/desktop/js/parse/jison/sql/impala/compute/compute_stats.jison

@@ -15,75 +15,11 @@
 // limitations under the License.
 
 DataDefinition
- : RefreshStatement
- | InvalidateStatement
- | ComputeStatsStatement
+ : ComputeStatsStatement
  ;
 
 DataDefinition_EDIT
- : RefreshStatement_EDIT
- | InvalidateStatement_EDIT
- | ComputeStatsStatement_EDIT
- ;
-
-RefreshStatement
- : 'REFRESH' SchemaQualifiedTableIdentifier OptionalPartitionSpec
-   {
-     parser.addTablePrimary($2);
-   }
- | 'REFRESH' 'FUNCTIONS' DatabaseIdentifier
-   {
-     parser.addDatabaseLocation(@3, [{ name: $3 }]);
-   }
- | 'REFRESH' 'AUTHORIZATION'
- ;
-
-RefreshStatement_EDIT
- : 'REFRESH' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-     parser.suggestKeywords(['AUTHORIZATION', 'FUNCTIONS']);
-   }
- | 'REFRESH' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
- | 'REFRESH' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
-   {
-     parser.addTablePrimary($2);
-     if (!$3) {
-       parser.suggestKeywords(['PARTITION']);
-     }
-   }
- | 'REFRESH' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
- | 'REFRESH' 'FUNCTIONS' 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- ;
-
-InvalidateStatement
- : 'INVALIDATE' 'METADATA'
- | 'INVALIDATE' 'METADATA' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-InvalidateStatement_EDIT
- : 'INVALIDATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['METADATA']);
-   }
- | 'INVALIDATE' 'METADATA' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'INVALIDATE' 'METADATA' SchemaQualifiedTableIdentifier_EDIT
- | 'INVALIDATE' 'CURSOR' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($3);
-     parser.suggestKeywords(['METADATA']);
-   }
+ : ComputeStatsStatement_EDIT
  ;
 
 ComputeStatsStatement

+ 208 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_aggregate_function.jison

@@ -0,0 +1,208 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CreateStatement
+ : AggregateFunctionDefinition
+ ;
+
+CreateStatement
+ : AggregateFunctionDefinition_EDIT
+ ;
+
+AggregateFunctionDefinition
+ : 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ ;
+
+AggregateFunctionDefinition_EDIT
+ : 'CREATE' 'AGGREGATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['FUNCTION']);
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+   {
+     if (!$4) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists 'CURSOR'
+   {
+     if (!$4) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists_EDIT
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists_EDIT SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList 'CURSOR'
+   {
+     parser.suggestKeywords(['RETURNS']);
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   'CURSOR'
+   {
+     parser.suggestKeywords(['LOCATION']);
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn 'CURSOR'
+   {
+     if (!$9) {
+       parser.suggestKeywords([{value: 'INIT_FN', weight: 2 }, {value: 'UPDATE_FN', weight: 1 }]);
+     } else {
+       parser.suggestKeywords([{value: 'UPDATE_FN', weight: 1 }]);
+     }
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn 'CURSOR'
+   {
+     parser.suggestKeywords(['MERGE_FN']);
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate 'CURSOR'
+   {
+     if (!$12 && !$13 && !$14 && !$15 && !$16) {
+       parser.suggestKeywords([{value: 'PREPARE_FN', weight: 5 }, {value: 'CLOSE_FN', weight: 4 }, {value: 'SERIALIZE_FN', weight: 3 }, {value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
+     } else if ($12 && !$13 && !$14 && !$15 && !$16) {
+       parser.suggestKeywords([{value: 'CLOSE_FN', weight: 4 }, {value: 'SERIALIZE_FN', weight: 3 }, {value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
+     } else if ($13 && !$14 && !$15 && !$16) {
+       parser.suggestKeywords([{value: 'SERIALIZE_FN', weight: 3 }, {value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
+     } else if ($14 && !$15 && !$16) {
+       parser.suggestKeywords([{value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
+     } else if ($15 && !$16) {
+       parser.suggestKeywords([{value: 'INTERMEDIATE', weight: 1 }]);
+     }
+   }
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation_EDIT OptionalInitFn
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn_EDIT
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn_EDIT
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn_EDIT OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn_EDIT OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn_EDIT  OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn_EDIT OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn_EDIT OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn Intermediate_EDIT
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT
+   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation_EDIT OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn_EDIT UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
+   HdfsLocation OptionalInitFn UpdateFn_EDIT MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
+ ;
+
+OptionalInitFn
+ :
+ | 'INIT_FN' '=' FunctionReference
+ ;
+
+OptionalInitFn_EDIT
+ : 'INIT_FN' '=' FunctionReference_EDIT
+ ;
+
+UpdateFn
+ : 'UPDATE_FN' '=' FunctionReference
+ ;
+
+UpdateFn_EDIT
+ : 'UPDATE_FN' '=' FunctionReference_EDIT
+ ;
+
+MergeFn
+ : 'MERGE_FN' '=' FunctionReference
+ ;
+
+MergeFn_EDIT
+ : 'MERGE_FN' '=' FunctionReference_EDIT
+ ;
+
+OptionalPrepareFn
+ :
+ | 'PREPARE_FN' '=' FunctionReference
+ ;
+
+OptionalPrepareFn_EDIT
+ : 'PREPARE_FN' '=' FunctionReference_EDIT
+ ;
+
+OptionalCloseFn
+ :
+ | 'CLOSE_FN' '=' FunctionReference
+ ;
+
+OptionalCloseFn_EDIT
+ : 'CLOSE_FN' '=' FunctionReference_EDIT
+ ;
+
+OptionalSerializeFn
+ :
+ | 'SERIALIZE_FN' '=' FunctionReference
+ ;
+
+OptionalSerializeFn_EDIT
+ : 'SERIALIZE_FN' '=' FunctionReference_EDIT
+ ;
+
+OptionalFinalizeFn
+ :
+ | 'FINALIZE_FN' '=' FunctionReference
+ ;
+
+OptionalFinalizeFn_EDIT
+ : 'FINALIZE_FN' '=' FunctionReference_EDIT
+ ;
+
+OptionalIntermediate
+ :
+ | 'INTERMEDIATE' PrimitiveType
+ ;
+
+Intermediate_EDIT
+ : 'INTERMEDIATE' 'CURSOR'
+   {
+     parser.suggestKeywords(parser.getTypeKeywords());
+   }
+ ;
+
+FunctionReference
+ : SingleQuotedValue
+ ;
+
+FunctionReference_EDIT
+ : SingleQuotedValue_EDIT
+   {
+     parser.suggestFunctions();
+     parser.suggestAggregateFunctions();
+     parser.suggestAnalyticFunctions();
+   }
+ ;

+ 457 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_common.jison

@@ -0,0 +1,457 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+DataDefinition
+ : CreateStatement
+ ;
+
+DataDefinition_EDIT
+ : CreateStatement_EDIT
+ ;
+
+CreateStatement_EDIT
+ : 'CREATE' OptionalExternal 'CURSOR'
+   {
+     if ($2) {
+       parser.suggestKeywords(['TABLE']);
+     } else {
+       parser.suggestKeywords(['AGGREGATE FUNCTION', 'DATABASE', 'EXTERNAL TABLE', 'FUNCTION', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
+     }
+   }
+ ;
+
+OptionalComment
+ :
+ | Comment
+ ;
+
+Comment
+ : 'COMMENT' QuotedValue
+ ;
+
+OptionalComment_INVALID
+ : Comment_INVALID
+ ;
+
+Comment_INVALID
+ : 'COMMENT' SINGLE_QUOTE
+ | 'COMMENT' DOUBLE_QUOTE
+ | 'COMMENT' SINGLE_QUOTE VALUE
+ | 'COMMENT' DOUBLE_QUOTE VALUE
+ ;
+
+ParenthesizedPropertyAssignmentList
+ : '(' PropertyAssignmentList ')'
+ ;
+
+PropertyAssignmentList
+ : PropertyAssignment
+ | PropertyAssignmentList ',' PropertyAssignment
+ ;
+
+PropertyAssignment
+ : QuotedValue '=' UnsignedValueSpecification
+ ;
+
+ParenthesizedColumnSpecificationList
+ : '(' ColumnSpecificationList ')'                              -> $2
+ | '(' ColumnSpecificationList ',' PrimaryKeySpecification ')'  -> $2
+ ;
+
+ParenthesizedColumnSpecificationList_EDIT
+ : '(' ColumnSpecificationList_EDIT RightParenthesisOrError
+ | '(' ColumnSpecificationList ',' PrimaryKeySpecification_EDIT RightParenthesisOrError
+ | '(' ColumnSpecificationList ',' 'CURSOR' RightParenthesisOrError
+   {
+     parser.suggestKeywords(['PRIMARY KEY']);
+   }
+ ;
+
+ColumnSpecificationList
+ : ColumnSpecification                              -> [$1]
+ | ColumnSpecificationList ',' ColumnSpecification  -> $1.concat($3)
+ ;
+
+ColumnSpecificationList_EDIT
+ : ColumnSpecification_EDIT
+ | ColumnSpecification_EDIT ',' ColumnSpecificationList
+ | ColumnSpecificationList ',' ColumnSpecification_EDIT
+ | ColumnSpecificationList ',' ColumnSpecification_EDIT ',' ColumnSpecificationList
+ | ColumnSpecification 'CURSOR'
+   {
+     parser.checkForKeywords($1);
+   }
+ | ColumnSpecification 'CURSOR' ',' ColumnSpecificationList
+   {
+     parser.checkForKeywords($1);
+   }
+ | ColumnSpecificationList ',' ColumnSpecification 'CURSOR'
+   {
+     parser.checkForKeywords($3);
+   }
+ | ColumnSpecificationList ',' ColumnSpecification 'CURSOR' ',' ColumnSpecificationList
+   {
+     parser.checkForKeywords($3);
+   }
+ ;
+
+ColumnSpecification
+ : ColumnIdentifier ColumnDataType OptionalColumnOptions
+   {
+     $$ = $1;
+     $$.type = $2;
+     var keywords = [];
+     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' OptionalColumnOptions
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | 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
+ : PrimaryKey                                        -> 'primary'
+ | 'ENCODING' RegularIdentifier                      -> 'encoding'
+ | 'COMPRESSION' RegularIdentifier                   -> 'compression'
+ | 'DEFAULT' NonParenthesizedValueExpressionPrimary  -> 'default'
+ | 'BLOCK_SIZE' UnsignedNumericLiteral               -> 'block_size'
+ | 'NOT' 'NULL'                                      -> 'null'
+ | 'NULL'                                            -> 'null'
+ | Comment                                           -> 'comment'
+ ;
+
+ColumnOption_EDIT
+ : PrimaryKey_EDIT
+ | 'NOT' 'CURSOR'
+   {
+     parser.suggestKeywords(['NULL']);
+   }
+ ;
+
+ColumnDataType
+ : PrimitiveType
+ | ArrayType
+ | MapType
+ | StructType
+ | ArrayType_INVALID
+ | MapType_INVALID
+ | StructType_INVALID
+ ;
+
+ColumnDataType_EDIT
+ : ArrayType_EDIT
+ | MapType_EDIT
+ | StructType_EDIT
+ ;
+
+ArrayType
+ : 'ARRAY' '<' ColumnDataType '>'
+ ;
+
+ArrayType_INVALID
+ : 'ARRAY' '<' '>'
+ ;
+
+ArrayType_EDIT
+ : 'ARRAY' '<' AnyCursor GreaterThanOrError
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | 'ARRAY' '<' ColumnDataType_EDIT GreaterThanOrError
+ ;
+
+MapType
+ : 'MAP' '<' PrimitiveType ',' ColumnDataType '>'
+ ;
+
+MapType_INVALID
+ : 'MAP' '<' '>'
+ ;
+
+MapType_EDIT
+ : 'MAP' '<' PrimitiveType ',' ColumnDataType_EDIT GreaterThanOrError
+ | 'MAP' '<' AnyCursor GreaterThanOrError
+   {
+     parser.suggestKeywords(parser.getTypeKeywords());
+   }
+ | 'MAP' '<' PrimitiveType ',' AnyCursor GreaterThanOrError
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | 'MAP' '<' ',' AnyCursor GreaterThanOrError
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ ;
+
+StructType
+ : 'STRUCT' '<' StructDefinitionList '>'
+ ;
+
+StructType_INVALID
+ : 'STRUCT' '<' '>'
+ ;
+
+StructType_EDIT
+ : 'STRUCT' '<' StructDefinitionList_EDIT GreaterThanOrError
+ ;
+
+StructDefinitionList
+ : StructDefinition
+ | StructDefinitionList ',' StructDefinition
+ ;
+
+StructDefinitionList_EDIT
+ : StructDefinition_EDIT
+ | StructDefinition_EDIT Commas
+ | StructDefinition_EDIT Commas StructDefinitionList
+ | StructDefinitionList ',' StructDefinition_EDIT
+ | StructDefinitionList ',' StructDefinition_EDIT Commas StructDefinitionList
+ ;
+
+StructDefinition
+ : RegularOrBacktickedIdentifier ':' ColumnDataType OptionalComment
+ ;
+
+StructDefinition_EDIT
+ : Commas RegularOrBacktickedIdentifier ':' ColumnDataType 'CURSOR'
+   {
+     parser.suggestKeywords(['COMMENT']);
+   }
+ | Commas RegularOrBacktickedIdentifier ':' AnyCursor
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | Commas RegularOrBacktickedIdentifier ':' ColumnDataType_EDIT
+ | RegularOrBacktickedIdentifier ':' ColumnDataType 'CURSOR'
+   {
+     parser.suggestKeywords(['COMMENT']);
+   }
+ | RegularOrBacktickedIdentifier ':' AnyCursor
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | RegularOrBacktickedIdentifier ':' ColumnDataType_EDIT
+ ;
+
+ColumnDataTypeList
+ : ColumnDataType
+ | ColumnDataTypeList ',' ColumnDataType
+ ;
+
+ColumnDataTypeList_EDIT
+ : ColumnDataTypeListInner_EDIT
+ | ColumnDataTypeListInner_EDIT Commas
+ | ColumnDataTypeList ',' ColumnDataTypeListInner_EDIT
+ | ColumnDataTypeListInner_EDIT Commas ColumnDataTypeList
+ | ColumnDataTypeList ',' ColumnDataTypeListInner_EDIT Commas ColumnDataTypeList
+ ;
+
+ColumnDataTypeListInner_EDIT
+ : Commas AnyCursor
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | Commas ColumnDataType_EDIT
+ | AnyCursor
+   {
+     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
+   }
+ | ColumnDataType_EDIT
+ ;
+
+GreaterThanOrError
+ : '>'
+ | error
+ ;
+
+PrimaryKeySpecification
+ : PrimaryKey ParenthesizedColumnList
+ ;
+
+PrimaryKeySpecification_EDIT
+ : PrimaryKey_EDIT
+ | PrimaryKey_EDIT ParenthesizedColumnList
+ | PrimaryKey ParenthesizedColumnList_EDIT
+ ;
+
+PrimaryKey
+ : 'PRIMARY' 'KEY'
+ ;
+
+PrimaryKey_EDIT
+ : 'PRIMARY' 'CURSOR'
+   {
+     parser.suggestKeywords(['KEY']);
+   }
+ ;
+
+DelimitedRowFormat
+ : 'DELIMITED' OptionalFieldsTerminatedBy OptionalLinesTerminatedBy
+   {
+     if (!$2 && !$3) {
+       $$ = { suggestKeywords: [{ value: 'FIELDS TERMINATED BY', weight: 2 }, { value: 'LINES TERMINATED BY', weight: 1 }] };
+     } else if ($2 && $2.suggestKeywords && !$3) {
+       $$ = { suggestKeywords: parser.createWeightedKeywords($2.suggestKeywords, 2).concat(['LINES TERMINATED BY']) };
+     } else if (!$3) {
+       $$ = { suggestKeywords: [{ value: 'LINES TERMINATED BY', weight: 1 }] };
+     }
+   }
+ ;
+
+DelimitedRowFormat_EDIT
+ : 'DELIMITED' OptionalFieldsTerminatedBy_EDIT OptionalLinesTerminatedBy
+ | 'DELIMITED' OptionalFieldsTerminatedBy OptionalLinesTerminatedBy_EDIT
+ ;
+
+OptionalFieldsTerminatedBy
+ :
+ | 'FIELDS' 'TERMINATED' 'BY' SingleQuotedValue  -> { suggestKeywords: ['ESCAPED BY'] }
+ | 'FIELDS' 'TERMINATED' 'BY' SingleQuotedValue 'ESCAPED' 'BY' SingleQuotedValue
+ ;
+
+OptionalFieldsTerminatedBy_EDIT
+ : 'FIELDS' 'CURSOR'
+   {
+     parser.suggestKeywords(['TERMINATED BY']);
+   }
+ | 'FIELDS' 'TERMINATED' 'CURSOR'
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ | 'FIELDS' 'TERMINATED' 'BY' SingleQuotedValue 'ESCAPED' 'CURSOR'
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ ;
+
+OptionalLinesTerminatedBy
+ :
+ | 'LINES' 'TERMINATED' 'BY' SingleQuotedValue
+ ;
+
+OptionalLinesTerminatedBy_EDIT
+ : 'LINES' 'CURSOR'
+   {
+     parser.suggestKeywords(['TERMINATED BY']);
+   }
+ | 'LINES' 'TERMINATED' 'CURSOR'
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ ;
+
+TblProperties
+ : 'TBLPROPERTIES' ParenthesizedPropertyAssignmentList
+ ;
+
+ParenthesizedArgumentList
+ : '(' ')'
+ | '(' ArgumentList OptionalVariableArguments')'
+ ;
+
+ParenthesizedArgumentList_EDIT
+ : '(' ArgumentList_EDIT RightParenthesisOrError
+   {
+     parser.suggestKeywords(parser.getTypeKeywords());
+   }
+ | '(' ArgumentList 'CURSOR' RightParenthesisOrError
+   {
+     parser.suggestKeywords(['...']);
+   }
+ ;
+
+ArgumentList
+ : PrimitiveType
+ | ArgumentList ',' PrimitiveType
+ ;
+
+ArgumentList_EDIT
+ : AnyCursor
+ | ArgumentList ',' AnyCursor
+ | AnyCursor ',' ArgumentList
+ | ArgumentList ',' AnyCursor ',' ArgumentList
+ ;
+
+OptionalVariableArguments
+ :
+ | '...'
+ ;
+
+ReturnType
+ : 'RETURNS' PrimitiveType
+ ;
+
+ReturnType_EDIT
+ : 'RETURNS' 'CURSOR'
+   {
+     parser.suggestKeywords(parser.getTypeKeywords());
+   }
+ ;
+

+ 77 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_database.jison

@@ -0,0 +1,77 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CreateStatement
+ : DatabaseDefinition
+ ;
+
+CreateStatement_EDIT
+ : DatabaseDefinition_EDIT
+ ;
+
+DatabaseDefinition
+ : 'CREATE' DatabaseOrSchema OptionalIfNotExists
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals
+   {
+     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
+   }
+ ;
+
+DatabaseDefinition_EDIT
+ : 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR' RegularIdentifier
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+     parser.addNewDatabaseLocation(@5, [{ name: $5 }]);
+   }
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT RegularIdentifier
+   {
+     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
+   }
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals 'CURSOR'
+   {
+     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
+   }
+ ;
+
+DatabaseDefinitionOptionals
+ : OptionalComment OptionalHdfsLocation
+   {
+     var keywords = [];
+     if (!$2) {
+       keywords.push('LOCATION');
+     }
+     if (!$1 && !$2) {
+       keywords.push('COMMENT');
+     }
+     if (keywords.length > 0) {
+       parser.suggestKeywords(keywords);
+     }
+   }
+ ;
+
+DatabaseDefinitionOptionals_EDIT
+ : OptionalComment_INVALID OptionalHdfsLocation
+ | OptionalComment HdfsLocation_EDIT
+ ;

+ 67 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_function.jison

@@ -0,0 +1,67 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CreateStatement
+ : FunctionDefinition
+ ;
+
+CreateStatement_EDIT
+ : FunctionDefinition_EDIT
+ ;
+
+FunctionDefinition
+ : 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation SymbolDefinition
+ ;
+
+FunctionDefinition_EDIT
+ : 'CREATE' 'FUNCTION' OptionalIfNotExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation SymbolDefinition
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList 'CURSOR'
+   {
+     parser.suggestKeywords(['RETURNS']);
+   }
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType 'CURSOR'
+   {
+     parser.suggestKeywords(['LOCATION']);
+   }
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation 'CURSOR'
+   {
+     parser.suggestKeywords(['SYMBOL']);
+   }
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists_EDIT
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation_EDIT
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists_EDIT SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation SymbolDefinition
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT ReturnType HdfsLocation SymbolDefinition
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT HdfsLocation SymbolDefinition
+ | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation_EDIT SymbolDefinition
+ ;
+
+SymbolDefinition
+ : 'SYMBOL' '=' SingleQuotedValue
+ ;

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_role.jison

@@ -0,0 +1,23 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CreateStatement
+ : RoleDefinition
+ ;
+
+RoleDefinition
+ : 'CREATE' 'ROLE' RegularIdentifier
+ ;

+ 443 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_table.jison

@@ -0,0 +1,443 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CreateStatement
+ : TableDefinition
+ ;
+
+CreateStatement_EDIT
+ : TableDefinition_EDIT
+ ;
+
+TableDefinition
+ : 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists TableDefinitionRightPart
+ ;
+
+TableDefinition_EDIT
+ : 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists TableDefinitionRightPart_EDIT
+ | 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists 'CURSOR'
+   {
+     if (!$4) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists_EDIT
+ ;
+
+TableDefinitionRightPart
+ : TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ ;
+
+TableDefinitionRightPart_EDIT
+ : TableIdentifierAndOptionalColumnSpecification_EDIT OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification PartitionedBy_EDIT OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy SortBy_EDIT OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   RowFormat_EDIT OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat WithSerdeproperties_EDIT OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties StoredAs_EDIT
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   HdfsLocation_EDIT OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation CachedIn_EDIT OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation CachedIn WithReplication_EDIT OptionalTblproperties OptionalAsSelectStatement
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement_EDIT
+ | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
+   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
+   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties 'CURSOR'
+   {
+     var keywords = [];
+     if (!$1 && !$2 && !$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
+       keywords.push({ value: 'LIKE', weight: 1 });
+       keywords.push({ value: 'LIKE PARQUET', weight: 1 });
+     } else {
+       if (!$2 && !$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
+         keywords.push({ value: 'PARTITIONED BY', weight: 12 });
+         keywords.push({ value: 'PARTITION BY', weight: 12 });
+       }
+       if (!$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
+         keywords.push({ value: 'SORT BY', weight: 11 });
+       }
+       if (!$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
+         keywords.push({ value: 'COMMENT', weight: 10 });
+       }
+       if (!$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
+         keywords.push({ value: 'ROW FORMAT', weight: 7 });
+       } else if ($5 && $5.suggestKeywords && !$6 && !$7 && !$8 && !$9 && !$10) {
+         keywords = keywords.concat(parser.createWeightedKeywords($5.suggestKeywords, 7));
+       }
+       if (!$6 && !$7 && !$8 && !$9 && !$10) {
+         keywords.push({ value: 'WITH SERDEPROPERTIES', weight: 6 });
+       }
+       if (!$7 && !$8 && !$9 && !$10) {
+         keywords.push({ value: 'STORED AS', weight: 5 });
+       }
+       if (!$8 && !$9 && !$10) {
+         keywords.push({ value: 'LOCATION', weight: 4 });
+       }
+       if (!$9 && !$10) {
+         keywords.push({ value: 'CACHED IN', weight: 3 }, { value: 'UNCACHED', weight: 3 });
+       } else if ($9 && $9.suggestKeywords && !$10) {
+         keywords = keywords.concat(parser.createWeightedKeywords($9.suggestKeywords, 3));
+       }
+       if (!$10) {
+         keywords.push({ value: 'TBLPROPERTIES', weight: 2 });
+       }
+       keywords.push({ value: 'AS', weight: 1 });
+     }
+
+     parser.suggestKeywords(keywords);
+   }
+ ;
+
+TableIdentifierAndOptionalColumnSpecification
+ : SchemaQualifiedIdentifier OptionalColumnSpecificationsOrLike
+   {
+     parser.addNewTableLocation(@1, $1, $2);
+     $$ = $2;
+   }
+ ;
+
+TableIdentifierAndOptionalColumnSpecification_EDIT
+ : SchemaQualifiedIdentifier OptionalColumnSpecificationsOrLike_EDIT
+ | SchemaQualifiedIdentifier_EDIT OptionalColumnSpecificationsOrLike
+ ;
+
+OptionalColumnSpecificationsOrLike
+ :
+ | ParenthesizedColumnSpecificationList
+ | 'LIKE_PARQUET' HdfsPath                  -> []
+ | 'LIKE' SchemaQualifiedTableIdentifier    -> []
+ ;
+
+OptionalColumnSpecificationsOrLike_EDIT
+ : ParenthesizedColumnSpecificationList_EDIT
+ | 'LIKE_PARQUET' HdfsPath_EDIT
+ | 'LIKE' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+     parser.suggestKeywords(['PARQUET']);
+   }
+ | 'LIKE' SchemaQualifiedTableIdentifier_EDIT
+ ;
+
+OptionalPartitionedBy
+ :
+ | PartitionedBy
+ ;
+
+PartitionedBy
+ : 'PARTITIONED' 'BY' ParenthesizedColumnSpecificationList
+ | 'PARTITION' 'BY' HashClauses
+ | 'PARTITION' 'BY' HashClauses ',' RangeClause
+ | 'PARTITION' 'BY' RangeClause
+ | 'PARTITIONED' 'BY' '(' ColumnIdentifierList ')'
+ ;
+
+ColumnIdentifierList
+: ColumnIdentifier ',' ColumnIdentifierList
+| ColumnIdentifier
+;
+
+PartitionedBy_EDIT
+ : 'PARTITIONED' 'CURSOR'
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ | 'PARTITIONED' 'CURSOR' ParenthesizedColumnSpecificationList
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ | 'PARTITIONED' 'BY' ParenthesizedColumnSpecificationList_EDIT
+ | 'PARTITIONED' ParenthesizedColumnSpecificationList_EDIT
+ | 'PARTITION' 'CURSOR'
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ | 'PARTITION' 'BY' 'CURSOR'
+   {
+     parser.suggestKeywords(['HASH', 'RANGE']);
+   }
+ | 'PARTITION' 'BY' HashClauses_EDIT
+ | 'PARTITION' 'BY' RangeClause_EDIT
+ | 'PARTITION' 'BY' HashClauses ',' 'CURSOR'
+   {
+     parser.suggestKeywords(['HASH', 'RANGE']);
+   }
+ | 'PARTITION' 'BY' HashClauses ',' RangeClause_EDIT
+ | 'PARTITION' 'BY' HashClauses_EDIT ',' RangeClause
+ ;
+
+HashClauses
+ : HashClause
+ | HashClauses ',' HashClause
+ ;
+
+HashClauses_EDIT
+ : HashClause_EDIT
+ | HashClauses ',' HashClause_EDIT
+ | HashClauses ',' HashClause_EDIT ',' HashClauses
+ ;
+
+HashClause
+ : 'HASH' OptionalParenthesizedColumnList 'PARTITIONS' UnsignedNumericLiteral
+ ;
+
+HashClause_EDIT
+ : 'HASH' OptionalParenthesizedColumnList 'CURSOR'
+   {
+     parser.suggestKeywords(['PARTITIONS']);
+   }
+ | 'HASH' ParenthesizedColumnList_EDIT
+ | 'HASH' OptionalParenthesizedColumnList 'PARTITIONS' 'CURSOR'
+ | 'HASH' ParenthesizedColumnList_EDIT 'PARTITIONS' UnsignedNumericLiteral
+ ;
+
+RangeClause
+ : 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList
+ ;
+
+RangeClause_EDIT
+ : 'RANGE' 'CURSOR'
+ | 'RANGE' ParenthesizedColumnList_EDIT
+ | 'RANGE' ParenthesizedColumnList 'CURSOR'
+ | 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList_EDIT
+ | 'RANGE' ParenthesizedColumnList_EDIT ParenthesizedPartitionValuesList
+ ;
+
+OptionalSortBy
+ :
+ | SortBy
+ ;
+
+SortBy
+ : 'SORT' 'BY' ParenthesizedColumnList
+ ;
+
+SortBy_EDIT
+ : 'SORT' 'CURSOR'
+   {
+     parser.suggestKeywords(['BY']);
+   }
+ | 'SORT' 'BY' ParenthesizedColumnList_EDIT
+ ;
+
+ParenthesizedPartitionValuesList
+ : '(' PartitionValueList ')'
+ ;
+
+ParenthesizedPartitionValuesList_EDIT
+ : '(' 'CURSOR' RightParenthesisOrError
+   {
+     parser.suggestKeywords(['PARTITION']);
+   }
+ |'(' PartitionValueList_EDIT RightParenthesisOrError
+ ;
+
+PartitionValueList
+ : PartitionValue
+ | PartitionValueList ',' PartitionValue
+ ;
+
+PartitionValueList_EDIT
+ : PartitionValue_EDIT
+ | PartitionValueList ',' 'CURSOR'
+   {
+     parser.suggestKeywords(['PARTITION']);
+   }
+ | PartitionValueList ',' 'CURSOR' ',' PartitionValueList
+   {
+     parser.suggestKeywords(['PARTITION']);
+   }
+ | PartitionValueList ',' PartitionValue_EDIT
+ | PartitionValueList ',' PartitionValue_EDIT ',' PartitionValueList
+ ;
+
+PartitionValue
+ : 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression
+ | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES'
+ | 'PARTITION_VALUE' '=' ValueExpression
+ ;
+
+PartitionValue_EDIT
+ : 'PARTITION' 'CURSOR'
+   {
+     parser.suggestKeywords(['VALUE', 'VALUES']);
+   }
+ | 'PARTITION_VALUE' 'CURSOR'
+   {
+     parser.suggestKeywords(['=']);
+   }
+ | 'PARTITION_VALUE' '=' 'CURSOR'
+   {
+     parser.suggestFunctions();
+   }
+ | 'PARTITION' ValueExpression_EDIT
+   {
+     if ($2.endsWithLessThanOrEqual) {
+      parser.suggestKeywords(['VALUES']);
+     }
+   }
+ | 'PARTITION' ValueExpression 'CURSOR'
+   {
+     parser.suggestKeywords(['<', '<=']);
+   }
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'CURSOR'
+   {
+     parser.suggestKeywords(['VALUES']);
+   }
+ | 'PARTITION' ValueExpression_EDIT LessThanOrEqualTo 'VALUES'
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' 'CURSOR'
+   {
+     parser.suggestKeywords(['<', '<=']);
+   }
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo 'CURSOR'
+   {
+     parser.suggestFunctions();
+   }
+ | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
+ | 'PARTITION' 'VALUES' 'CURSOR'
+   {
+     parser.suggestKeywords(['<', '<=']);
+   }
+ | 'PARTITION' 'VALUES' LessThanOrEqualTo 'CURSOR'
+   {
+     parser.suggestFunctions();
+   }
+ | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
+ ;
+
+LessThanOrEqualTo
+ : '<'
+ | 'COMPARISON_OPERATOR' // This is fine for autocompletion
+ ;
+
+OptionalRowFormat
+ :
+ | RowFormat
+ ;
+
+RowFormat
+ : 'ROW' 'FORMAT' DelimitedRowFormat  -> $3
+ ;
+
+RowFormat_EDIT
+ : 'ROW' 'CURSOR'
+   {
+     parser.suggestKeywords(['FORMAT']);
+   }
+ | 'ROW' 'FORMAT' 'CURSOR'
+   {
+     parser.suggestKeywords(['DELIMITED']);
+   }
+ | 'ROW' 'FORMAT' DelimitedRowFormat_EDIT
+ ;
+
+OptionalStoredAs
+ :
+ | StoredAs
+ ;
+
+StoredAs
+ : 'STORED' 'AS' FileFormat
+ ;
+
+StoredAs_EDIT
+ : 'STORED' 'CURSOR'
+   {
+     parser.suggestKeywords(['AS']);
+   }
+ | 'STORED' 'AS' 'CURSOR'
+   {
+     parser.suggestFileFormats();
+   }
+ ;
+
+FileFormat
+ : 'AVRO'
+ | 'KUDU'
+ | 'ORC'
+ | 'PARQUET'
+ | 'RCFILE'
+ | 'SEQUENCEFILE'
+ | 'TEXTFILE'
+ ;
+
+OptionalWithSerdeproperties
+ :
+ | WithSerdeproperties
+ ;
+
+WithSerdeproperties
+ : 'WITH' 'SERDEPROPERTIES' ParenthesizedPropertyAssignmentList
+ ;
+
+WithSerdeproperties_EDIT
+ : 'WITH' 'CURSOR'
+   {
+     parser.suggestKeywords(['SERDEPROPERTIES']);
+   }
+ | 'WITH' 'CURSOR' ParenthesizedPropertyAssignmentList
+   {
+     parser.suggestKeywords(['SERDEPROPERTIES']);
+   }
+ ;
+
+OptionalTblproperties
+ :
+ | TblProperties
+ ;
+
+OptionalAsSelectStatement
+ :
+ | 'AS' CommitLocations QuerySpecification
+ ;
+
+OptionalAsSelectStatement_EDIT
+ : 'AS' CommitLocations 'CURSOR'
+   {
+     parser.suggestKeywords(['SELECT']);
+   }
+ | 'AS' CommitLocations QuerySpecification_EDIT
+ ;
+
+CommitLocations
+ : /* empty */
+   {
+     parser.commitLocations();
+   }
+ ;

+ 89 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/create/create_view.jison

@@ -0,0 +1,89 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+CreateStatement
+ : ViewDefinition
+ ;
+
+CreateStatement_EDIT
+ : ViewDefinition_EDIT
+ ;
+
+ViewDefinition
+ : 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
+ ;
+
+ViewDefinition_EDIT
+ : 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists_EDIT
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedViewColumnList_EDIT OptionalComment
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'CURSOR'
+   {
+     var keywords = [{value: 'AS', weight: 1 }];
+     if (!$6) {
+       keywords.push({ value: 'COMMENT', weight: 3 });
+     }
+     parser.suggestKeywords(keywords);
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' 'CURSOR'
+   {
+     parser.suggestKeywords(['SELECT']);
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification_EDIT
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier_EDIT OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
+ ;
+
+OptionalParenthesizedViewColumnList
+ :
+ | ParenthesizedViewColumnList
+ ;
+
+ParenthesizedViewColumnList
+ : '(' ViewColumnList ')'
+ ;
+
+ParenthesizedViewColumnList_EDIT
+ : '(' ViewColumnList_EDIT RightParenthesisOrError
+   {
+     if (!$2) {
+       parser.suggestKeywords(['COMMENT']);
+     }
+   }
+ ;
+
+ViewColumnList
+ : ColumnReference OptionalComment
+ | ViewColumnList ',' ColumnReference OptionalComment
+ ;
+
+ViewColumnList_EDIT
+ : ColumnReference OptionalComment 'CURSOR'                                        -> $2
+ | ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList                     -> $2
+ | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR'                     -> $4
+ | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList  -> $4
+ ;

+ 49 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/invalidate/invalidate_metadata.jison

@@ -0,0 +1,49 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+DataDefinition
+ : InvalidateStatement
+ ;
+
+DataDefinition_EDIT
+ : InvalidateStatement_EDIT
+ ;
+
+InvalidateStatement
+ : 'INVALIDATE' 'METADATA'
+ | 'INVALIDATE' 'METADATA' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+InvalidateStatement_EDIT
+ : 'INVALIDATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['METADATA']);
+   }
+ | 'INVALIDATE' 'METADATA' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'INVALIDATE' 'METADATA' SchemaQualifiedTableIdentifier_EDIT
+ | 'INVALIDATE' 'CURSOR' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($3);
+     parser.suggestKeywords(['METADATA']);
+   }
+ ;

+ 57 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/refresh/refresh.jison

@@ -0,0 +1,57 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+DataDefinition
+ : RefreshStatement
+ ;
+
+DataDefinition_EDIT
+ : RefreshStatement_EDIT
+ ;
+
+RefreshStatement
+ : 'REFRESH' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+   {
+     parser.addTablePrimary($2);
+   }
+ | 'REFRESH' 'FUNCTIONS' DatabaseIdentifier
+   {
+     parser.addDatabaseLocation(@3, [{ name: $3 }]);
+   }
+ | 'REFRESH' 'AUTHORIZATION'
+ ;
+
+RefreshStatement_EDIT
+ : 'REFRESH' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+     parser.suggestKeywords(['AUTHORIZATION', 'FUNCTIONS']);
+   }
+ | 'REFRESH' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | 'REFRESH' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+   {
+     parser.addTablePrimary($2);
+     if (!$3) {
+       parser.suggestKeywords(['PARTITION']);
+     }
+   }
+ | 'REFRESH' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
+ | 'REFRESH' 'FUNCTIONS' 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ ;

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

@@ -1,1287 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-DataDefinition
- : CreateStatement
- ;
-
-DataDefinition_EDIT
- : CreateStatement_EDIT
- ;
-
-CreateStatement
- : DatabaseDefinition
- | TableDefinition
- | ViewDefinition
- | RoleDefinition
- | FunctionDefinition
- ;
-
-CreateStatement_EDIT
- : DatabaseDefinition_EDIT
- | TableDefinition_EDIT
- | ViewDefinition_EDIT
- | FunctionDefinition_EDIT
- | 'CREATE' OptionalExternal 'CURSOR'
-   {
-     if ($2) {
-       parser.suggestKeywords(['TABLE']);
-     } else {
-       parser.suggestKeywords(['AGGREGATE FUNCTION', 'DATABASE', 'EXTERNAL TABLE', 'FUNCTION', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
-     }
-   }
- ;
-
-DatabaseDefinition
- : 'CREATE' DatabaseOrSchema OptionalIfNotExists
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals
-   {
-     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
-   }
- ;
-
-DatabaseDefinition_EDIT
- : 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR' RegularIdentifier
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.addNewDatabaseLocation(@5, [{ name: $5 }]);
-   }
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT RegularIdentifier
-   {
-     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
-   }
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals 'CURSOR'
-   {
-     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
-   }
- ;
-
-DatabaseDefinitionOptionals
- : OptionalComment OptionalHdfsLocation
-   {
-     var keywords = [];
-     if (!$2) {
-       keywords.push('LOCATION');
-     }
-     if (!$1 && !$2) {
-       keywords.push('COMMENT');
-     }
-     if (keywords.length > 0) {
-       parser.suggestKeywords(keywords);
-     }
-   }
- ;
-
-DatabaseDefinitionOptionals_EDIT
- : OptionalComment_INVALID OptionalHdfsLocation
- | OptionalComment HdfsLocation_EDIT
- ;
-
-OptionalComment
- :
- | Comment
- ;
-
-Comment
- : 'COMMENT' QuotedValue
- ;
-
-OptionalComment_INVALID
- : Comment_INVALID
- ;
-
-Comment_INVALID
- : 'COMMENT' SINGLE_QUOTE
- | 'COMMENT' DOUBLE_QUOTE
- | 'COMMENT' SINGLE_QUOTE VALUE
- | 'COMMENT' DOUBLE_QUOTE VALUE
- ;
-
-ParenthesizedPropertyAssignmentList
- : '(' PropertyAssignmentList ')'
- ;
-
-PropertyAssignmentList
- : PropertyAssignment
- | PropertyAssignmentList ',' PropertyAssignment
- ;
-
-PropertyAssignment
- : QuotedValue '=' UnsignedValueSpecification
- ;
-
-TableDefinition
- : 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists TableDefinitionRightPart
- ;
-
-TableDefinition_EDIT
- : 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists TableDefinitionRightPart_EDIT
- | 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' OptionalExternal 'TABLE' OptionalIfNotExists_EDIT
- ;
-
-TableDefinitionRightPart
- : TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- ;
-
-TableDefinitionRightPart_EDIT
- : TableIdentifierAndOptionalColumnSpecification_EDIT OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification PartitionedBy_EDIT OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy SortBy_EDIT OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   RowFormat_EDIT OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat WithSerdeproperties_EDIT OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties StoredAs_EDIT
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   HdfsLocation_EDIT OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation CachedIn_EDIT OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation CachedIn WithReplication_EDIT OptionalTblproperties OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties OptionalAsSelectStatement_EDIT
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalSortBy OptionalComment
-   OptionalRowFormat OptionalWithSerdeproperties OptionalStoredAs
-   OptionalHdfsLocation OptionalCachedInOrUncached OptionalTblproperties 'CURSOR'
-   {
-     var keywords = [];
-     if (!$1 && !$2 && !$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
-       keywords.push({ value: 'LIKE', weight: 1 });
-       keywords.push({ value: 'LIKE PARQUET', weight: 1 });
-     } else {
-       if (!$2 && !$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
-         keywords.push({ value: 'PARTITIONED BY', weight: 12 });
-         keywords.push({ value: 'PARTITION BY', weight: 12 });
-       }
-       if (!$3 && !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
-         keywords.push({ value: 'SORT BY', weight: 11 });
-       }
-       if (!$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
-         keywords.push({ value: 'COMMENT', weight: 10 });
-       }
-       if (!$5 && !$6 && !$7 && !$8 && !$9 && !$10) {
-         keywords.push({ value: 'ROW FORMAT', weight: 7 });
-       } else if ($5 && $5.suggestKeywords && !$6 && !$7 && !$8 && !$9 && !$10) {
-         keywords = keywords.concat(parser.createWeightedKeywords($5.suggestKeywords, 7));
-       }
-       if (!$6 && !$7 && !$8 && !$9 && !$10) {
-         keywords.push({ value: 'WITH SERDEPROPERTIES', weight: 6 });
-       }
-       if (!$7 && !$8 && !$9 && !$10) {
-         keywords.push({ value: 'STORED AS', weight: 5 });
-       }
-       if (!$8 && !$9 && !$10) {
-         keywords.push({ value: 'LOCATION', weight: 4 });
-       }
-       if (!$9 && !$10) {
-         keywords.push({ value: 'CACHED IN', weight: 3 }, { value: 'UNCACHED', weight: 3 });
-       } else if ($9 && $9.suggestKeywords && !$10) {
-         keywords = keywords.concat(parser.createWeightedKeywords($9.suggestKeywords, 3));
-       }
-       if (!$10) {
-         keywords.push({ value: 'TBLPROPERTIES', weight: 2 });
-       }
-       keywords.push({ value: 'AS', weight: 1 });
-     }
-
-     parser.suggestKeywords(keywords);
-   }
- ;
-
-TableIdentifierAndOptionalColumnSpecification
- : SchemaQualifiedIdentifier OptionalColumnSpecificationsOrLike
-   {
-     parser.addNewTableLocation(@1, $1, $2);
-     $$ = $2;
-   }
- ;
-
-TableIdentifierAndOptionalColumnSpecification_EDIT
- : SchemaQualifiedIdentifier OptionalColumnSpecificationsOrLike_EDIT
- | SchemaQualifiedIdentifier_EDIT OptionalColumnSpecificationsOrLike
- ;
-
-OptionalColumnSpecificationsOrLike
- :
- | ParenthesizedColumnSpecificationList
- | 'LIKE_PARQUET' HdfsPath                  -> []
- | 'LIKE' SchemaQualifiedTableIdentifier    -> []
- ;
-
-OptionalColumnSpecificationsOrLike_EDIT
- : ParenthesizedColumnSpecificationList_EDIT
- | 'LIKE_PARQUET' HdfsPath_EDIT
- | 'LIKE' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-     parser.suggestKeywords(['PARQUET']);
-   }
- | 'LIKE' SchemaQualifiedTableIdentifier_EDIT
- ;
-
-ParenthesizedColumnSpecificationList
- : '(' ColumnSpecificationList ')'                              -> $2
- | '(' ColumnSpecificationList ',' PrimaryKeySpecification ')'  -> $2
- ;
-
-ParenthesizedColumnSpecificationList_EDIT
- : '(' ColumnSpecificationList_EDIT RightParenthesisOrError
- | '(' ColumnSpecificationList ',' PrimaryKeySpecification_EDIT RightParenthesisOrError
- | '(' ColumnSpecificationList ',' 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestKeywords(['PRIMARY KEY']);
-   }
- ;
-
-ColumnSpecificationList
- : ColumnSpecification                              -> [$1]
- | ColumnSpecificationList ',' ColumnSpecification  -> $1.concat($3)
- ;
-
-ColumnSpecificationList_EDIT
- : ColumnSpecification_EDIT
- | ColumnSpecification_EDIT ',' ColumnSpecificationList
- | ColumnSpecificationList ',' ColumnSpecification_EDIT
- | ColumnSpecificationList ',' ColumnSpecification_EDIT ',' ColumnSpecificationList
- | ColumnSpecification 'CURSOR'
-   {
-     parser.checkForKeywords($1);
-   }
- | ColumnSpecification 'CURSOR' ',' ColumnSpecificationList
-   {
-     parser.checkForKeywords($1);
-   }
- | ColumnSpecificationList ',' ColumnSpecification 'CURSOR'
-   {
-     parser.checkForKeywords($3);
-   }
- | ColumnSpecificationList ',' ColumnSpecification 'CURSOR' ',' ColumnSpecificationList
-   {
-     parser.checkForKeywords($3);
-   }
- ;
-
-ColumnSpecification
- : ColumnIdentifier ColumnDataType OptionalColumnOptions
-   {
-     $$ = $1;
-     $$.type = $2;
-     var keywords = [];
-     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' OptionalColumnOptions
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | 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
- : PrimaryKey                                        -> 'primary'
- | 'ENCODING' RegularIdentifier                      -> 'encoding'
- | 'COMPRESSION' RegularIdentifier                   -> 'compression'
- | 'DEFAULT' NonParenthesizedValueExpressionPrimary  -> 'default'
- | 'BLOCK_SIZE' UnsignedNumericLiteral               -> 'block_size'
- | 'NOT' 'NULL'                                      -> 'null'
- | 'NULL'                                            -> 'null'
- | Comment                                           -> 'comment'
- ;
-
-ColumnOption_EDIT
- : PrimaryKey_EDIT
- | 'NOT' 'CURSOR'
-   {
-     parser.suggestKeywords(['NULL']);
-   }
- ;
-
-ColumnDataType
- : PrimitiveType
- | ArrayType
- | MapType
- | StructType
- | ArrayType_INVALID
- | MapType_INVALID
- | StructType_INVALID
- ;
-
-ColumnDataType_EDIT
- : ArrayType_EDIT
- | MapType_EDIT
- | StructType_EDIT
- ;
-
-ArrayType
- : 'ARRAY' '<' ColumnDataType '>'
- ;
-
-ArrayType_INVALID
- : 'ARRAY' '<' '>'
- ;
-
-ArrayType_EDIT
- : 'ARRAY' '<' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | 'ARRAY' '<' ColumnDataType_EDIT GreaterThanOrError
- ;
-
-MapType
- : 'MAP' '<' PrimitiveType ',' ColumnDataType '>'
- ;
-
-MapType_INVALID
- : 'MAP' '<' '>'
- ;
-
-MapType_EDIT
- : 'MAP' '<' PrimitiveType ',' ColumnDataType_EDIT GreaterThanOrError
- | 'MAP' '<' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-   }
- | 'MAP' '<' PrimitiveType ',' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | 'MAP' '<' ',' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- ;
-
-StructType
- : 'STRUCT' '<' StructDefinitionList '>'
- ;
-
-StructType_INVALID
- : 'STRUCT' '<' '>'
- ;
-
-StructType_EDIT
- : 'STRUCT' '<' StructDefinitionList_EDIT GreaterThanOrError
- ;
-
-StructDefinitionList
- : StructDefinition
- | StructDefinitionList ',' StructDefinition
- ;
-
-StructDefinitionList_EDIT
- : StructDefinition_EDIT
- | StructDefinition_EDIT Commas
- | StructDefinition_EDIT Commas StructDefinitionList
- | StructDefinitionList ',' StructDefinition_EDIT
- | StructDefinitionList ',' StructDefinition_EDIT Commas StructDefinitionList
- ;
-
-StructDefinition
- : RegularOrBacktickedIdentifier ':' ColumnDataType OptionalComment
- ;
-
-StructDefinition_EDIT
- : Commas RegularOrBacktickedIdentifier ':' ColumnDataType 'CURSOR'
-   {
-     parser.suggestKeywords(['COMMENT']);
-   }
- | Commas RegularOrBacktickedIdentifier ':' AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | Commas RegularOrBacktickedIdentifier ':' ColumnDataType_EDIT
- | RegularOrBacktickedIdentifier ':' ColumnDataType 'CURSOR'
-   {
-     parser.suggestKeywords(['COMMENT']);
-   }
- | RegularOrBacktickedIdentifier ':' AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | RegularOrBacktickedIdentifier ':' ColumnDataType_EDIT
- ;
-
-ColumnDataTypeList
- : ColumnDataType
- | ColumnDataTypeList ',' ColumnDataType
- ;
-
-ColumnDataTypeList_EDIT
- : ColumnDataTypeListInner_EDIT
- | ColumnDataTypeListInner_EDIT Commas
- | ColumnDataTypeList ',' ColumnDataTypeListInner_EDIT
- | ColumnDataTypeListInner_EDIT Commas ColumnDataTypeList
- | ColumnDataTypeList ',' ColumnDataTypeListInner_EDIT Commas ColumnDataTypeList
- ;
-
-ColumnDataTypeListInner_EDIT
- : Commas AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | Commas ColumnDataType_EDIT
- | AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | ColumnDataType_EDIT
- ;
-
-GreaterThanOrError
- : '>'
- | error
- ;
-
-PrimaryKeySpecification
- : PrimaryKey ParenthesizedColumnList
- ;
-
-PrimaryKeySpecification_EDIT
- : PrimaryKey_EDIT
- | PrimaryKey_EDIT ParenthesizedColumnList
- | PrimaryKey ParenthesizedColumnList_EDIT
- ;
-
-PrimaryKey
- : 'PRIMARY' 'KEY'
- ;
-
-PrimaryKey_EDIT
- : 'PRIMARY' 'CURSOR'
-   {
-     parser.suggestKeywords(['KEY']);
-   }
- ;
-
-OptionalPartitionedBy
- :
- | PartitionedBy
- ;
-
-PartitionedBy
- : 'PARTITIONED' 'BY' ParenthesizedColumnSpecificationList
- | 'PARTITION' 'BY' HashClauses
- | 'PARTITION' 'BY' HashClauses ',' RangeClause
- | 'PARTITION' 'BY' RangeClause
- | 'PARTITIONED' 'BY' '(' ColumnIdentifierList ')'
- ;
- 
- ColumnIdentifierList
-: ColumnIdentifier ',' ColumnIdentifierList
-| ColumnIdentifier
-;
-
-PartitionedBy_EDIT
- : 'PARTITIONED' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'PARTITIONED' 'CURSOR' ParenthesizedColumnSpecificationList
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'PARTITIONED' 'BY' ParenthesizedColumnSpecificationList_EDIT
- | 'PARTITIONED' ParenthesizedColumnSpecificationList_EDIT
- | 'PARTITION' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'PARTITION' 'BY' 'CURSOR'
-   {
-     parser.suggestKeywords(['HASH', 'RANGE']);
-   }
- | 'PARTITION' 'BY' HashClauses_EDIT
- | 'PARTITION' 'BY' RangeClause_EDIT
- | 'PARTITION' 'BY' HashClauses ',' 'CURSOR'
-   {
-     parser.suggestKeywords(['HASH', 'RANGE']);
-   }
- | 'PARTITION' 'BY' HashClauses ',' RangeClause_EDIT
- | 'PARTITION' 'BY' HashClauses_EDIT ',' RangeClause
- ;
-
-HashClauses
- : HashClause
- | HashClauses ',' HashClause
- ;
-
-HashClauses_EDIT
- : HashClause_EDIT
- | HashClauses ',' HashClause_EDIT
- | HashClauses ',' HashClause_EDIT ',' HashClauses
- ;
-
-HashClause
- : 'HASH' OptionalParenthesizedColumnList 'PARTITIONS' UnsignedNumericLiteral
- ;
-
-HashClause_EDIT
- : 'HASH' OptionalParenthesizedColumnList 'CURSOR'
-   {
-     parser.suggestKeywords(['PARTITIONS']);
-   }
- | 'HASH' ParenthesizedColumnList_EDIT
- | 'HASH' OptionalParenthesizedColumnList 'PARTITIONS' 'CURSOR'
- | 'HASH' ParenthesizedColumnList_EDIT 'PARTITIONS' UnsignedNumericLiteral
- ;
-
-RangeClause
- : 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList
- ;
-
-RangeClause_EDIT
- : 'RANGE' 'CURSOR'
- | 'RANGE' ParenthesizedColumnList_EDIT
- | 'RANGE' ParenthesizedColumnList 'CURSOR'
- | 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList_EDIT
- | 'RANGE' ParenthesizedColumnList_EDIT ParenthesizedPartitionValuesList
- ;
-
-OptionalSortBy
- :
- | SortBy
- ;
-
-SortBy
- : 'SORT' 'BY' ParenthesizedColumnList
- ;
-
-SortBy_EDIT
- : 'SORT' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'SORT' 'BY' ParenthesizedColumnList_EDIT
- ;
-
-ParenthesizedPartitionValuesList
- : '(' PartitionValueList ')'
- ;
-
-ParenthesizedPartitionValuesList_EDIT
- : '(' 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- |'(' PartitionValueList_EDIT RightParenthesisOrError
- ;
-
-PartitionValueList
- : PartitionValue
- | PartitionValueList ',' PartitionValue
- ;
-
-PartitionValueList_EDIT
- : PartitionValue_EDIT
- | PartitionValueList ',' 'CURSOR'
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- | PartitionValueList ',' 'CURSOR' ',' PartitionValueList
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- | PartitionValueList ',' PartitionValue_EDIT
- | PartitionValueList ',' PartitionValue_EDIT ',' PartitionValueList
- ;
-
-PartitionValue
- : 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression
- | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES'
- | 'PARTITION_VALUE' '=' ValueExpression
- ;
-
-PartitionValue_EDIT
- : 'PARTITION' 'CURSOR'
-   {
-     parser.suggestKeywords(['VALUE', 'VALUES']);
-   }
- | 'PARTITION_VALUE' 'CURSOR'
-   {
-     parser.suggestKeywords(['=']);
-   }
- | 'PARTITION_VALUE' '=' 'CURSOR'
-   {
-     parser.suggestFunctions();
-   }
- | 'PARTITION' ValueExpression_EDIT
-   {
-     if ($2.endsWithLessThanOrEqual) {
-      parser.suggestKeywords(['VALUES']);
-     }
-   }
- | 'PARTITION' ValueExpression 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=']);
-   }
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'CURSOR'
-   {
-     parser.suggestKeywords(['VALUES']);
-   }
- | 'PARTITION' ValueExpression_EDIT LessThanOrEqualTo 'VALUES'
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=']);
-   }
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo 'CURSOR'
-   {
-     parser.suggestFunctions();
-   }
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
- | 'PARTITION' 'VALUES' 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=']);
-   }
- | 'PARTITION' 'VALUES' LessThanOrEqualTo 'CURSOR'
-   {
-     parser.suggestFunctions();
-   }
- | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
- ;
-
-LessThanOrEqualTo
- : '<'
- | 'COMPARISON_OPERATOR' // This is fine for autocompletion
- ;
-
-ParenthesizedSortList
- : '(' SortList ')'
- ;
-
-ParenthesizedSortList_EDIT
- : '(' SortList_EDIT RightParenthesisOrError
- ;
-
-SortList
- : SortIdentifier
- | SortList ',' SortIdentifier
- ;
-
-SortList_EDIT
- : SortIdentifier_EDIT
- | SortIdentifier_EDIT ',' SortList
- | SortList ',' SortIdentifier_EDIT
- | SortList ',' SortIdentifier_EDIT ',' SortList
- ;
-
-SortIdentifier
- : ColumnIdentifier OptionalAscOrDesc
- ;
-
-SortIdentifier_EDIT
- : ColumnIdentifier OptionalAscOrDesc 'CURSOR'
-   {
-     parser.checkForKeywords($2);
-   }
- | ColumnIdentifier_EDIT OptionalAscOrDesc
- | AnyCursor OptionalAscOrDesc
-   {
-     parser.suggestColumns();
-   }
- ;
-
-OptionalRowFormat
- :
- | RowFormat
- ;
-
-RowFormat
- : 'ROW' 'FORMAT' DelimitedRowFormat  -> $3
- ;
-
-RowFormat_EDIT
- : 'ROW' 'CURSOR'
-   {
-     parser.suggestKeywords(['FORMAT']);
-   }
- | 'ROW' 'FORMAT' 'CURSOR'
-   {
-     parser.suggestKeywords(['DELIMITED']);
-   }
- | 'ROW' 'FORMAT' DelimitedRowFormat_EDIT
- ;
-
-OptionalStoredAs
- :
- | StoredAs
- ;
-
-StoredAs
- : 'STORED' 'AS' FileFormat
- ;
-
-StoredAs_EDIT
- : 'STORED' 'CURSOR'
-   {
-     parser.suggestKeywords(['AS']);
-   }
- | 'STORED' 'AS' 'CURSOR'
-   {
-     parser.suggestFileFormats();
-   }
- ;
-
-FileFormat
- : 'AVRO'
- | 'KUDU'
- | 'ORC'
- | 'PARQUET'
- | 'RCFILE'
- | 'SEQUENCEFILE'
- | 'TEXTFILE'
- ;
-
-DelimitedRowFormat
- : 'DELIMITED' OptionalFieldsTerminatedBy OptionalLinesTerminatedBy
-   {
-     if (!$2 && !$3) {
-       $$ = { suggestKeywords: [{ value: 'FIELDS TERMINATED BY', weight: 2 }, { value: 'LINES TERMINATED BY', weight: 1 }] };
-     } else if ($2 && $2.suggestKeywords && !$3) {
-       $$ = { suggestKeywords: parser.createWeightedKeywords($2.suggestKeywords, 2).concat(['LINES TERMINATED BY']) };
-     } else if (!$3) {
-       $$ = { suggestKeywords: [{ value: 'LINES TERMINATED BY', weight: 1 }] };
-     }
-   }
- ;
-
-DelimitedRowFormat_EDIT
- : 'DELIMITED' OptionalFieldsTerminatedBy_EDIT OptionalLinesTerminatedBy
- | 'DELIMITED' OptionalFieldsTerminatedBy OptionalLinesTerminatedBy_EDIT
- ;
-
-OptionalFieldsTerminatedBy
- :
- | 'FIELDS' 'TERMINATED' 'BY' SingleQuotedValue  -> { suggestKeywords: ['ESCAPED BY'] }
- | 'FIELDS' 'TERMINATED' 'BY' SingleQuotedValue 'ESCAPED' 'BY' SingleQuotedValue
- ;
-
-OptionalFieldsTerminatedBy_EDIT
- : 'FIELDS' 'CURSOR'
-   {
-     parser.suggestKeywords(['TERMINATED BY']);
-   }
- | 'FIELDS' 'TERMINATED' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'FIELDS' 'TERMINATED' 'BY' SingleQuotedValue 'ESCAPED' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- ;
-
-OptionalLinesTerminatedBy
- :
- | 'LINES' 'TERMINATED' 'BY' SingleQuotedValue
- ;
-
-OptionalLinesTerminatedBy_EDIT
- : 'LINES' 'CURSOR'
-   {
-     parser.suggestKeywords(['TERMINATED BY']);
-   }
- | 'LINES' 'TERMINATED' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- ;
-
-OptionalWithSerdeproperties
- :
- | WithSerdeproperties
- ;
-
-WithSerdeproperties
- : 'WITH' 'SERDEPROPERTIES' ParenthesizedPropertyAssignmentList
- ;
-
-WithSerdeproperties_EDIT
- : 'WITH' 'CURSOR'
-   {
-     parser.suggestKeywords(['SERDEPROPERTIES']);
-   }
- | 'WITH' 'CURSOR' ParenthesizedPropertyAssignmentList
-   {
-     parser.suggestKeywords(['SERDEPROPERTIES']);
-   }
- ;
-
-OptionalTblproperties
- :
- | TblProperties
- ;
-
-TblProperties
- : 'TBLPROPERTIES' ParenthesizedPropertyAssignmentList
- ;
-
-OptionalAsSelectStatement
- :
- | 'AS' CommitLocations QuerySpecification
- ;
-
-OptionalAsSelectStatement_EDIT
- : 'AS' CommitLocations 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | 'AS' CommitLocations QuerySpecification_EDIT
- ;
-
-CommitLocations
- : /* empty */
-   {
-     parser.commitLocations();
-   }
- ;
-
-ViewDefinition
- : 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
- ;
-
-ViewDefinition_EDIT
- : 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists_EDIT
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedViewColumnList_EDIT OptionalComment
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'CURSOR'
-   {
-     var keywords = [{value: 'AS', weight: 1 }];
-     if (!$6) {
-       keywords.push({ value: 'COMMENT', weight: 3 });
-     }
-     parser.suggestKeywords(keywords);
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification_EDIT
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier_EDIT OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
- ;
-
-FunctionDefinition
- : GenericFunctionDefinition
- | AggregateFunctionDefinition
- ;
-
-FunctionDefinition_EDIT
- : GenericFunctionDefinition_EDIT
- | AggregateFunctionDefinition_EDIT
- ;
-
-GenericFunctionDefinition
- : 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation SymbolDefinition
- ;
-
-GenericFunctionDefinition_EDIT
- : 'CREATE' 'FUNCTION' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'CREATE' 'FUNCTION' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation SymbolDefinition
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList 'CURSOR'
-   {
-     parser.suggestKeywords(['RETURNS']);
-   }
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType 'CURSOR'
-   {
-     parser.suggestKeywords(['LOCATION']);
-   }
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation 'CURSOR'
-   {
-     parser.suggestKeywords(['SYMBOL']);
-   }
- | 'CREATE' 'FUNCTION' OptionalIfNotExists_EDIT
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation_EDIT
- | 'CREATE' 'FUNCTION' OptionalIfNotExists_EDIT SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation SymbolDefinition
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT ReturnType HdfsLocation SymbolDefinition
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT HdfsLocation SymbolDefinition
- | 'CREATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType HdfsLocation_EDIT SymbolDefinition
- ;
-
-AggregateFunctionDefinition
- : 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- ;
-
-AggregateFunctionDefinition_EDIT
- : 'CREATE' 'AGGREGATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['FUNCTION']);
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists_EDIT
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists_EDIT SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList_EDIT ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList 'CURSOR'
-   {
-     parser.suggestKeywords(['RETURNS']);
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   'CURSOR'
-   {
-     parser.suggestKeywords(['LOCATION']);
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn 'CURSOR'
-   {
-     if (!$9) {
-       parser.suggestKeywords([{value: 'INIT_FN', weight: 2 }, {value: 'UPDATE_FN', weight: 1 }]);
-     } else {
-       parser.suggestKeywords([{value: 'UPDATE_FN', weight: 1 }]);
-     }
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn 'CURSOR'
-   {
-     parser.suggestKeywords(['MERGE_FN']);
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate 'CURSOR'
-   {
-     if (!$12 && !$13 && !$14 && !$15 && !$16) {
-       parser.suggestKeywords([{value: 'PREPARE_FN', weight: 5 }, {value: 'CLOSE_FN', weight: 4 }, {value: 'SERIALIZE_FN', weight: 3 }, {value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
-     } else if ($12 && !$13 && !$14 && !$15 && !$16) {
-       parser.suggestKeywords([{value: 'CLOSE_FN', weight: 4 }, {value: 'SERIALIZE_FN', weight: 3 }, {value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
-     } else if ($13 && !$14 && !$15 && !$16) {
-       parser.suggestKeywords([{value: 'SERIALIZE_FN', weight: 3 }, {value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
-     } else if ($14 && !$15 && !$16) {
-       parser.suggestKeywords([{value: 'FINALIZE_FN', weight: 2 }, {value: 'INTERMEDIATE', weight: 1 }]);
-     } else if ($15 && !$16) {
-       parser.suggestKeywords([{value: 'INTERMEDIATE', weight: 1 }]);
-     }
-   }
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation_EDIT OptionalInitFn
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn_EDIT
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn_EDIT
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn_EDIT OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn_EDIT OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn_EDIT  OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn_EDIT OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn_EDIT OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn Intermediate_EDIT
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType_EDIT
-   HdfsLocation OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation_EDIT OptionalInitFn UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn_EDIT UpdateFn MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- | 'CREATE' 'AGGREGATE' 'FUNCTION' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedArgumentList ReturnType
-   HdfsLocation OptionalInitFn UpdateFn_EDIT MergeFn OptionalPrepareFn OptionalCloseFn OptionalSerializeFn OptionalFinalizeFn OptionalIntermediate
- ;
-
-ParenthesizedArgumentList
- : '(' ')'
- | '(' ArgumentList OptionalVariableArguments')'
- ;
-
-ParenthesizedArgumentList_EDIT
- : '(' ArgumentList_EDIT RightParenthesisOrError
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-   }
- | '(' ArgumentList 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestKeywords(['...']);
-   }
- ;
-
-ArgumentList
- : PrimitiveType
- | ArgumentList ',' PrimitiveType
- ;
-
-ArgumentList_EDIT
- : AnyCursor
- | ArgumentList ',' AnyCursor
- | AnyCursor ',' ArgumentList
- | ArgumentList ',' AnyCursor ',' ArgumentList
- ;
-
-OptionalVariableArguments
- :
- | '...'
- ;
-
-ReturnType
- : 'RETURNS' PrimitiveType
- ;
-
-ReturnType_EDIT
- : 'RETURNS' 'CURSOR'
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-   }
- ;
-
-SymbolDefinition
- : 'SYMBOL' '=' SingleQuotedValue
- ;
-
-OptionalInitFn
- :
- | 'INIT_FN' '=' FunctionReference
- ;
-
-OptionalInitFn_EDIT
- : 'INIT_FN' '=' FunctionReference_EDIT
- ;
-
-UpdateFn
- : 'UPDATE_FN' '=' FunctionReference
- ;
-
-UpdateFn_EDIT
- : 'UPDATE_FN' '=' FunctionReference_EDIT
- ;
-
-MergeFn
- : 'MERGE_FN' '=' FunctionReference
- ;
-
-MergeFn_EDIT
- : 'MERGE_FN' '=' FunctionReference_EDIT
- ;
-
-OptionalPrepareFn
- :
- | 'PREPARE_FN' '=' FunctionReference
- ;
-
-OptionalPrepareFn_EDIT
- : 'PREPARE_FN' '=' FunctionReference_EDIT
- ;
-
-OptionalCloseFn
- :
- | 'CLOSE_FN' '=' FunctionReference
- ;
-
-OptionalCloseFn_EDIT
- : 'CLOSE_FN' '=' FunctionReference_EDIT
- ;
-
-OptionalSerializeFn
- :
- | 'SERIALIZE_FN' '=' FunctionReference
- ;
-
-OptionalSerializeFn_EDIT
- : 'SERIALIZE_FN' '=' FunctionReference_EDIT
- ;
-
-OptionalFinalizeFn
- :
- | 'FINALIZE_FN' '=' FunctionReference
- ;
-
-OptionalFinalizeFn_EDIT
- : 'FINALIZE_FN' '=' FunctionReference_EDIT
- ;
-
-OptionalIntermediate
- :
- | 'INTERMEDIATE' PrimitiveType
- ;
-
-Intermediate_EDIT
- : 'INTERMEDIATE' 'CURSOR'
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-   }
- ;
-
-FunctionReference
- : SingleQuotedValue
- ;
-
-FunctionReference_EDIT
- : SingleQuotedValue_EDIT
-   {
-     parser.suggestFunctions();
-     parser.suggestAggregateFunctions();
-     parser.suggestAnalyticFunctions();
-   }
- ;
-
-OptionalParenthesizedViewColumnList
- :
- | ParenthesizedViewColumnList
- ;
-
-ParenthesizedViewColumnList
- : '(' ViewColumnList ')'
- ;
-
-ParenthesizedViewColumnList_EDIT
- : '(' ViewColumnList_EDIT RightParenthesisOrError
-   {
-     if (!$2) {
-       parser.suggestKeywords(['COMMENT']);
-     }
-   }
- ;
-
-ViewColumnList
- : ColumnReference OptionalComment
- | ViewColumnList ',' ColumnReference OptionalComment
- ;
-
-ViewColumnList_EDIT
- : ColumnReference OptionalComment 'CURSOR'                                        -> $2
- | ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList                     -> $2
- | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR'                     -> $4
- | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList  -> $4
- ;
-
-RoleDefinition
- : 'CREATE' 'ROLE' RegularIdentifier
- ;

+ 0 - 1
desktop/core/src/desktop/js/parse/jison/sql/impala/sql_insert.jison

@@ -153,7 +153,6 @@ UpsertStatementLeftPart_EDIT
    }
  ;
 
-
 InsertLeftPart
  : 'INSERT' IntoOrOverwrite OptionalTable SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalPartitionSpec
    {

+ 0 - 4
desktop/core/src/desktop/js/parse/jison/sql/impala/sql_main.jison

@@ -553,7 +553,6 @@ DatabasesOrSchemas
  | 'SCHEMAS'
  ;
 
-
 GroupRoleOrUser
  : 'GROUP'
  | 'ROLE'
@@ -951,7 +950,6 @@ OptionalCachedInOrUncached
  | 'UNCACHED'
  ;
 
-
 OptionalCachedIn
  :
  | CachedIn OptionalWithReplication
@@ -1026,7 +1024,6 @@ RegularOrBackTickedSchemaQualifiedName_EDIT
    }
  ;
 
-
 LocalOrSchemaQualifiedName
  : RegularOrBackTickedSchemaQualifiedName
  | RegularOrBackTickedSchemaQualifiedName RegularOrBacktickedIdentifier  -> { identifierChain: $1.identifierChain, alias: $2 }
@@ -2007,7 +2004,6 @@ NullsFirstOrLast_EDIT
  ;
 
 
-
 SortByList
  : SortByIdentifier
  | SortByList ',' SortByIdentifier  -> $3

+ 22 - 6
desktop/core/src/desktop/js/parse/jison/sql/impala/structure.json

@@ -6,9 +6,17 @@
     "alter/alter_database.jison",
     "alter/alter_table.jison",
     "alter/alter_view.jison",
-    "alter/comment_on.jison",
-    "sql_analyze.jison",
-    "sql_create.jison",
+    "comment/comment_on.jison",
+    "compute/compute_stats.jison",
+    "create/create_aggregate_function.jison",
+    "create/create_common.jison",
+    "create/create_database.jison",
+    "create/create_function.jison",
+    "create/create_role.jison",
+    "create/create_table.jison",
+    "create/create_view.jison",
+    "invalidate/invalidate_metadata.jison",
+    "refresh/refresh.jison",
     "sql_drop.jison",
     "sql_error.jison",
     "sql_grant.jison",
@@ -29,9 +37,17 @@
     "alter/alter_database.jison",
     "alter/alter_table.jison",
     "alter/alter_view.jison",
-    "alter/comment_on.jison",
-    "sql_analyze.jison",
-    "sql_create.jison",
+    "comment/comment_on.jison",
+    "compute/compute_stats.jison",
+    "create/create_aggregate_function.jison",
+    "create/create_common.jison",
+    "create/create_database.jison",
+    "create/create_function.jison",
+    "create/create_role.jison",
+    "create/create_table.jison",
+    "create/create_view.jison",
+    "invalidate/invalidate_metadata.jison",
+    "refresh/refresh.jison",
     "sql_drop.jison",
     "sql_grant.jison",
     "sql_insert.jison",

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/impala/impalaAutocompleteParser.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/impala/impalaSyntaxParser.js


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff