Browse Source

HUE-9429 [editor] Extract and split ALTER, SHOW and DROP for Hive and Presto

Johan Ahlen 5 năm trước cách đây
mục cha
commit
c5dbbf3752
48 tập tin đã thay đổi với 1893 bổ sung1118 xóa
  1. 39 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/abort/abort_transactions.jison
  2. 37 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_common.jison
  3. 68 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_database.jison
  4. 56 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_index.jison
  5. 2 2
      desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_materialized_view.jison
  6. 36 230
      desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_table.jison
  7. 66 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_view.jison
  8. 54 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/delete/delete.jison
  9. 27 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_common.jison
  10. 50 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_database.jison
  11. 45 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_function.jison
  12. 48 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_index.jison
  13. 2 2
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_materialized_view.jison
  14. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_role.jison
  15. 58 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_table.jison
  16. 37 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_temporary_function.jison
  17. 41 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_temporary_macro.jison
  18. 59 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_view.jison
  19. 0 320
      desktop/core/src/desktop/js/parse/jison/sql/hive/drop/sql_drop.jison
  20. 34 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/reload/reload.jison
  21. 63 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_columns.jison
  22. 45 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_common.jison
  23. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_compactions.jison
  24. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_conf.jison
  25. 55 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_create_table.jison
  26. 34 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_current_roles.jison
  27. 34 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_databases.jison
  28. 24 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_functions.jison
  29. 63 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_grant.jison
  30. 63 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_index.jison
  31. 72 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_locks.jison
  32. 2 2
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_materialized_views.jison
  33. 51 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_partitions.jison
  34. 46 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_role.jison
  35. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_roles.jison
  36. 71 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_table.jison
  37. 40 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_tables.jison
  38. 43 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_tblproperties.jison
  39. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_transactions.jison
  40. 63 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_views.jison
  41. 0 512
      desktop/core/src/desktop/js/parse/jison/sql/hive/show/sql_show.jison
  42. 96 28
      desktop/core/src/desktop/js/parse/jison/sql/hive/structure.json
  43. 58 0
      desktop/core/src/desktop/js/parse/jison/sql/hive/truncate/truncate_table.jison
  44. 96 22
      desktop/core/src/desktop/js/parse/jison/sql/presto/structure.json
  45. 0 0
      desktop/core/src/desktop/js/parse/sql/hive/hiveAutocompleteParser.js
  46. 0 0
      desktop/core/src/desktop/js/parse/sql/hive/hiveSyntaxParser.js
  47. 0 0
      desktop/core/src/desktop/js/parse/sql/presto/prestoAutocompleteParser.js
  48. 0 0
      desktop/core/src/desktop/js/parse/sql/presto/prestoSyntaxParser.js

+ 39 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/abort/abort_transactions.jison

@@ -0,0 +1,39 @@
+// 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
+ : AbortStatement
+ ;
+
+DataDefinition_EDIT
+ : AbortStatement_EDIT
+ ;
+
+AbortStatement
+ : 'ABORT' 'TRANSACTIONS' TransactionIdList
+ ;
+
+AbortStatement_EDIT
+ : 'ABORT' 'CURSOR'
+   {
+     parser.suggestKeywords(['TRANSACTIONS']);
+   }
+ ;
+
+TransactionIdList
+ : UnsignedNumericLiteral
+ | TransactionIdList ',' UnsignedNumericLiteral
+ ;

+ 37 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_common.jison

@@ -0,0 +1,37 @@
+// 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_EDIT
+ : 'ALTER' 'CURSOR'
+   {
+     parser.suggestKeywords('ALTER');
+   }
+ ;
+
+EnableOrDisable
+ : 'ENABLE'
+ | 'DISABLE'
+ ;
+
+
+
+
+
+
+
+
+
+

+ 68 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_database.jison

@@ -0,0 +1,68 @@
+// 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
+ : AlterDatabase
+ ;
+
+DataDefinition_EDIT
+ : AlterDatabase_EDIT
+ ;
+
+AlterDatabase
+ : 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'DBPROPERTIES' ParenthesizedPropertyAssignmentList
+    {
+      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+    }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' HdfsLocation
+    {
+      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+    }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'OWNER' PrincipalSpecification
+    {
+      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+    }
+ ;
+
+AlterDatabase_EDIT
+ : 'ALTER' DatabaseOrSchema 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+     parser.suggestKeywords(['SET DBPROPERTIES', 'SET LOCATION', 'SET OWNER']);
+   }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'CURSOR'
+    {
+      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+      parser.suggestKeywords(['DBPROPERTIES', 'LOCATION', 'OWNER']);
+    }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' HdfsLocation_EDIT
+   {
+     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+   }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'OWNER' 'CURSOR'
+   {
+     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+     parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
+   }
+ | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'OWNER' PrincipalSpecification_EDIT
+   {
+     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
+   }
+ ;

+ 56 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_index.jison

@@ -0,0 +1,56 @@
+// 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
+ : AlterIndex
+ ;
+
+DataDefinition_EDIT
+ : AlterIndex_EDIT
+ ;
+
+AlterIndex
+ : 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'REBUILD'
+   {
+     parser.addTablePrimary($5);
+   }
+ ;
+
+AlterIndex_EDIT
+ : 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.suggestKeywords(['ON']);
+   }
+ | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier_EDIT
+ | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
+   {
+     parser.addTablePrimary($5);
+   }
+ | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+   {
+     parser.addTablePrimary($5);
+     if (!$6) {
+       parser.suggestKeywords(['PARTITION', 'REBUILD']);
+     } else {
+       parser.suggestKeywords(['REBUILD']);
+     }
+   }
+ ;

+ 2 - 2
desktop/core/src/desktop/js/parse/jison/sql/hive/alter/sql_alter_materialized_view.jison → desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_materialized_view.jison

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

+ 36 - 230
desktop/core/src/desktop/js/parse/jison/sql/hive/alter/sql_alter.jison → desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_table.jison

@@ -15,109 +15,11 @@
 // limitations under the License.
 
 DataDefinition
- : AlterStatement
+ : AlterTable
  ;
 
 DataDefinition_EDIT
- : AlterStatement_EDIT
- ;
-
-AlterStatement
- : AlterDatabase
- | AlterIndex
- | AlterTable
- | AlterView
- | ReloadFunction
- ;
-
-AlterStatement_EDIT
- : AlterDatabase_EDIT
- | AlterIndex_EDIT
- | AlterTable_EDIT
- | AlterView_EDIT
- | ReloadFunction_EDIT
- | 'ALTER' 'CURSOR'
-   {
-     parser.suggestKeywords('ALTER');
-   }
- ;
-
-AlterDatabase
- : 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'DBPROPERTIES' ParenthesizedPropertyAssignmentList
-    {
-      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-    }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' HdfsLocation
-    {
-      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-    }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'OWNER' PrincipalSpecification
-    {
-      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-    }
- ;
-
-AlterDatabase_EDIT
- : 'ALTER' DatabaseOrSchema 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-     parser.suggestKeywords(['SET DBPROPERTIES', 'SET LOCATION', 'SET OWNER']);
-   }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'CURSOR'
-    {
-      parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-      parser.suggestKeywords(['DBPROPERTIES', 'LOCATION', 'OWNER']);
-    }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' HdfsLocation_EDIT
-   {
-     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-   }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'OWNER' 'CURSOR'
-   {
-     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-     parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
-   }
- | 'ALTER' DatabaseOrSchema RegularOrBacktickedIdentifier 'SET' 'OWNER' PrincipalSpecification_EDIT
-   {
-     parser.addDatabaseLocation(@3, [ { name: $3 } ]);
-   }
- ;
-
-AlterIndex
- : 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'REBUILD'
-   {
-     parser.addTablePrimary($5);
-   }
- ;
-
-AlterIndex_EDIT
- : 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['ON']);
-   }
- | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier_EDIT
- | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
-   {
-     parser.addTablePrimary($5);
-   }
- | 'ALTER' 'INDEX' RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
-   {
-     parser.addTablePrimary($5);
-     if (!$6) {
-       parser.suggestKeywords(['PARTITION', 'REBUILD']);
-     } else {
-       parser.suggestKeywords(['REBUILD']);
-     }
-   }
+ : AlterTable_EDIT
  ;
 
 AlterTable
@@ -138,8 +40,8 @@ AlterTable
  | AlterTableLeftSide PartitionSpec 'RENAME' 'TO' PartitionSpec
  | AlterTableLeftSide PartitionSpec 'CHANGE' 'COLUMN' ParenthesizedColumnSpecificationList OptionalCascadeOrRestrict
  | AlterTableLeftSide DropOperations
- | AlterTableLeftSide OptionalPartitionOperations
- | AlterTableLeftSide PartitionSpec OptionalPartitionOperations
+ | AlterTableLeftSide PartitionOperations
+ | AlterTableLeftSide PartitionSpec PartitionOperations
  ;
 
 AlterTable_EDIT
@@ -160,8 +62,8 @@ AlterTable_EDIT
  | AlterTableLeftSide_EDIT PartitionSpec 'RENAME' 'TO' PartitionSpec
  | AlterTableLeftSide_EDIT PartitionSpec 'CHANGE' 'COLUMN' ParenthesizedColumnSpecificationList OptionalCascadeOrRestrict
  | AlterTableLeftSide_EDIT DropOperations
- | AlterTableLeftSide_EDIT OptionalPartitionOperations
- | AlterTableLeftSide_EDIT PartitionSpec OptionalPartitionOperations
+ | AlterTableLeftSide_EDIT PartitionOperations
+ | AlterTableLeftSide_EDIT PartitionSpec PartitionOperations
  | AlterTableLeftSide 'ADD' OptionalIfNotExists 'CURSOR'
    {
      if (!$3) {
@@ -176,7 +78,7 @@ AlterTable_EDIT
    }
  | AlterTableLeftSide 'ADD' OptionalIfNotExists_EDIT
  | AlterTableLeftSide 'ADD' OptionalIfNotExists PartitionSpec HdfsLocation_EDIT OptionalPartitionSpecs
- | AlterTableLeftSide 'ADD' OptionalIfNotExists PartitionSpec OptionalHdfsLocation OptionalPartitionSpecs_EDIT
+ | AlterTableLeftSide 'ADD' OptionalIfNotExists PartitionSpec OptionalHdfsLocation PartitionSpecs_EDIT
  | AlterTableLeftSide 'ADD' OptionalIfNotExists PartitionSpec OptionalHdfsLocation OptionalPartitionSpecs 'CURSOR'
    {
      if (!$5 && !$6) {
@@ -254,13 +156,13 @@ AlterTable_EDIT
        parser.suggestKeywords(['STORED AS DIRECTORIES']);
      }
    }
- | AlterTableLeftSide 'SKEWED' 'BY' ParenthesizedColumnList 'ON' ParenthesizedSkewedValueList OptionalStoredAsDirectories_EDIT
+ | AlterTableLeftSide 'SKEWED' 'BY' ParenthesizedColumnList 'ON' ParenthesizedSkewedValueList StoredAsDirectories_EDIT
  | AlterTableLeftSide 'TOUCH' 'CURSOR'
    {
      parser.suggestKeywords(['PARTITION']);
    }
  | AlterTableLeftSide 'TOUCH' OptionalPartitionSpec_EDIT
- | AlterTableLeftSide OptionalPartitionOperations_EDIT
+ | AlterTableLeftSide PartitionOperations_EDIT
  | AlterTableLeftSide DropOperations_EDIT
  | AlterTableLeftSide 'CURSOR'
    {
@@ -288,7 +190,7 @@ AlterTable_EDIT
    {
      parser.suggestKeywords(['FILEFORMAT', 'LOCATION', 'OWNER', 'SERDE', 'SERDEPROPERTIES', 'SKEWED LOCATION', 'TBLPROPERTIES']);
    }
- | AlterTableLeftSide PartitionSpec OptionalPartitionOperations_EDIT
+ | AlterTableLeftSide PartitionSpec PartitionOperations_EDIT
  | AlterTableLeftSide 'RENAME' 'CURSOR'
    {
      parser.suggestKeywords(['TO']);
@@ -299,38 +201,28 @@ AlterTable_EDIT
    }
  ;
 
-ParenthesizedStatsList
- : '(' StatsList ')'
- ;
-
-ParenthesizedStatsList_EDIT
- : '(' StatsList_EDIT RightParenthesisOrError
- ;
-
-StatsList
- : StatsAssignment
- | StatsList ',' StatsAssignment
- ;
-
-StatsList_EDIT
- : StatsAssignment_EDIT
- | StatsList ',' StatsAssignment_EDIT
- | StatsList ',' StatsAssignment_EDIT ',' StatsList
- | StatsAssignment_EDIT ',' StatsList
- ;
-
-StatsAssignment
- : QuotedValue '=' QuotedValue
+AlterTableLeftSide
+ : 'ALTER' 'TABLE' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($3);
+   }
  ;
 
-StatsAssignment_EDIT
- : 'CURSOR'
+AlterTableLeftSide_EDIT
+ : 'ALTER' 'TABLE' SchemaQualifiedTableIdentifier_EDIT
+   {
+     if (parser.yy.result.suggestTables) {
+       parser.yy.result.suggestTables.onlyTables = true;
+     }
+   }
+ | 'ALTER' 'TABLE' 'CURSOR'
    {
-     parser.suggestIdentifiers(['\'avgSize\'', '\'maxSize\'', '\'numDVs\'', '\'numNulls\'']);
+     parser.suggestTables({ onlyTables: true });
+     parser.suggestDatabases({ appendDot: true });
    }
  ;
 
-OptionalPartitionOperations
+PartitionOperations
  : 'SET' 'FILEFORMAT' FileFormat
  | 'SET' HdfsLocation
  | 'SET' 'TBLPROPERTIES' ParenthesizedPropertyAssignmentList
@@ -346,7 +238,7 @@ OptionalPartitionOperations
    }
  ;
 
-OptionalPartitionOperations_EDIT
+PartitionOperations_EDIT
  : AddReplaceColumns_EDIT
  | 'CHANGE' OptionalColumn 'CURSOR'
    {
@@ -374,7 +266,7 @@ OptionalPartitionOperations_EDIT
      }
      parser.addColumnLocation($3.location, [ $3.identifier ]);
    }
- | 'CHANGE' OptionalColumn ColumnIdentifier ColumnSpecification OptionalAfterOrFirst_EDIT OptionalCascadeOrRestrict
+ | 'CHANGE' OptionalColumn ColumnIdentifier ColumnSpecification AfterOrFirst_EDIT OptionalCascadeOrRestrict
    {
      parser.addColumnLocation($3.location, [ $3.identifier ]);
    }
@@ -522,27 +414,6 @@ DropOperations_EDIT
  | 'DROP' ColumnIdentifier_EDIT
  ;
 
-AlterTableLeftSide
- : 'ALTER' 'TABLE' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-AlterTableLeftSide_EDIT
- : 'ALTER' 'TABLE' SchemaQualifiedTableIdentifier_EDIT
-   {
-     if (parser.yy.result.suggestTables) {
-       parser.yy.result.suggestTables.onlyTables = true;
-     }
-   }
- | 'ALTER' 'TABLE' 'CURSOR'
-   {
-     parser.suggestTables({ onlyTables: true });
-     parser.suggestDatabases({ appendDot: true });
-   }
- ;
-
 AddOrReplace
  : 'ADD'
  | 'REPLACE'
@@ -558,7 +429,7 @@ AfterOrFirst
  | 'FIRST'
  ;
 
-OptionalAfterOrFirst_EDIT
+AfterOrFirst_EDIT
  : AfterOrFirst 'CURSOR'
    {
      parser.suggestColumns();
@@ -571,11 +442,6 @@ OptionalColumn
  | 'COLUMN'
  ;
 
-EnableOrDisable
- : 'ENABLE'
- | 'DISABLE'
- ;
-
 NoDropOrOffline
  : 'NO_DROP' OptionalCascade
  | 'OFFLINE'
@@ -624,18 +490,18 @@ OptionalPartitionSpecs
  | PartitionSpecWithLocationList
  ;
 
-PartitionSpecWithLocationList
- : PartitionSpecWithLocation
- | PartitionSpecWithLocationList PartitionSpecWithLocation  -> $2
- ;
-
-OptionalPartitionSpecs_EDIT
+PartitionSpecs_EDIT
  : PartitionSpecWithLocation_EDIT
  | PartitionSpecWithLocation_EDIT PartitionSpecWithLocationList
  | PartitionSpecWithLocationList PartitionSpecWithLocation_EDIT
  | PartitionSpecWithLocationList PartitionSpecWithLocation_EDIT PartitionSpecWithLocationList
  ;
 
+PartitionSpecWithLocationList
+ : PartitionSpecWithLocation
+ | PartitionSpecWithLocationList PartitionSpecWithLocation  -> $2
+ ;
+
 PartitionSpecWithLocation_EDIT
  : PartitionSpec HdfsLocation_EDIT
  | PartitionSpec_EDIT OptionalHdfsLocation
@@ -693,7 +559,7 @@ OptionalStoredAsDirectories
  | 'STORED_AS_DIRECTORIES'
  ;
 
-OptionalStoredAsDirectories_EDIT
+StoredAsDirectories_EDIT
  : 'STORED' 'CURSOR'
    {
      parser.suggestKeywords(['AS DIRECTORIES']);
@@ -703,63 +569,3 @@ OptionalStoredAsDirectories_EDIT
      parser.suggestKeywords(['DIRECTORIES']);
    }
  ;
-
-AlterView
- : AlterViewLeftSide 'SET' 'TBLPROPERTIES' ParenthesizedPropertyAssignmentList
- | AlterViewLeftSide 'AS' QuerySpecification
- ;
-
-AlterView_EDIT
- : AlterViewLeftSide_EDIT
- | AlterViewLeftSide 'CURSOR'
-   {
-     parser.suggestKeywords(['AS', 'SET TBLPROPERTIES']);
-   }
- | AlterViewLeftSide 'SET' 'CURSOR'
-   {
-     parser.suggestKeywords(['TBLPROPERTIES']);
-   }
- | AlterViewLeftSide 'AS' 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | AlterViewLeftSide 'AS' QuerySpecification_EDIT
- ;
-
-
-AlterViewLeftSide
- : 'ALTER' 'VIEW' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-AlterViewLeftSide_EDIT
- : 'ALTER' 'VIEW' SchemaQualifiedTableIdentifier_EDIT
-   {
-     if (parser.yy.result.suggestTables) {
-       parser.yy.result.suggestTables.onlyViews = true;
-     }
-   }
- | 'ALTER' 'VIEW' 'CURSOR'
-   {
-     parser.suggestTables({ onlyViews: true });
-     parser.suggestDatabases({ appendDot: true });
-   }
- ;
-
-ReloadFunction
- : 'RELOAD' 'FUNCTION'
- ;
-
-ReloadFunction_EDIT
- : 'RELOAD' 'CURSOR'
-   {
-     parser.suggestKeywords(['FUNCTION']);
-   }
- ;
-
-NullableComment
- : QuotedValue
- | 'NULL'
- ;

+ 66 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/alter/alter_view.jison

@@ -0,0 +1,66 @@
+// 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
+ : AlterView
+ ;
+
+DataDefinition_EDIT
+ : AlterView_EDIT
+ ;
+
+AlterView
+ : AlterViewLeftSide 'SET' 'TBLPROPERTIES' ParenthesizedPropertyAssignmentList
+ | AlterViewLeftSide 'AS' QuerySpecification
+ ;
+
+AlterView_EDIT
+ : AlterViewLeftSide_EDIT
+ | AlterViewLeftSide 'CURSOR'
+   {
+     parser.suggestKeywords(['AS', 'SET TBLPROPERTIES']);
+   }
+ | AlterViewLeftSide 'SET' 'CURSOR'
+   {
+     parser.suggestKeywords(['TBLPROPERTIES']);
+   }
+ | AlterViewLeftSide 'AS' 'CURSOR'
+   {
+     parser.suggestKeywords(['SELECT']);
+   }
+ | AlterViewLeftSide 'AS' QuerySpecification_EDIT
+ ;
+
+AlterViewLeftSide
+ : 'ALTER' 'VIEW' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+AlterViewLeftSide_EDIT
+ : 'ALTER' 'VIEW' SchemaQualifiedTableIdentifier_EDIT
+   {
+     if (parser.yy.result.suggestTables) {
+       parser.yy.result.suggestTables.onlyViews = true;
+     }
+   }
+ | 'ALTER' 'VIEW' 'CURSOR'
+   {
+     parser.suggestTables({ onlyViews: true });
+     parser.suggestDatabases({ appendDot: true });
+   }
+ ;

+ 54 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/delete/delete.jison

@@ -0,0 +1,54 @@
+// 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.
+
+DataManipulation
+ : DeleteStatement
+ ;
+
+DataManipulation_EDIT
+ : DeleteStatement_EDIT
+ ;
+
+DeleteStatement
+ : 'DELETE' 'FROM' SchemaQualifiedTableIdentifier OptionalWhereClause
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+DeleteStatement_EDIT
+ : 'DELETE' 'CURSOR'
+   {
+     parser.suggestKeywords(['FROM']);
+   }
+ | 'DELETE' 'FROM' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier 'CURSOR' OptionalWhereClause
+   {
+     parser.addTablePrimary($3);
+     if (!$5) {
+       parser.suggestKeywords(['WHERE']);
+     }
+   }
+ | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier_EDIT OptionalWhereClause
+ | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier WhereClause_EDIT
+   {
+     parser.addTablePrimary($3);
+   }
+ ;

+ 27 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_common.jison

@@ -0,0 +1,27 @@
+// 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_EDIT
+ : 'DROP' 'CURSOR'
+   {
+     parser.suggestKeywords('DROP');
+   }
+ ;
+
+OptionalPurge
+ :
+ | 'PURGE'
+ ;

+ 50 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_database.jison

@@ -0,0 +1,50 @@
+// 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
+ : DropDatabaseStatement
+ ;
+
+DataDefinition_EDIT
+ : DropDatabaseStatement_EDIT
+ ;
+
+DropDatabaseStatement
+ : 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
+ ;
+
+DropDatabaseStatement_EDIT
+ : 'DROP' DatabaseOrSchema OptionalIfExists
+ | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT
+ | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+     parser.suggestDatabases();
+   }
+ | 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.suggestKeywords(['CASCADE', 'RESTRICT']);
+   }
+ | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
+ | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR' RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ ;

+ 45 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_function.jison

@@ -0,0 +1,45 @@
+// 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
+ : DropFunctionStatement
+ ;
+
+DataDefinition_EDIT
+ : DropFunctionStatement_EDIT
+ ;
+
+DropFunctionStatement
+ : 'DROP' 'FUNCTION' OptionalIfExists SchemaQualifiedIdentifier
+ ;
+
+DropFunctionStatement_EDIT
+ : 'DROP' 'FUNCTION' OptionalIfExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'DROP' 'FUNCTION' OptionalIfExists 'CURSOR' SchemaQualifiedIdentifier
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'DROP' 'FUNCTION' OptionalIfExists_EDIT
+ | 'DROP' 'FUNCTION' OptionalIfExists_EDIT SchemaQualifiedIdentifier
+ | 'DROP' 'FUNCTION' OptionalIfExists SchemaQualifiedIdentifier_EDIT
+ ;

+ 48 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_index.jison

@@ -0,0 +1,48 @@
+// 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
+ : DropIndexStatement
+ ;
+
+DataDefinition_EDIT
+ : DropIndexStatement_EDIT
+ ;
+
+DropIndexStatement
+ : 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($6);
+   }
+ ;
+
+DropIndexStatement_EDIT
+ : 'DROP' 'INDEX' OptionalIfExists 'CURSOR'
+   {
+     parser.suggestKeywords(['IF EXISTS']);
+   }
+ | 'DROP' 'INDEX' OptionalIfExists_EDIT
+ | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.suggestKeywords(['ON']);
+   }
+ | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier_EDIT
+ ;

+ 2 - 2
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/sql_drop_materialized_view.jison → desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_materialized_view.jison

@@ -14,11 +14,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-DropStatement
+DataDefinition
  : DropMaterializedViewStatement
  ;
 
-DropStatement_EDIT
+DataDefinition_EDIT
  : DropMaterializedViewStatement_EDIT
  ;
 

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_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.
+
+DataDefinition
+ : DropRoleStatement
+ ;
+
+DropRoleStatement
+ : 'DROP' 'ROLE' RegularIdentifier
+ ;

+ 58 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_table.jison

@@ -0,0 +1,58 @@
+// 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
+ : DropTableStatement
+ ;
+
+DataDefinition_EDIT
+ : DropTableStatement_EDIT
+ ;
+
+DropTableStatement
+ : 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+DropTableStatement_EDIT
+ : 'DROP' 'TABLE' OptionalIfExists_EDIT
+ | 'DROP' 'TABLE' OptionalIfExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+     parser.suggestTables({ onlyTables: true });
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT OptionalPurge
+   {
+     if (parser.yy.result.suggestTables) {
+       parser.yy.result.suggestTables.onlyTables = true;
+     }
+   }
+ | 'DROP' 'TABLE' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPurge
+ | 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge 'CURSOR'
+   {
+     parser.addTablePrimary($4);
+     if (!$5) {
+       parser.suggestKeywords(['PURGE']);
+     }
+   }
+ ;

+ 37 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_temporary_function.jison

@@ -0,0 +1,37 @@
+// 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
+ : DropTemporaryFunctionStatement
+ ;
+
+DataDefinition_EDIT
+ : DropTemporaryFunctionStatement_EDIT
+ ;
+
+DropTemporaryFunctionStatement
+ : 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists RegularIdentifier
+ ;
+
+DropTemporaryFunctionStatement_EDIT
+ : 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists 'CURSOR'
+   {
+     if (!$4) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists_EDIT
+ ;

+ 41 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_temporary_macro.jison

@@ -0,0 +1,41 @@
+// 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
+ : DropTemporaryMacroStatement
+ ;
+
+DataDefinition_EDIT
+ : DropTemporaryMacroStatement_EDIT
+ ;
+
+DropTemporaryMacroStatement
+ : 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists RegularIdentifier
+ ;
+
+DropTemporaryMacroStatement_EDIT
+ : 'DROP' 'TEMPORARY' 'CURSOR'
+   {
+     parser.suggestKeywords(['FUNCTION', 'MACRO']);
+   }
+ | 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists 'CURSOR'
+   {
+     if (!$4) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists_EDIT
+ ;

+ 59 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/drop_view.jison

@@ -0,0 +1,59 @@
+// 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
+ : DropViewStatement
+ ;
+
+DataDefinition_EDIT
+ : DropViewStatement_EDIT
+ ;
+
+DropViewStatement
+ : 'DROP' 'VIEW' OptionalIfExists SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+DropViewStatement_EDIT
+ : 'DROP' 'VIEW' OptionalIfExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+     parser.suggestTables({ onlyViews: true });
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'DROP' 'VIEW' OptionalIfExists 'CURSOR' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($5);
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'DROP' 'VIEW' OptionalIfExists_EDIT
+ | 'DROP' 'VIEW' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($4);
+   }
+ | 'DROP' 'VIEW' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT
+   {
+     if (parser.yy.result.suggestTables) {
+       parser.yy.result.suggestTables.onlyViews = true;
+     }
+   }
+ ;

+ 0 - 320
desktop/core/src/desktop/js/parse/jison/sql/hive/drop/sql_drop.jison

@@ -1,320 +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
- : DropStatement
- | AbortStatement
- ;
-
-DataDefinition_EDIT
- : DropStatement_EDIT
- | AbortStatement_EDIT
- ;
-
-DataManipulation
- : DeleteStatement
- ;
-
-DataManipulation_EDIT
- : DeleteStatement_EDIT
- ;
-
-DropStatement
- : DropDatabaseStatement
- | DropFunctionStatement
- | DropRoleStatement
- | DropTableStatement
- | DropIndexStatement
- | DropMacroStatement
- | DropViewStatement
- | TruncateTableStatement
- ;
-
-DropStatement_EDIT
- : DropDatabaseStatement_EDIT
- | DropFunctionStatement_EDIT
- | DropTableStatement_EDIT
- | DropIndexStatement_EDIT
- | DropMacroStatement_EDIT
- | DropViewStatement_EDIT
- | TruncateTableStatement_EDIT
- | 'DROP' 'CURSOR'
-   {
-     parser.suggestKeywords('DROP');
-   }
- ;
-
-DropDatabaseStatement
- : 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
- ;
-
-DropDatabaseStatement_EDIT
- : 'DROP' DatabaseOrSchema OptionalIfExists
- | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT
- | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-     parser.suggestDatabases();
-   }
- | 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['CASCADE', 'RESTRICT']);
-   }
- | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
- | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR' RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- ;
-
-DropFunctionStatement
- : 'DROP' 'FUNCTION' OptionalIfExists SchemaQualifiedIdentifier
- | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists RegularIdentifier
- ;
-
-DropFunctionStatement_EDIT
- : 'DROP' 'FUNCTION' OptionalIfExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' 'FUNCTION' OptionalIfExists 'CURSOR' SchemaQualifiedIdentifier
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' 'FUNCTION' OptionalIfExists_EDIT
- | 'DROP' 'FUNCTION' OptionalIfExists_EDIT SchemaQualifiedIdentifier
- | 'DROP' 'FUNCTION' OptionalIfExists SchemaQualifiedIdentifier_EDIT
- | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists 'CURSOR'
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists_EDIT
- ;
-
-DropRoleStatement
- : 'DROP' 'ROLE' RegularIdentifier
- ;
-
-DropTableStatement
- : 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-DropTableStatement_EDIT
- : 'DROP' 'TABLE' OptionalIfExists_EDIT
- | 'DROP' 'TABLE' OptionalIfExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-     parser.suggestTables({ onlyTables: true });
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT OptionalPurge
-   {
-     if (parser.yy.result.suggestTables) {
-       parser.yy.result.suggestTables.onlyTables = true;
-     }
-   }
- | 'DROP' 'TABLE' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPurge
- | 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge 'CURSOR'
-   {
-     parser.addTablePrimary($4);
-     if (!$5) {
-       parser.suggestKeywords(['PURGE']);
-     }
-   }
- ;
-
-OptionalPurge
- :
- | 'PURGE'
- ;
-
-DropIndexStatement
- : 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($6);
-   }
- ;
-
-DropIndexStatement_EDIT
- : 'DROP' 'INDEX' OptionalIfExists 'CURSOR'
-   {
-     parser.suggestKeywords(['IF EXISTS']);
-   }
- | 'DROP' 'INDEX' OptionalIfExists_EDIT
- | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['ON']);
-   }
- | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier_EDIT
- ;
-
-DropMacroStatement
- : 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists RegularIdentifier
- ;
-
-DropMacroStatement_EDIT
- : 'DROP' 'TEMPORARY' 'CURSOR'
-   {
-     parser.suggestKeywords(['FUNCTION', 'MACRO']);
-   }
- | 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists 'CURSOR'
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists_EDIT
- ;
-
-DropViewStatement
- : 'DROP' 'VIEW' OptionalIfExists SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-DropViewStatement_EDIT
- : 'DROP' 'VIEW' OptionalIfExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-     parser.suggestTables({ onlyViews: true });
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DROP' 'VIEW' OptionalIfExists 'CURSOR' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($5);
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' 'VIEW' OptionalIfExists_EDIT
- | 'DROP' 'VIEW' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($4);
-   }
- | 'DROP' 'VIEW' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT
-   {
-     if (parser.yy.result.suggestTables) {
-       parser.yy.result.suggestTables.onlyViews = true;
-     }
-   }
- ;
-
-TruncateTableStatement
- : 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-TruncateTableStatement_EDIT
- : 'TRUNCATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['TABLE']);
-   }
- | 'TRUNCATE' 'TABLE' 'CURSOR' OptionalPartitionSpec
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
- | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
-   {
-     parser.addTablePrimary($3);
-     if (!$4) {
-       parser.suggestKeywords(['PARTITION']);
-     }
-   }
- | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
-   {
-     parser.addTablePrimary($3);
-   }
- | 'TRUNCATE' 'TABLE' 'CURSOR' SchemaQualifiedTableIdentifier OptionalPartitionSpec
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-DeleteStatement
- : 'DELETE' 'FROM' SchemaQualifiedTableIdentifier OptionalWhereClause
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-DeleteStatement_EDIT
- : 'DELETE' 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM']);
-   }
- | 'DELETE' 'FROM' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier 'CURSOR' OptionalWhereClause
-   {
-     parser.addTablePrimary($3);
-     if (!$5) {
-       parser.suggestKeywords(['WHERE']);
-     }
-   }
- | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier_EDIT OptionalWhereClause
- | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier WhereClause_EDIT
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-AbortStatement
- : 'ABORT' 'TRANSACTIONS' TransactionIdList
- ;
-
-AbortStatement_EDIT
- : 'ABORT' 'CURSOR'
-   {
-     parser.suggestKeywords(['TRANSACTIONS']);
-   }
- ;
-
-TransactionIdList
- : UnsignedNumericLiteral
- | TransactionIdList ',' UnsignedNumericLiteral
- ;

+ 34 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/reload/reload.jison

@@ -0,0 +1,34 @@
+// 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
+ : ReloadFunction
+ ;
+
+DataDefinition_EDIT
+ : ReloadFunction_EDIT
+ ;
+
+ReloadFunction
+ : 'RELOAD' 'FUNCTION'
+ ;
+
+ReloadFunction_EDIT
+ : 'RELOAD' 'CURSOR'
+   {
+     parser.suggestKeywords(['FUNCTION']);
+   }
+ ;

+ 63 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_columns.jison

@@ -0,0 +1,63 @@
+// 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
+ : ShowColumnsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowColumnsStatement_EDIT
+ ;
+
+ShowColumnsStatement
+ : 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier
+ | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier FromOrIn RegularOrBacktickedIdentifier
+ ;
+
+ShowColumnsStatement_EDIT
+ : 'SHOW' 'COLUMNS' 'CURSOR'
+   {
+     parser.suggestKeywords(['FROM', 'IN']);
+   }
+ | 'SHOW' 'COLUMNS' 'CURSOR' RegularOrBacktickedIdentifier
+   {
+     parser.suggestKeywords(['FROM', 'IN']);
+   }
+ | 'SHOW' 'COLUMNS' FromOrIn 'CURSOR'
+   {
+     parser.suggestTables();
+   }
+ | 'SHOW' 'COLUMNS' FromOrIn 'CURSOR' FromOrIn
+   {
+     parser.suggestTables();
+   }
+ | 'SHOW' 'COLUMNS' FromOrIn 'CURSOR' FromOrIn RegularOrBacktickedIdentifier
+   {
+     parser.suggestTables();
+   }
+ | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.suggestKeywords(['FROM', 'IN']);
+   }
+ | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier 'CURSOR' RegularOrBacktickedIdentifier
+   {
+     parser.suggestKeywords(['FROM', 'IN']);
+   }
+ | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier FromOrIn 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ ;

+ 45 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_common.jison

@@ -0,0 +1,45 @@
+// 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_EDIT
+ : 'SHOW' 'CURSOR'
+   {
+     parser.suggestKeywords('SHOW');
+   }
+ | 'SHOW' 'CURSOR' RegularOrBackTickedSchemaQualifiedName
+   {
+     // ROLES is considered a non-reserved keywords so we can't match it in ShowCurrentRolesStatement_EDIT
+     if ($3.identifierChain && $3.identifierChain.length === 1 && $3.identifierChain[0].name.toLowerCase() === 'roles') {
+       parser.suggestKeywords(['CURRENT']);
+       parser.yy.locations.pop();
+     } else {
+       parser.addTablePrimary($3);
+     }
+   }
+ | 'SHOW' 'CURSOR' LIKE SingleQuotedValue
+   {
+     parser.suggestKeywords(['DATABASES', 'SCHEMAS', 'TABLE EXTENDED']);
+   }
+ ;
+
+OptionalLike
+ :
+ | 'LIKE' SingleQuotedValue
+ ;
+
+Like_EDIT
+ : 'LIKE' 'CURSOR'
+ ;

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_compactions.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.
+
+DataDefinition
+ : ShowCompactionsStatement
+ ;
+
+ShowCompactionsStatement
+ : 'SHOW' 'COMPACTIONS'
+ ;

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_conf.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.
+
+DataDefinition
+ : ShowConfStatement
+ ;
+
+ShowConfStatement
+ : 'SHOW' 'CONF' ConfigurationName
+ ;

+ 55 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_create_table.jison

@@ -0,0 +1,55 @@
+// 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
+ : ShowCreateTableStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowCreateTableStatement_EDIT
+ ;
+
+ShowCreateTableStatement
+ : 'SHOW' 'CREATE' 'TABLE' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+ShowCreateTableStatement_EDIT
+ : 'SHOW' 'CREATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['TABLE']);
+   }
+ | 'SHOW' 'CREATE' 'TABLE' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'CREATE' 'TABLE' RegularOrBackTickedSchemaQualifiedName_EDIT
+   {
+     if (parser.yy.result.suggestTables && $3.isView) {
+       parser.yy.result.suggestTables.onlyViews = true;
+     }
+   }
+ | 'SHOW' 'CREATE' 'CURSOR' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($4);
+     parser.suggestKeywords(['TABLE']);
+   }
+ ;

+ 34 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_current_roles.jison

@@ -0,0 +1,34 @@
+// 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
+ : ShowCurrentRolesStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowCurrentRolesStatement_EDIT
+ ;
+
+ShowCurrentRolesStatement
+ : 'SHOW' 'CURRENT' 'ROLES'
+ ;
+
+ShowCurrentRolesStatement_EDIT
+ : 'SHOW' 'CURRENT' 'CURSOR'
+   {
+     parser.suggestKeywords(['ROLES']);
+   }
+ ;

+ 34 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_databases.jison

@@ -0,0 +1,34 @@
+// 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
+ : ShowDatabasesStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowDatabasesStatement_EDIT
+ ;
+
+ShowDatabasesStatement
+ : 'SHOW' DatabasesOrSchemas 'LIKE' SingleQuotedValue
+ ;
+
+ShowDatabasesStatement_EDIT
+ : 'SHOW' DatabasesOrSchemas 'CURSOR'
+   {
+     parser.suggestKeywords(['LIKE']);
+   }
+ ;

+ 24 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_functions.jison

@@ -0,0 +1,24 @@
+// 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
+ : ShowFunctionsStatement
+ ;
+
+ShowFunctionsStatement
+ : 'SHOW' 'FUNCTIONS'
+ | 'SHOW' 'FUNCTIONS' DoubleQuotedValue
+ ;

+ 63 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_grant.jison

@@ -0,0 +1,63 @@
+// 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
+ : ShowGrantStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowGrantStatement_EDIT
+ ;
+
+ShowGrantStatement
+ : 'SHOW' 'GRANT' OptionalPrincipalName
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'ALL'
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' SchemaQualifiedTableIdentifier
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'TABLE' SchemaQualifiedTableIdentifier
+ ;
+
+ShowGrantStatement_EDIT
+ : 'SHOW' 'GRANT' PrincipalName_EDIT
+   {
+     parser.suggestKeywords(['ON']);
+   }
+ | 'SHOW' 'GRANT' PrincipalName_EDIT 'ON' 'ALL'
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'CURSOR'
+   {
+     parser.suggestKeywords(['ALL', 'TABLE']);
+     parser.suggestTables();
+   }
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' SchemaQualifiedTableIdentifier_EDIT
+ | 'SHOW'  'GRANT' OptionalPrincipalName 'ON' 'TABLE' 'CURSOR'
+   {
+     parser.suggestTables();
+   }
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'CURSOR' SchemaQualifiedTableIdentifier
+   {
+     parser.suggestKeywords(['TABLE']);
+   }
+ | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'CURSOR' SchemaQualifiedTableIdentifier_EDIT
+ ;
+
+OptionalPrincipalName
+ :
+ | RegularIdentifier
+ ;
+
+PrincipalName_EDIT
+ : 'CURSOR'
+ | RegularIdentifier 'CURSOR'
+ ;

+ 63 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_index.jison

@@ -0,0 +1,63 @@
+// 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
+ : ShowIndexStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowIndexStatement_EDIT
+ ;
+
+ShowIndexStatement
+ : 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier
+ | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier FromOrIn RegularOrBacktickedIdentifier
+ ;
+
+ShowIndexStatement_EDIT
+ : 'SHOW' OptionallyFormattedIndex
+ | 'SHOW' OptionallyFormattedIndex_EDIT
+ | 'SHOW' OptionallyFormattedIndex_EDIT 'ON' RegularOrBacktickedIdentifier
+ | 'SHOW' OptionallyFormattedIndex_EDIT 'ON' RegularOrBacktickedIdentifier FromOrIn RegularOrBacktickedIdentifier
+ | 'SHOW' OptionallyFormattedIndex 'CURSOR'
+   {
+     parser.suggestKeywords(['ON']);
+   }
+ | 'SHOW' OptionallyFormattedIndex 'ON' 'CURSOR'
+   {
+     parser.suggestTables();
+   }
+ | 'SHOW' OptionallyFormattedIndex 'CURSOR' RegularOrBacktickedIdentifier
+   {
+     parser.suggestKeywords(['ON']);
+   }
+ | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.suggestKeywords(['FROM', 'IN']);
+   }
+ | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier 'CURSOR' RegularOrBacktickedIdentifier
+   {
+     parser.suggestKeywords(['FROM', 'IN']);
+   }
+ | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier FromOrIn 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ | 'SHOW' OptionallyFormattedIndex 'ON' 'CURSOR' FromOrIn RegularOrBacktickedIdentifier
+   {
+     parser.suggestTables({identifierChain: [{name: $6}]});
+   }
+ ;

+ 72 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_locks.jison

@@ -0,0 +1,72 @@
+// 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
+ : ShowLocksStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowLocksStatement_EDIT
+ ;
+
+ShowLocksStatement
+ : 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName 'EXTENDED'
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName PartitionSpec
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName PartitionSpec 'EXTENDED'
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'SHOW' 'LOCKS' DatabaseOrSchema RegularOrBacktickedIdentifier
+ ;
+
+ShowLocksStatement_EDIT
+ : 'SHOW' 'LOCKS' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+     parser.suggestKeywords(['DATABASE', 'SCHEMA']);
+   }
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName 'CURSOR'
+    {
+      parser.addTablePrimary($3);
+      parser.suggestKeywords(['EXTENDED', 'PARTITION']);
+    }
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT 'EXTENDED'
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT PartitionSpec
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName PartitionSpec 'CURSOR'
+   {
+     parser.addTablePrimary($3);
+     parser.suggestKeywords(['EXTENDED']);
+   }
+ | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT PartitionSpec 'EXTENDED'
+ | 'SHOW' 'LOCKS' DatabaseOrSchema 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ ;

+ 2 - 2
desktop/core/src/desktop/js/parse/jison/sql/hive/show/sql_show_materialized_views.jison → desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_materialized_views.jison

@@ -14,11 +14,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-ShowStatement
+DataDefinition
  : ShowMaterializedViewsStatement
  ;
 
-ShowStatement_EDIT
+DataDefinition_EDIT
  : ShowMaterializedViewsStatement_EDIT
  ;
 

+ 51 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_partitions.jison

@@ -0,0 +1,51 @@
+// 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
+ : ShowPartitionsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowPartitionsStatement_EDIT
+ ;
+
+ShowPartitionsStatement
+ : 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName PartitionSpec
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+ShowPartitionsStatement_EDIT
+ : 'SHOW' 'PARTITIONS' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT
+ | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName 'CURSOR'
+   {
+     parser.addTablePrimary($3);
+     parser.suggestKeywords(['PARTITION']);
+   }
+ | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT PartitionSpec
+ ;

+ 46 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_role.jison

@@ -0,0 +1,46 @@
+// 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
+ : ShowRoleStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowRoleStatement_EDIT
+ ;
+
+ShowRoleStatement
+ : 'SHOW' 'ROLE' 'GRANT' RoleOrUser RegularIdentifier
+ ;
+
+ShowRoleStatement_EDIT
+ : 'SHOW' 'ROLE' 'CURSOR'
+   {
+     parser.suggestKeywords(['GRANT']);
+   }
+ | 'SHOW' 'ROLE' 'CURSOR' RoleOrUser RegularIdentifier
+   {
+     parser.suggestKeywords(['GRANT']);
+   }
+ | 'SHOW' 'ROLE' 'GRANT' 'CURSOR'
+   {
+     parser.suggestKeywords(['ROLE', 'USER']);
+   }
+ | 'SHOW' 'ROLE' 'GRANT' 'CURSOR' RegularIdentifier
+   {
+     parser.suggestKeywords(['ROLE', 'USER']);
+   }
+ ;

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_roles.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.
+
+DataDefinition
+ : ShowRolesStatement
+ ;
+
+ShowRolesStatement
+ : 'SHOW' 'ROLES'
+ ;

+ 71 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_table.jison

@@ -0,0 +1,71 @@
+// 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
+ : ShowTableStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowTableStatement_EDIT
+ ;
+
+ShowTableStatement
+ : 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue PartitionSpec
+ ;
+
+ShowTableStatement_EDIT
+ : 'SHOW' 'TABLE' 'CURSOR'
+   {
+     parser.suggestKeywords(['EXTENDED']);
+   }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase_EDIT
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'CURSOR'
+    {
+      if ($4) {
+        parser.suggestKeywords(['LIKE']);
+      } else {
+        parser.suggestKeywords(['FROM', 'IN', 'LIKE']);
+      }
+    }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase_EDIT 'LIKE' SingleQuotedValue
+ | 'SHOW' 'TABLE' 'CURSOR' OptionalFromDatabase 'LIKE' SingleQuotedValue
+    {
+      parser.suggestKeywords(['EXTENDED']);
+    }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'CURSOR' SingleQuotedValue
+    {
+      parser.suggestKeywords(['LIKE']);
+    }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue 'CURSOR'
+    {
+      parser.suggestKeywords(['PARTITION']);
+    }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase_EDIT 'LIKE' SingleQuotedValue PartitionSpec
+ | 'SHOW' 'TABLE' 'CURSOR' OptionalFromDatabase 'LIKE' SingleQuotedValue PartitionSpec
+   {
+     parser.suggestKeywords(['EXTENDED']);
+   }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'CURSOR' SingleQuotedValue PartitionSpec
+   {
+     parser.suggestKeywords(['LIKE']);
+   }
+ | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue 'CURSOR' PartitionSpecList
+   {
+     parser.suggestKeywords(['PARTITION']);
+   }
+ ;

+ 40 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_tables.jison

@@ -0,0 +1,40 @@
+// 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
+ : ShowTablesStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowTablesStatement_EDIT
+ ;
+
+ShowTablesStatement
+ : 'SHOW' 'TABLES' OptionalInDatabase
+ | 'SHOW' 'TABLES' OptionalInDatabase SingleQuotedValue
+ | 'SHOW' 'TABLES' OptionalInDatabase 'LIKE' SingleQuotedValue
+ ;
+
+ShowTablesStatement_EDIT
+ : 'SHOW' 'TABLES' OptionalInDatabase 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IN', 'LIKE']);
+     } else {
+       parser.suggestKeywords(['LIKE']);
+     }
+   }
+ ;

+ 43 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_tblproperties.jison

@@ -0,0 +1,43 @@
+// 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
+ : ShowTblpropertiesStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowTblpropertiesStatement_EDIT
+ ;
+
+ShowTblpropertiesStatement
+ : 'SHOW' 'TBLPROPERTIES' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'SHOW' 'TBLPROPERTIES' RegularOrBackTickedSchemaQualifiedName '(' QuotedValue ')'
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+ShowTblpropertiesStatement_EDIT
+ : 'SHOW' 'TBLPROPERTIES' RegularOrBackTickedSchemaQualifiedName_EDIT
+ | 'SHOW' 'TBLPROPERTIES' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ prependDot: true });
+   }
+ ;

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_transactions.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.
+
+DataDefinition
+ : ShowTransactionsStatement
+ ;
+
+ShowTransactionsStatement
+ : 'SHOW' 'TRANSACTIONS'
+ ;

+ 63 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/show/show_views.jison

@@ -0,0 +1,63 @@
+// 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
+ : ShowViewsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowViewsStatement_EDIT
+ ;
+
+ShowViewsStatement
+ : 'SHOW' 'VIEWS' OptionalInOrFromDatabase OptionalLike
+ ;
+
+ShowViewsStatement_EDIT
+ : 'SHOW' 'VIEWS' OptionalInOrFromDatabase OptionalLike 'CURSOR'
+   {
+     if (!$4 && !$3) {
+       parser.suggestKeywords([{ value: 'IN', weight: 2 }, { value: 'FROM', weight: 2 }, { value: 'LIKE', weight: 1 }]);
+     } else if (!$4) {
+       parser.suggestKeywords(['LIKE']);
+     }
+   }
+ | 'SHOW' 'VIEWS' InOrFromDatabase_EDIT OptionalLike
+ | 'SHOW' 'VIEWS' OptionalInOrFromDatabase Like_EDIT
+ ;
+
+OptionalInOrFromDatabase
+ :
+ | 'IN' RegularOrBacktickedIdentifier
+   {
+     parser.addDatabaseLocation(@2, [ { name: $2 } ]);
+   }
+ | 'FROM' RegularOrBacktickedIdentifier
+   {
+     parser.addDatabaseLocation(@2, [ { name: $2 } ]);
+   }
+ ;
+
+InOrFromDatabase_EDIT
+ : 'IN' 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ | 'FROM' 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ ;

+ 0 - 512
desktop/core/src/desktop/js/parse/jison/sql/hive/show/sql_show.jison

@@ -1,512 +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
- : ShowStatement
- ;
-
-DataDefinition_EDIT
- : ShowStatement_EDIT
- ;
-
-ShowStatement
- : ShowColumnsStatement
- | ShowCompactionsStatement
- | ShowConfStatement
- | ShowCreateTableStatement
- | ShowCurrentRolesStatement
- | ShowDatabasesStatement
- | ShowFunctionsStatement
- | ShowGrantStatement
- | ShowIndexStatement
- | ShowLocksStatement
- | ShowPartitionsStatement
- | ShowRolesStatement
- | ShowRoleStatement
- | ShowTablesStatement
- | ShowTableStatement
- | ShowTblPropertiesStatement
- | ShowTransactionsStatement
- | ShowViewsStatement
- ;
-
-ShowStatement_EDIT
- : 'SHOW' 'CURSOR'
-   {
-     parser.suggestKeywords('SHOW');
-   }
- | 'SHOW' 'CURSOR' RegularOrBackTickedSchemaQualifiedName
-   {
-     // ROLES is considered a non-reserved keywords so we can't match it in ShowCurrentRolesStatement_EDIT
-     if ($3.identifierChain && $3.identifierChain.length === 1 && $3.identifierChain[0].name.toLowerCase() === 'roles') {
-       parser.suggestKeywords(['CURRENT']);
-       parser.yy.locations.pop();
-     } else {
-       parser.addTablePrimary($3);
-     }
-   }
- | 'SHOW' 'CURSOR' LIKE SingleQuotedValue
-   {
-     parser.suggestKeywords(['DATABASES', 'SCHEMAS', 'TABLE EXTENDED']);
-   }
- | ShowColumnsStatement_EDIT
- | ShowCreateTableStatement_EDIT
- | ShowCurrentRolesStatement_EDIT
- | ShowDatabasesStatement_EDIT
- | ShowGrantStatement_EDIT
- | ShowIndexStatement_EDIT
- | ShowLocksStatement_EDIT
- | ShowPartitionsStatement_EDIT
- | ShowRoleStatement_EDIT
- | ShowTablesStatement_EDIT
- | ShowTableStatement_EDIT
- | ShowTblPropertiesStatement_EDIT
- | ShowViewsStatement_EDIT
- ;
-
-ShowColumnsStatement
- : 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier
- | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier FromOrIn RegularOrBacktickedIdentifier
- ;
-
-ShowColumnsStatement_EDIT
- : 'SHOW' 'COLUMNS' 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM', 'IN']);
-   }
- | 'SHOW' 'COLUMNS' 'CURSOR' RegularOrBacktickedIdentifier
-   {
-     parser.suggestKeywords(['FROM', 'IN']);
-   }
- | 'SHOW' 'COLUMNS' FromOrIn 'CURSOR'
-   {
-     parser.suggestTables();
-   }
- | 'SHOW' 'COLUMNS' FromOrIn 'CURSOR' FromOrIn
-   {
-     parser.suggestTables();
-   }
- | 'SHOW' 'COLUMNS' FromOrIn 'CURSOR' FromOrIn RegularOrBacktickedIdentifier
-   {
-     parser.suggestTables();
-   }
- | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM', 'IN']);
-   }
- | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier 'CURSOR' RegularOrBacktickedIdentifier
-   {
-     parser.suggestKeywords(['FROM', 'IN']);
-   }
- | 'SHOW' 'COLUMNS' FromOrIn RegularOrBacktickedIdentifier FromOrIn 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- ;
-
-ShowCompactionsStatement
- : 'SHOW' 'COMPACTIONS'
- ;
-
-ShowConfStatement
- : 'SHOW' 'CONF' ConfigurationName
- ;
-
-ShowCreateTableStatement
- : 'SHOW' 'CREATE' TableOrView RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-ShowCreateTableStatement_EDIT
- : 'SHOW' 'CREATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['TABLE']);
-   }
- | 'SHOW' 'CREATE' TableOrView 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'CREATE' TableOrView RegularOrBackTickedSchemaQualifiedName_EDIT
-   {
-     if (parser.yy.result.suggestTables && $3.isView) {
-       parser.yy.result.suggestTables.onlyViews = true;
-     }
-   }
- | 'SHOW' 'CREATE' 'CURSOR' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($4);
-     parser.suggestKeywords(['TABLE']);
-   }
- ;
-
-TableOrView
- : 'TABLE'
- | 'VIEW'   -> { isView: true }
- ;
-
-ShowCurrentRolesStatement
- : 'SHOW' 'CURRENT' 'ROLES'
- ;
-
-ShowCurrentRolesStatement_EDIT
- : 'SHOW' 'CURRENT' 'CURSOR'
-   {
-     parser.suggestKeywords([ 'ROLES' ]);
-   }
- ;
-
-ShowDatabasesStatement
- : 'SHOW' DatabasesOrSchemas 'LIKE' SingleQuotedValue
- ;
-
-ShowDatabasesStatement_EDIT
- : 'SHOW' DatabasesOrSchemas 'CURSOR'
-   {
-     parser.suggestKeywords(['LIKE']);
-   }
- ;
-
-ShowFunctionsStatement
- : 'SHOW' 'FUNCTIONS'
- | 'SHOW' 'FUNCTIONS' DoubleQuotedValue
- ;
-
-ShowGrantStatement
- : 'SHOW' 'GRANT' OptionalPrincipalName
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'ALL'
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' SchemaQualifiedTableIdentifier
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'TABLE' SchemaQualifiedTableIdentifier
- ;
-
-ShowGrantStatement_EDIT
- : 'SHOW' 'GRANT' OptionalPrincipalName_EDIT
-   {
-     parser.suggestKeywords(['ON']);
-   }
- | 'SHOW' 'GRANT' OptionalPrincipalName_EDIT 'ON' 'ALL'
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'CURSOR'
-   {
-     parser.suggestKeywords(['ALL', 'TABLE']);
-     parser.suggestTables();
-   }
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' SchemaQualifiedTableIdentifier_EDIT
- | 'SHOW'  'GRANT' OptionalPrincipalName 'ON' 'TABLE' 'CURSOR'
-   {
-     parser.suggestTables();
-   }
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'CURSOR' SchemaQualifiedTableIdentifier
-   {
-     parser.suggestKeywords(['TABLE']);
-   }
- | 'SHOW' 'GRANT' OptionalPrincipalName 'ON' 'CURSOR' SchemaQualifiedTableIdentifier_EDIT
- ;
-
-OptionalPrincipalName
- :
- | RegularIdentifier
- ;
-
-OptionalPrincipalName_EDIT
- : 'CURSOR'
- | RegularIdentifier 'CURSOR'
- ;
-
-ShowIndexStatement
- : 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier
- | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier FromOrIn RegularOrBacktickedIdentifier
- ;
-
-ShowIndexStatement_EDIT
- : 'SHOW' OptionallyFormattedIndex
- | 'SHOW' OptionallyFormattedIndex_EDIT
- | 'SHOW' OptionallyFormattedIndex_EDIT 'ON' RegularOrBacktickedIdentifier
- | 'SHOW' OptionallyFormattedIndex_EDIT 'ON' RegularOrBacktickedIdentifier FromOrIn RegularOrBacktickedIdentifier
- | 'SHOW' OptionallyFormattedIndex 'CURSOR'
-   {
-     parser.suggestKeywords(['ON']);
-   }
- | 'SHOW' OptionallyFormattedIndex 'ON' 'CURSOR'
-   {
-     parser.suggestTables();
-   }
- | 'SHOW' OptionallyFormattedIndex 'CURSOR' RegularOrBacktickedIdentifier
-   {
-     parser.suggestKeywords(['ON']);
-   }
- | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM', 'IN']);
-   }
- | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier 'CURSOR' RegularOrBacktickedIdentifier
-   {
-     parser.suggestKeywords(['FROM', 'IN']);
-   }
- | 'SHOW' OptionallyFormattedIndex 'ON' RegularOrBacktickedIdentifier FromOrIn 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- | 'SHOW' OptionallyFormattedIndex 'ON' 'CURSOR' FromOrIn RegularOrBacktickedIdentifier
-   {
-     parser.suggestTables({identifierChain: [{name: $6}]});
-   }
- ;
-
-ShowLocksStatement
- : 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName 'EXTENDED'
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName PartitionSpec
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName PartitionSpec 'EXTENDED'
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'LOCKS' DatabaseOrSchema RegularOrBacktickedIdentifier
- ;
-
-ShowLocksStatement_EDIT
- : 'SHOW' 'LOCKS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-     parser.suggestKeywords(['DATABASE', 'SCHEMA']);
-   }
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName 'CURSOR'
-    {
-      parser.addTablePrimary($3);
-      parser.suggestKeywords(['EXTENDED', 'PARTITION']);
-    }
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT 'EXTENDED'
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT PartitionSpec
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName PartitionSpec 'CURSOR'
-   {
-     parser.addTablePrimary($3);
-     parser.suggestKeywords(['EXTENDED']);
-   }
- | 'SHOW' 'LOCKS' RegularOrBackTickedSchemaQualifiedName_EDIT PartitionSpec 'EXTENDED'
- | 'SHOW' 'LOCKS' DatabaseOrSchema 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- ;
-
-ShowPartitionsStatement
- : 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName PartitionSpec
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-ShowPartitionsStatement_EDIT
- : 'SHOW' 'PARTITIONS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT
- | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName 'CURSOR'
-   {
-     parser.addTablePrimary($3);
-     parser.suggestKeywords(['PARTITION']);
-   }
- | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT PartitionSpec
- ;
-
-ShowRoleStatement
- : 'SHOW' 'ROLE' 'GRANT' RoleOrUser RegularIdentifier
- ;
-
-ShowRoleStatement_EDIT
- : 'SHOW' 'ROLE' 'CURSOR'
-   {
-     parser.suggestKeywords(['GRANT']);
-   }
- | 'SHOW' 'ROLE' 'CURSOR' RoleOrUser RegularIdentifier
-   {
-     parser.suggestKeywords(['GRANT']);
-   }
- | 'SHOW' 'ROLE' 'GRANT' 'CURSOR'
-   {
-     parser.suggestKeywords(['ROLE', 'USER']);
-   }
- | 'SHOW' 'ROLE' 'GRANT' 'CURSOR' RegularIdentifier
-   {
-     parser.suggestKeywords(['ROLE', 'USER']);
-   }
- ;
-
-ShowRolesStatement
- : 'SHOW' 'ROLES'
- ;
-
-ShowTableStatement
- : 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue PartitionSpec
- ;
-
-ShowTableStatement_EDIT
- : 'SHOW' 'TABLE' 'CURSOR'
-   {
-     parser.suggestKeywords(['EXTENDED']);
-   }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase_EDIT
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'CURSOR'
-    {
-      if ($4) {
-        parser.suggestKeywords(['LIKE']);
-      } else {
-        parser.suggestKeywords(['FROM', 'IN', 'LIKE']);
-      }
-    }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase_EDIT 'LIKE' SingleQuotedValue
- | 'SHOW' 'TABLE' 'CURSOR' OptionalFromDatabase 'LIKE' SingleQuotedValue
-    {
-      parser.suggestKeywords(['EXTENDED']);
-    }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'CURSOR' SingleQuotedValue
-    {
-      parser.suggestKeywords(['LIKE']);
-    }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue 'CURSOR'
-    {
-      parser.suggestKeywords(['PARTITION']);
-    }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase_EDIT 'LIKE' SingleQuotedValue PartitionSpec
- | 'SHOW' 'TABLE' 'CURSOR' OptionalFromDatabase 'LIKE' SingleQuotedValue PartitionSpec
-   {
-     parser.suggestKeywords(['EXTENDED']);
-   }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'CURSOR' SingleQuotedValue PartitionSpec
-   {
-     parser.suggestKeywords(['LIKE']);
-   }
- | 'SHOW' 'TABLE' 'EXTENDED' OptionalFromDatabase 'LIKE' SingleQuotedValue 'CURSOR' PartitionSpecList
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- ;
-
-ShowTablesStatement
- : 'SHOW' 'TABLES' OptionalInDatabase
- | 'SHOW' 'TABLES' OptionalInDatabase SingleQuotedValue
- | 'SHOW' 'TABLES' OptionalInDatabase 'LIKE' SingleQuotedValue
- ;
-
-ShowTablesStatement_EDIT
- : 'SHOW' 'TABLES' OptionalInDatabase 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IN', 'LIKE']);
-     } else {
-       parser.suggestKeywords(['LIKE']);
-     }
-   }
- ;
-
-ShowTblPropertiesStatement
- : 'SHOW' 'TBLPROPERTIES' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'TBLPROPERTIES' RegularOrBackTickedSchemaQualifiedName '(' QuotedValue ')'
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-ShowTblPropertiesStatement_EDIT
- : 'SHOW' 'TBLPROPERTIES' RegularOrBackTickedSchemaQualifiedName_EDIT
- | 'SHOW' 'TBLPROPERTIES' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ prependDot: true });
-   }
- ;
-
-ShowTransactionsStatement
- : 'SHOW' 'TRANSACTIONS'
- ;
-
-ShowViewsStatement
- : 'SHOW' 'VIEWS' OptionalInOrFromDatabase OptionalLike
- ;
-
-ShowViewsStatement_EDIT
- : 'SHOW' 'VIEWS' OptionalInOrFromDatabase OptionalLike 'CURSOR'
-   {
-     if (!$4 && !$3) {
-       parser.suggestKeywords([{ value: 'IN', weight: 2 }, { value: 'FROM', weight: 2 }, { value: 'LIKE', weight: 1 }]);
-     } else if (!$4) {
-       parser.suggestKeywords(['LIKE']);
-     }
-   }
- | 'SHOW' 'VIEWS' InOrFromDatabase_EDIT OptionalLike
- | 'SHOW' 'VIEWS' OptionalInOrFromDatabase Like_EDIT
- ;
-
-OptionalInOrFromDatabase
- :
- | 'IN' RegularOrBacktickedIdentifier
-   {
-     parser.addDatabaseLocation(@2, [ { name: $2 } ]);
-   }
- | 'FROM' RegularOrBacktickedIdentifier
-   {
-     parser.addDatabaseLocation(@2, [ { name: $2 } ]);
-   }
- ;
-
-InOrFromDatabase_EDIT
- : 'IN' 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- | 'FROM' 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- ;
-
-OptionalLike
- :
- | 'LIKE' SingleQuotedValue
- ;
-
-Like_EDIT
- : 'LIKE' 'CURSOR'
- ;

+ 96 - 28
desktop/core/src/desktop/js/parse/jison/sql/hive/structure.json

@@ -2,22 +2,47 @@
   "lexer": "sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
+    "abort/abort_transactions.jison",
     "common/sql_table_constraint.jison",
-    "alter/sql_alter.jison",
-    "alter/sql_alter_materialized_view.jison",
-    "sql_analyze.jison",
-    "sql_create.jison",
-    "drop/sql_drop.jison",
-    "drop/sql_drop_materialized_view.jison",
-    "sql_error.jison",
-    "sql_grant.jison",
-    "sql_insert.jison",
-    "sql_load.jison",
-    "sql_main.jison",
-    "sql_msck.jison",
-    "sql_set.jison",
-    "show/sql_show.jison",
-    "show/sql_show_materialized_views.jison",
+    "alter/alter_common.jison",
+    "alter/alter_database.jison",
+    "alter/alter_index.jison",
+    "alter/alter_materialized_view.jison",
+    "alter/alter_table.jison",
+    "alter/alter_view.jison",
+    "delete/delete.jison",
+    "drop/drop_common.jison",
+    "drop/drop_database.jison",
+    "drop/drop_function.jison",
+    "drop/drop_index.jison",
+    "drop/drop_materialized_view.jison",
+    "drop/drop_role.jison",
+    "drop/drop_table.jison",
+    "drop/drop_temporary_function.jison",
+    "drop/drop_temporary_macro.jison",
+    "drop/drop_view.jison",
+    "reload/reload.jison",
+    "show/show_columns.jison",
+    "show/show_common.jison",
+    "show/show_compactions.jison",
+    "show/show_conf.jison",
+    "show/show_create_table.jison",
+    "show/show_current_roles.jison",
+    "show/show_databases.jison",
+    "show/show_functions.jison",
+    "show/show_grant.jison",
+    "show/show_index.jison",
+    "show/show_locks.jison",
+    "show/show_materialized_views.jison",
+    "show/show_partitions.jison",
+    "show/show_role.jison",
+    "show/show_roles.jison",
+    "show/show_table.jison",
+    "show/show_tables.jison",
+    "show/show_tblproperties.jison",
+    "show/show_transactions.jison",
+    "show/show_views.jison",
+    "truncate/truncate_table.jison",
     "../generic/udf/aggregate/aggregate_common.jison",
     "../generic/udf/aggregate/avg.jison",
     "../generic/udf/aggregate/count.jison",
@@ -39,28 +64,63 @@
     "udf/sql_aggregate.jison",
     "udf/sql_arbitrary.jison",
     "udf/sql_extract.jison",
-    "sql_update.jison",
     "../generic/use/use.jison",
     "../generic/sql_valueExpression.jison",
-    "../generic/autocomplete_footer.jison"
-  ],
-  "syntax": [
-    "../generic/syntax_header.jison",
-    "common/sql_table_constraint.jison",
-    "alter/sql_alter.jison",
-    "alter/sql_alter_materialized_view.jison",
     "sql_analyze.jison",
     "sql_create.jison",
-    "drop/sql_drop.jison",
-    "drop/sql_drop_materialized_view.jison",
+    "sql_error.jison",
     "sql_grant.jison",
     "sql_insert.jison",
     "sql_load.jison",
     "sql_main.jison",
     "sql_msck.jison",
     "sql_set.jison",
-    "show/sql_show.jison",
-    "show/sql_show_materialized_views.jison",
+    "sql_update.jison",
+    "../generic/autocomplete_footer.jison"
+  ],
+  "syntax": [
+    "../generic/syntax_header.jison",
+    "abort/abort_transactions.jison",
+    "common/sql_table_constraint.jison",
+    "alter/alter_common.jison",
+    "alter/alter_database.jison",
+    "alter/alter_index.jison",
+    "alter/alter_materialized_view.jison",
+    "alter/alter_table.jison",
+    "alter/alter_view.jison",
+    "delete/delete.jison",
+    "drop/drop_common.jison",
+    "drop/drop_database.jison",
+    "drop/drop_function.jison",
+    "drop/drop_index.jison",
+    "drop/drop_materialized_view.jison",
+    "drop/drop_role.jison",
+    "drop/drop_table.jison",
+    "drop/drop_temporary_function.jison",
+    "drop/drop_temporary_macro.jison",
+    "drop/drop_view.jison",
+    "reload/reload.jison",
+    "show/show_columns.jison",
+    "show/show_common.jison",
+    "show/show_compactions.jison",
+    "show/show_conf.jison",
+    "show/show_create_table.jison",
+    "show/show_current_roles.jison",
+    "show/show_databases.jison",
+    "show/show_functions.jison",
+    "show/show_grant.jison",
+    "show/show_index.jison",
+    "show/show_locks.jison",
+    "show/show_materialized_views.jison",
+    "show/show_partitions.jison",
+    "show/show_role.jison",
+    "show/show_roles.jison",
+    "show/show_table.jison",
+    "show/show_tables.jison",
+    "show/show_tblproperties.jison",
+    "show/show_transactions.jison",
+    "show/show_views.jison",
+    "truncate/truncate_table.jison",
     "../generic/udf/aggregate/aggregate_common.jison",
     "../generic/udf/aggregate/avg.jison",
     "../generic/udf/aggregate/count.jison",
@@ -82,9 +142,17 @@
     "udf/sql_aggregate.jison",
     "udf/sql_arbitrary.jison",
     "udf/sql_extract.jison",
-    "sql_update.jison",
     "../generic/use/use.jison",
     "../generic/sql_valueExpression.jison",
+    "sql_analyze.jison",
+    "sql_create.jison",
+    "sql_grant.jison",
+    "sql_insert.jison",
+    "sql_load.jison",
+    "sql_main.jison",
+    "sql_msck.jison",
+    "sql_set.jison",
+    "sql_update.jison",
     "../generic/syntax_footer.jison"
   ]
 }

+ 58 - 0
desktop/core/src/desktop/js/parse/jison/sql/hive/truncate/truncate_table.jison

@@ -0,0 +1,58 @@
+// 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
+ : TruncateTableStatement
+ ;
+
+DataDefinition_EDIT
+ : TruncateTableStatement_EDIT
+ ;
+
+TruncateTableStatement
+ : 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+TruncateTableStatement_EDIT
+ : 'TRUNCATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['TABLE']);
+   }
+ | 'TRUNCATE' 'TABLE' 'CURSOR' OptionalPartitionSpec
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+   {
+     parser.addTablePrimary($3);
+     if (!$4) {
+       parser.suggestKeywords(['PARTITION']);
+     }
+   }
+ | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
+   {
+     parser.addTablePrimary($3);
+   }
+ | 'TRUNCATE' 'TABLE' 'CURSOR' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+   {
+     parser.addTablePrimary($4);
+   }
+ ;

+ 96 - 22
desktop/core/src/desktop/js/parse/jison/sql/presto/structure.json

@@ -2,19 +2,47 @@
   "lexer": "sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
+    "../hive/abort/abort_transactions.jison",
     "common/table_constraint.jison",
-    "../hive/alter/sql_alter.jison",
-    "sql_analyze.jison",
-    "sql_create.jison",
-    "../hive/drop/sql_drop.jison",
-    "../hive/sql_error.jison",
-    "../hive/sql_grant.jison",
-    "../hive/sql_insert.jison",
-    "sql_load.jison",
-    "sql_main.jison",
-    "sql_msck.jison",
-    "../hive/sql_set.jison",
-    "../hive/show/sql_show.jison",
+    "../hive/alter/alter_common.jison",
+    "../hive/alter/alter_database.jison",
+    "../hive/alter/alter_index.jison",
+    "../hive/alter/alter_materialized_view.jison",
+    "../hive/alter/alter_table.jison",
+    "../hive/alter/alter_view.jison",
+    "../hive/delete/delete.jison",
+    "../hive/drop/drop_common.jison",
+    "../hive/drop/drop_database.jison",
+    "../hive/drop/drop_function.jison",
+    "../hive/drop/drop_index.jison",
+    "../hive/drop/drop_materialized_view.jison",
+    "../hive/drop/drop_role.jison",
+    "../hive/drop/drop_table.jison",
+    "../hive/drop/drop_temporary_function.jison",
+    "../hive/drop/drop_temporary_macro.jison",
+    "../hive/drop/drop_view.jison",
+    "../hive/reload/reload.jison",
+    "../hive/show/show_columns.jison",
+    "../hive/show/show_common.jison",
+    "../hive/show/show_compactions.jison",
+    "../hive/show/show_conf.jison",
+    "../hive/show/show_create_table.jison",
+    "../hive/show/show_current_roles.jison",
+    "../hive/show/show_databases.jison",
+    "../hive/show/show_functions.jison",
+    "../hive/show/show_grant.jison",
+    "../hive/show/show_index.jison",
+    "../hive/show/show_locks.jison",
+    "../hive/show/show_materialized_views.jison",
+    "../hive/show/show_partitions.jison",
+    "../hive/show/show_role.jison",
+    "../hive/show/show_roles.jison",
+    "../hive/show/show_table.jison",
+    "../hive/show/show_tables.jison",
+    "../hive/show/show_tblproperties.jison",
+    "../hive/show/show_transactions.jison",
+    "../hive/show/show_views.jison",
+    "../hive/truncate/truncate_table.jison",
     "../generic/udf/aggregate/aggregate_common.jison",
     "../generic/udf/aggregate/avg.jison",
     "../generic/udf/aggregate/count.jison",
@@ -36,25 +64,63 @@
     "../hive/udf/sql_aggregate.jison",
     "../hive/udf/sql_arbitrary.jison",
     "../hive/udf/sql_extract.jison",
-    "../hive/sql_update.jison",
     "../generic/use/use.jison",
     "../generic/sql_valueExpression.jison",
-    "../generic/autocomplete_footer.jison"
-  ],
-  "syntax": [
-    "../generic/syntax_header.jison",
-    "common/table_constraint.jison",
-    "../hive/alter/sql_alter.jison",
     "sql_analyze.jison",
     "sql_create.jison",
-    "../hive/drop/sql_drop.jison",
+    "../hive/sql_error.jison",
     "../hive/sql_grant.jison",
     "../hive/sql_insert.jison",
     "sql_load.jison",
     "sql_main.jison",
     "sql_msck.jison",
     "../hive/sql_set.jison",
-    "../hive/show/sql_show.jison",
+    "../hive/sql_update.jison",
+    "../generic/autocomplete_footer.jison"
+  ],
+  "syntax": [
+    "../generic/syntax_header.jison",
+    "../hive/abort/abort_transactions.jison",
+    "common/table_constraint.jison",
+    "../hive/alter/alter_common.jison",
+    "../hive/alter/alter_database.jison",
+    "../hive/alter/alter_index.jison",
+    "../hive/alter/alter_materialized_view.jison",
+    "../hive/alter/alter_table.jison",
+    "../hive/alter/alter_view.jison",
+    "../hive/delete/delete.jison",
+    "../hive/drop/drop_common.jison",
+    "../hive/drop/drop_database.jison",
+    "../hive/drop/drop_function.jison",
+    "../hive/drop/drop_index.jison",
+    "../hive/drop/drop_materialized_view.jison",
+    "../hive/drop/drop_role.jison",
+    "../hive/drop/drop_table.jison",
+    "../hive/drop/drop_temporary_function.jison",
+    "../hive/drop/drop_temporary_macro.jison",
+    "../hive/drop/drop_view.jison",
+    "../hive/reload/reload.jison",
+    "../hive/show/show_columns.jison",
+    "../hive/show/show_common.jison",
+    "../hive/show/show_compactions.jison",
+    "../hive/show/show_conf.jison",
+    "../hive/show/show_create_table.jison",
+    "../hive/show/show_current_roles.jison",
+    "../hive/show/show_databases.jison",
+    "../hive/show/show_functions.jison",
+    "../hive/show/show_grant.jison",
+    "../hive/show/show_index.jison",
+    "../hive/show/show_locks.jison",
+    "../hive/show/show_materialized_views.jison",
+    "../hive/show/show_partitions.jison",
+    "../hive/show/show_role.jison",
+    "../hive/show/show_roles.jison",
+    "../hive/show/show_table.jison",
+    "../hive/show/show_tables.jison",
+    "../hive/show/show_tblproperties.jison",
+    "../hive/show/show_transactions.jison",
+    "../hive/show/show_views.jison",
+    "../hive/truncate/truncate_table.jison",
     "../generic/udf/aggregate/aggregate_common.jison",
     "../generic/udf/aggregate/avg.jison",
     "../generic/udf/aggregate/count.jison",
@@ -76,9 +142,17 @@
     "../hive/udf/sql_aggregate.jison",
     "../hive/udf/sql_arbitrary.jison",
     "../hive/udf/sql_extract.jison",
-    "../hive/sql_update.jison",
     "../generic/use/use.jison",
     "../generic/sql_valueExpression.jison",
+    "sql_analyze.jison",
+    "sql_create.jison",
+    "../hive/sql_grant.jison",
+    "../hive/sql_insert.jison",
+    "sql_load.jison",
+    "sql_main.jison",
+    "sql_msck.jison",
+    "../hive/sql_set.jison",
+    "../hive/sql_update.jison",
     "../generic/syntax_footer.jison"
   ]
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/hive/hiveAutocompleteParser.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/hive/hiveSyntaxParser.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/presto/prestoAutocompleteParser.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/presto/prestoSyntaxParser.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác