فهرست منبع

HUE-9429 [editor] Split ALTER, CREATE and DROP into parts for the generic parser

Johan Ahlen 5 سال پیش
والد
کامیت
c8030b46d6
34فایلهای تغییر یافته به همراه767 افزوده شده و 451 حذف شده
  1. 28 6
      desktop/core/src/desktop/js/parse/jison/sql/calcite/structure.json
  2. 30 8
      desktop/core/src/desktop/js/parse/jison/sql/druid/structure.json
  3. 30 8
      desktop/core/src/desktop/js/parse/jison/sql/elasticsearch/structure.json
  4. 30 8
      desktop/core/src/desktop/js/parse/jison/sql/flink/structure.json
  5. 37 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/alter/alter_statement.jison
  6. 47 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/alter/alter_table.jison
  7. 0 54
      desktop/core/src/desktop/js/parse/jison/sql/generic/alter/alter_view.jison
  8. 61 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_database.jison
  9. 19 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_role.jison
  10. 60 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_statement.jison
  11. 0 161
      desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_table.jison
  12. 81 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_view.jison
  13. 42 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_database.jison
  14. 19 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_role.jison
  15. 42 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_statement.jison
  16. 55 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_table.jison
  17. 51 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_view.jison
  18. 51 0
      desktop/core/src/desktop/js/parse/jison/sql/generic/drop/truncate_table.jison
  19. 0 184
      desktop/core/src/desktop/js/parse/jison/sql/generic/sql_drop.jison
  20. 30 8
      desktop/core/src/desktop/js/parse/jison/sql/generic/structure.json
  21. 24 6
      desktop/core/src/desktop/js/parse/jison/sql/ksql/structure.json
  22. 30 8
      desktop/core/src/desktop/js/parse/jison/sql/phoenix/structure.json
  23. 0 0
      desktop/core/src/desktop/js/parse/sql/druid/druidAutocompleteParser.js
  24. 0 0
      desktop/core/src/desktop/js/parse/sql/druid/druidSyntaxParser.js
  25. 0 0
      desktop/core/src/desktop/js/parse/sql/elasticsearch/elasticsearchAutocompleteParser.js
  26. 0 0
      desktop/core/src/desktop/js/parse/sql/elasticsearch/elasticsearchSyntaxParser.js
  27. 0 0
      desktop/core/src/desktop/js/parse/sql/flink/flinkAutocompleteParser.js
  28. 0 0
      desktop/core/src/desktop/js/parse/sql/flink/flinkSyntaxParser.js
  29. 0 0
      desktop/core/src/desktop/js/parse/sql/generic/genericAutocompleteParser.js
  30. 0 0
      desktop/core/src/desktop/js/parse/sql/generic/genericSyntaxParser.js
  31. 0 0
      desktop/core/src/desktop/js/parse/sql/ksql/ksqlAutocompleteParser.js
  32. 0 0
      desktop/core/src/desktop/js/parse/sql/ksql/ksqlSyntaxParser.js
  33. 0 0
      desktop/core/src/desktop/js/parse/sql/phoenix/phoenixAutocompleteParser.js
  34. 0 0
      desktop/core/src/desktop/js/parse/sql/phoenix/phoenixSyntaxParser.js

+ 28 - 6
desktop/core/src/desktop/js/parse/jison/sql/calcite/structure.json

@@ -2,9 +2,20 @@
   "lexer": "../generic/sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_error.jison",
     "../generic/sql_insert.jison",
     "sql_main.jison",
@@ -18,9 +29,20 @@
   ],
   "syntax": [
     "../generic/syntax_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_insert.jison",
     "sql_main.jison",
     "../generic/sql_set.jison",

+ 30 - 8
desktop/core/src/desktop/js/parse/jison/sql/druid/structure.json

@@ -2,12 +2,24 @@
   "lexer": "../generic/sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_error.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -16,7 +28,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",
@@ -28,11 +39,23 @@
   ],
   "syntax": [
     "../generic/syntax_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -41,7 +64,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",

+ 30 - 8
desktop/core/src/desktop/js/parse/jison/sql/elasticsearch/structure.json

@@ -2,12 +2,24 @@
   "lexer": "../generic/sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_error.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -16,7 +28,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",
@@ -28,11 +39,23 @@
   ],
   "syntax": [
     "../generic/syntax_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -41,7 +64,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",

+ 30 - 8
desktop/core/src/desktop/js/parse/jison/sql/flink/structure.json

@@ -2,12 +2,24 @@
   "lexer": "../generic/sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_error.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -16,7 +28,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",
@@ -28,11 +39,23 @@
   ],
   "syntax": [
     "../generic/syntax_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -41,7 +64,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",

+ 37 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/alter/alter_statement.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
+ : AlterStatement
+ ;
+
+DataDefinition_EDIT
+ : AlterStatement_EDIT
+ ;
+
+AlterStatement
+ : AlterTable
+ | AlterView
+ ;
+
+AlterStatement_EDIT
+ : AlterTable_EDIT
+ | AlterView_EDIT
+ | 'ALTER' 'CURSOR'
+   {
+     parser.suggestKeywords(['TABLE', 'VIEW']);
+   }
+ ;

+ 47 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/alter/alter_table.jison

@@ -0,0 +1,47 @@
+// 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.
+
+AlterTable
+ : AlterTableLeftSide PartitionSpec
+ ;
+
+AlterTable_EDIT
+ : AlterTableLeftSide_EDIT
+ | AlterTableLeftSide_EDIT PartitionSpec
+ | AlterTableLeftSide 'CURSOR'
+ | AlterTableLeftSide PartitionSpec 'CURSOR'
+ ;
+
+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 });
+   }
+ ;

+ 0 - 54
desktop/core/src/desktop/js/parse/jison/sql/generic/sql_alter.jison → desktop/core/src/desktop/js/parse/jison/sql/generic/alter/alter_view.jison

@@ -14,60 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-DataDefinition
- : AlterStatement
- ;
-
-DataDefinition_EDIT
- : AlterStatement_EDIT
- ;
-
-AlterStatement
- : AlterTable
- | AlterView
- ;
-
-AlterStatement_EDIT
- : AlterTable_EDIT
- | AlterView_EDIT
- | 'ALTER' 'CURSOR'
-   {
-     parser.suggestKeywords(['TABLE', 'VIEW']);
-   }
- ;
-
-AlterTable
- : AlterTableLeftSide PartitionSpec
- ;
-
-AlterTable_EDIT
- : AlterTableLeftSide_EDIT
- | AlterTableLeftSide_EDIT PartitionSpec
- | AlterTableLeftSide 'CURSOR'
- | AlterTableLeftSide PartitionSpec 'CURSOR'
- ;
-
-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 });
-   }
- ;
-
 AlterView
  : AlterViewLeftSide 'AS' QuerySpecification
  ;

+ 61 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_database.jison

@@ -0,0 +1,61 @@
+// 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.
+
+DatabaseDefinition
+ : 'CREATE' DatabaseOrSchema OptionalIfNotExists
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals
+   {
+     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
+   }
+ ;
+
+DatabaseDefinition_EDIT
+ : 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR' RegularIdentifier
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+     parser.addNewDatabaseLocation(@5, [{ name: $5 }]);
+   }
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT RegularIdentifier
+   {
+     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
+   }
+ | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals 'CURSOR'
+   {
+     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
+   }
+ ;
+
+DatabaseDefinitionOptionals
+ : OptionalComment
+   {
+     if (!$1) {
+       parser.suggestKeywords(['COMMENT']);
+     }
+   }
+ ;
+
+DatabaseDefinitionOptionals_EDIT
+ : OptionalComment_INVALID
+ ;

+ 19 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_role.jison

@@ -0,0 +1,19 @@
+// 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.
+
+RoleDefinition
+ : 'CREATE' 'ROLE' RegularIdentifier
+ ;

+ 60 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_statement.jison

@@ -0,0 +1,60 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+DataDefinition
+ : CreateStatement
+ ;
+
+DataDefinition_EDIT
+ : CreateStatement_EDIT
+ ;
+
+CreateStatement
+ : DatabaseDefinition
+ | TableDefinition
+ | ViewDefinition
+ | RoleDefinition
+ ;
+
+CreateStatement_EDIT
+ : DatabaseDefinition_EDIT
+ | TableDefinition_EDIT
+ | ViewDefinition_EDIT
+ | 'CREATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['DATABASE', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
+   }
+ ;
+
+OptionalComment
+ :
+ | Comment
+ ;
+
+Comment
+ : 'COMMENT' QuotedValue
+ ;
+
+OptionalComment_INVALID
+ : Comment_INVALID
+ ;
+
+Comment_INVALID
+ : 'COMMENT' SINGLE_QUOTE
+ | 'COMMENT' DOUBLE_QUOTE
+ | 'COMMENT' SINGLE_QUOTE VALUE
+ | 'COMMENT' DOUBLE_QUOTE VALUE
+ ;

+ 0 - 161
desktop/core/src/desktop/js/parse/jison/sql/generic/sql_create.jison → desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_table.jison

@@ -14,97 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-DataDefinition
- : CreateStatement
- ;
-
-DataDefinition_EDIT
- : CreateStatement_EDIT
- ;
-
-CreateStatement
- : DatabaseDefinition
- | TableDefinition
- | ViewDefinition
- | RoleDefinition
- ;
-
-CreateStatement_EDIT
- : DatabaseDefinition_EDIT
- | TableDefinition_EDIT
- | ViewDefinition_EDIT
- | 'CREATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['DATABASE', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
-   }
- ;
-
-DatabaseDefinition
- : 'CREATE' DatabaseOrSchema OptionalIfNotExists
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals
-   {
-     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
-   }
- ;
-
-DatabaseDefinition_EDIT
- : 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists 'CURSOR' RegularIdentifier
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.addNewDatabaseLocation(@5, [{ name: $5 }]);
-   }
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists_EDIT RegularIdentifier
-   {
-     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
-   }
- | 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals 'CURSOR'
-   {
-     parser.addNewDatabaseLocation(@4, [{ name: $4 }]);
-   }
- ;
-
-DatabaseDefinitionOptionals
- : OptionalComment
-   {
-     if (!$1) {
-       parser.suggestKeywords(['COMMENT']);
-     }
-   }
- ;
-
-DatabaseDefinitionOptionals_EDIT
- : OptionalComment_INVALID
- ;
-
-OptionalComment
- :
- | Comment
- ;
-
-Comment
- : 'COMMENT' QuotedValue
- ;
-
-OptionalComment_INVALID
- : Comment_INVALID
- ;
-
-Comment_INVALID
- : 'COMMENT' SINGLE_QUOTE
- | 'COMMENT' DOUBLE_QUOTE
- | 'COMMENT' SINGLE_QUOTE VALUE
- | 'COMMENT' DOUBLE_QUOTE VALUE
- ;
-
 TableDefinition
  : 'CREATE' 'TABLE' OptionalIfNotExists TableDefinitionRightPart
  ;
@@ -543,73 +452,3 @@ CommitLocations
      parser.commitLocations();
    }
  ;
-
-ViewDefinition
- : 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
- ;
-
-ViewDefinition_EDIT
- : 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists_EDIT
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedViewColumnList_EDIT OptionalComment
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'CURSOR'
-   {
-     var keywords = [{value: 'AS', weight: 1 }];
-     if (!$6) {
-       keywords.push({ value: 'COMMENT', weight: 3 });
-     }
-     parser.suggestKeywords(keywords);
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification_EDIT
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier_EDIT OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
- ;
-
-OptionalParenthesizedViewColumnList
- :
- | ParenthesizedViewColumnList
- ;
-
-ParenthesizedViewColumnList
- : '(' ViewColumnList ')'
- ;
-
-ParenthesizedViewColumnList_EDIT
- : '(' ViewColumnList_EDIT RightParenthesisOrError
-   {
-     if (!$2) {
-       parser.suggestKeywords(['COMMENT']);
-     }
-   }
- ;
-
-ViewColumnList
- : ColumnReference OptionalComment
- | ViewColumnList ',' ColumnReference OptionalComment
- ;
-
-ViewColumnList_EDIT
- : ColumnReference OptionalComment 'CURSOR'                                        -> $2
- | ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList                     -> $2
- | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR'                     -> $4
- | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList  -> $4
- ;
-
-RoleDefinition
- : 'CREATE' 'ROLE' RegularIdentifier
- ;

+ 81 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/create/create_view.jison

@@ -0,0 +1,81 @@
+// 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.
+
+ViewDefinition
+ : 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
+ ;
+
+ViewDefinition_EDIT
+ : 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR'
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+     parser.suggestDatabases({ appendDot: true });
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
+   {
+     if (!$3) {
+       parser.suggestKeywords(['IF NOT EXISTS']);
+     }
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists_EDIT
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedViewColumnList_EDIT OptionalComment
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'CURSOR'
+   {
+     var keywords = [{value: 'AS', weight: 1 }];
+     if (!$6) {
+       keywords.push({ value: 'COMMENT', weight: 3 });
+     }
+     parser.suggestKeywords(keywords);
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' 'CURSOR'
+   {
+     parser.suggestKeywords(['SELECT']);
+   }
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification_EDIT
+ | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier_EDIT OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
+ ;
+
+OptionalParenthesizedViewColumnList
+ :
+ | ParenthesizedViewColumnList
+ ;
+
+ParenthesizedViewColumnList
+ : '(' ViewColumnList ')'
+ ;
+
+ParenthesizedViewColumnList_EDIT
+ : '(' ViewColumnList_EDIT RightParenthesisOrError
+   {
+     if (!$2) {
+       parser.suggestKeywords(['COMMENT']);
+     }
+   }
+ ;
+
+ViewColumnList
+ : ColumnReference OptionalComment
+ | ViewColumnList ',' ColumnReference OptionalComment
+ ;
+
+ViewColumnList_EDIT
+ : ColumnReference OptionalComment 'CURSOR'                                        -> $2
+ | ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList                     -> $2
+ | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR'                     -> $4
+ | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList  -> $4
+ ;

+ 42 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_database.jison

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

+ 19 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_role.jison

@@ -0,0 +1,19 @@
+// 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.
+
+DropRoleStatement
+ : 'DROP' 'ROLE' RegularIdentifier
+ ;

+ 42 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_statement.jison

@@ -0,0 +1,42 @@
+// 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
+ ;
+
+DataDefinition_EDIT
+ : DropStatement_EDIT
+ ;
+
+DropStatement
+ : DropDatabaseStatement
+ | DropRoleStatement
+ | DropTableStatement
+ | DropViewStatement
+ | TruncateTableStatement
+ ;
+
+DropStatement_EDIT
+ : DropDatabaseStatement_EDIT
+ | DropTableStatement_EDIT
+ | DropViewStatement_EDIT
+ | TruncateTableStatement_EDIT
+ | 'DROP' 'CURSOR'
+   {
+     parser.suggestKeywords(['DATABASE', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
+   }
+ ;

+ 55 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_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.
+
+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'
+ ;

+ 51 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/drop/drop_view.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.
+
+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;
+     }
+   }
+ ;

+ 51 - 0
desktop/core/src/desktop/js/parse/jison/sql/generic/drop/truncate_table.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.
+
+TruncateTableStatement
+ : 'TRUNCATE' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+TruncateTableStatement_EDIT
+ : 'TRUNCATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['TABLE']);
+   }
+ | 'TRUNCATE' 'TABLE' OptionalIfExists 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({ appendDot: true });
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'TRUNCATE' 'TABLE' OptionalIfExists_EDIT
+ | 'TRUNCATE' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT
+ | 'TRUNCATE' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier 'CURSOR'
+   {
+     parser.addTablePrimary($4);
+   }
+ | 'TRUNCATE' 'TABLE' OptionalIfExists 'CURSOR' SchemaQualifiedTableIdentifier
+   {
+     parser.addTablePrimary($4);
+     if (!$3) {
+       parser.suggestKeywords(['IF EXISTS']);
+     }
+   }
+ | 'TRUNCATE' 'TABLE' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ ;

+ 0 - 184
desktop/core/src/desktop/js/parse/jison/sql/generic/sql_drop.jison

@@ -1,184 +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
- ;
-
-DataDefinition_EDIT
- : DropStatement_EDIT
- ;
-
-DropStatement
- : DropDatabaseStatement
- | DropRoleStatement
- | DropTableStatement
- | DropViewStatement
- | TruncateTableStatement
- ;
-
-DropStatement_EDIT
- : DropDatabaseStatement_EDIT
- | DropTableStatement_EDIT
- | DropViewStatement_EDIT
- | TruncateTableStatement_EDIT
- | 'DROP' 'CURSOR'
-   {
-     parser.suggestKeywords(['DATABASE', 'ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
-   }
- ;
-
-DropDatabaseStatement
- : 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier OptionalCascade
- ;
-
-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']);
-   }
- | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT RegularOrBacktickedIdentifier OptionalCascade
- | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR' RegularOrBacktickedIdentifier OptionalCascade
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- ;
-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'
- ;
-
-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' OptionalIfExists SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-TruncateTableStatement_EDIT
- : 'TRUNCATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['TABLE']);
-   }
- | 'TRUNCATE' 'TABLE' OptionalIfExists 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'TRUNCATE' 'TABLE' OptionalIfExists_EDIT
- | 'TRUNCATE' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT
- | 'TRUNCATE' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier 'CURSOR'
-   {
-     parser.addTablePrimary($4);
-   }
- | 'TRUNCATE' 'TABLE' OptionalIfExists 'CURSOR' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($4);
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'TRUNCATE' 'TABLE' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPartitionSpec
- ;

+ 30 - 8
desktop/core/src/desktop/js/parse/jison/sql/generic/structure.json

@@ -2,12 +2,24 @@
   "lexer": "sql.jisonlex",
   "autocomplete": [
     "autocomplete_header.jison",
-    "sql_alter.jison",
-    "sql_create.jison",
-    "sql_drop.jison",
+    "alter/alter_statement.jison",
+    "alter/alter_table.jison",
+    "alter/alter_view.jison",
+    "create/create_statement.jison",
+    "create/create_database.jison",
+    "create/create_role.jison",
+    "create/create_table.jison",
+    "create/create_view.jison",
+    "drop/drop_statement.jison",
+    "drop/drop_database.jison",
+    "drop/drop_role.jison",
+    "drop/drop_table.jison",
+    "drop/drop_view.jison",
+    "drop/truncate_table.jison",
     "sql_error.jison",
     "sql_insert.jison",
     "sql_main.jison",
+    "select/select_statement.jison",
     "select/cte_select_statement.jison",
     "select/from_clause.jison",
     "select/group_by_clause.jison",
@@ -16,7 +28,6 @@
     "select/limit_clause.jison",
     "select/order_by_clause.jison",
     "select/select_conditions.jison",
-    "select/select_statement.jison",
     "select/union_clause.jison",
     "select/where_clause.jison",
     "sql_set.jison",
@@ -28,11 +39,23 @@
   ],
   "syntax": [
     "syntax_header.jison",
-    "sql_alter.jison",
-    "sql_create.jison",
-    "sql_drop.jison",
+    "alter/alter_statement.jison",
+    "alter/alter_table.jison",
+    "alter/alter_view.jison",
+    "create/create_statement.jison",
+    "create/create_database.jison",
+    "create/create_role.jison",
+    "create/create_table.jison",
+    "create/create_view.jison",
+    "drop/drop_statement.jison",
+    "drop/drop_database.jison",
+    "drop/drop_role.jison",
+    "drop/drop_table.jison",
+    "drop/drop_view.jison",
+    "drop/truncate_table.jison",
     "sql_insert.jison",
     "sql_main.jison",
+    "select/select_statement.jison",
     "select/cte_select_statement.jison",
     "select/from_clause.jison",
     "select/group_by_clause.jison",
@@ -41,7 +64,6 @@
     "select/limit_clause.jison",
     "select/order_by_clause.jison",
     "select/select_conditions.jison",
-    "select/select_statement.jison",
     "select/union_clause.jison",
     "select/where_clause.jison",
     "sql_set.jison",

+ 24 - 6
desktop/core/src/desktop/js/parse/jison/sql/ksql/structure.json

@@ -2,12 +2,22 @@
   "lexer": "sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_error.jison",
     "../generic/sql_insert.jison",
     "sql_list.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -16,7 +26,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",
@@ -27,11 +36,21 @@
   ],
   "syntax": [
     "../generic/syntax_header.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_insert.jison",
     "sql_list.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -40,7 +59,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",

+ 30 - 8
desktop/core/src/desktop/js/parse/jison/sql/phoenix/structure.json

@@ -2,12 +2,24 @@
   "lexer": "../generic/sql.jisonlex",
   "autocomplete": [
     "../generic/autocomplete_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_error.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -16,7 +28,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",
@@ -28,11 +39,23 @@
   ],
   "syntax": [
     "../generic/syntax_header.jison",
-    "../generic/sql_alter.jison",
-    "../generic/sql_create.jison",
-    "../generic/sql_drop.jison",
+    "../generic/alter/alter_statement.jison",
+    "../generic/alter/alter_table.jison",
+    "../generic/alter/alter_view.jison",
+    "../generic/create/create_statement.jison",
+    "../generic/create/create_database.jison",
+    "../generic/create/create_role.jison",
+    "../generic/create/create_table.jison",
+    "../generic/create/create_view.jison",
+    "../generic/drop/drop_statement.jison",
+    "../generic/drop/drop_database.jison",
+    "../generic/drop/drop_role.jison",
+    "../generic/drop/drop_table.jison",
+    "../generic/drop/drop_view.jison",
+    "../generic/drop/truncate_table.jison",
     "../generic/sql_insert.jison",
     "../generic/sql_main.jison",
+    "../generic/select/select_statement.jison",
     "../generic/select/cte_select_statement.jison",
     "../generic/select/from_clause.jison",
     "../generic/select/group_by_clause.jison",
@@ -41,7 +64,6 @@
     "../generic/select/limit_clause.jison",
     "../generic/select/order_by_clause.jison",
     "../generic/select/select_conditions.jison",
-    "../generic/select/select_statement.jison",
     "../generic/select/union_clause.jison",
     "../generic/select/where_clause.jison",
     "../generic/sql_set.jison",

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


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


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


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


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


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


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


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


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


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


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


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


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