Эх сурвалжийг харах

HUE-9429 [editor] Extract SHOW and UPDATE into separate grammar files for Impala

Johan Ahlen 5 жил өмнө
parent
commit
157385d93b
20 өөрчлөгдсөн 662 нэмэгдсэн , 376 устгасан
  1. 45 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_column_stats.jison
  2. 31 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_common.jison
  3. 64 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_create_table.jison
  4. 38 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_current_roles.jison
  5. 35 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_databases.jison
  6. 58 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_files.jison
  7. 63 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_functions.jison
  8. 63 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_grant.jison
  9. 41 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_partitions.jison
  10. 41 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_range_partitions.jison
  11. 42 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_role.jison
  12. 23 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_roles.jison
  13. 45 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_table_stats.jison
  14. 40 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_tables.jison
  15. 0 372
      desktop/core/src/desktop/js/parse/jison/sql/impala/sql_show.jison
  16. 30 4
      desktop/core/src/desktop/js/parse/jison/sql/impala/structure.json
  17. 0 0
      desktop/core/src/desktop/js/parse/jison/sql/impala/update/update.jison
  18. 0 0
      desktop/core/src/desktop/js/parse/sql/impala/impalaAutocompleteParser.js
  19. 0 0
      desktop/core/src/desktop/js/parse/sql/impala/impalaSyntaxParser.js
  20. 3 0
      desktop/core/src/desktop/js/parse/sql/impala/sqlParseSupport.js

+ 45 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_column_stats.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
+ : ShowColumnStatsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowColumnStatsStatement_EDIT
+ ;
+
+ShowColumnStatsStatement
+ : 'SHOW' 'COLUMN' 'STATS' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+ShowColumnStatsStatement_EDIT
+ : 'SHOW' 'COLUMN' 'CURSOR'
+   {
+     parser.suggestKeywords(['STATS']);
+   }
+ | 'SHOW' 'COLUMN' 'STATS' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'COLUMN' 'STATS' RegularOrBackTickedSchemaQualifiedName_EDIT
+ ;

+ 31 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_common.jison

@@ -0,0 +1,31 @@
+// 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(parser.SHOW_KEYWORDS);
+   }
+ | 'SHOW' 'CURSOR' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($3);
+     parser.suggestKeywords(parser.SHOW_IDENTIFIER_KEYWORDS);
+   }
+ | 'SHOW' 'CURSOR' 'LIKE' SingleQuotedValue
+   {
+     parser.suggestKeywords(parser.SHOW_LIKE_KEYWORDS);
+   }
+ ;

+ 64 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_create_table.jison

@@ -0,0 +1,64 @@
+// 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' TableOrView RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+ShowCreateTableStatement_EDIT
+ : 'SHOW' 'CREATE' 'CURSOR'
+   {
+     parser.suggestKeywords(['TABLE', 'VIEW']);
+   }
+ | 'SHOW' 'CREATE' TableOrView 'CURSOR'
+   {
+     if ($3.isView) {
+       parser.suggestTables({ onlyViews: true });
+     } else {
+       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', 'VIEW']);
+   }
+ ;
+
+TableOrView
+ : 'TABLE'
+ | 'VIEW'   -> { isView: true }
+ ;

+ 38 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_current_roles.jison

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

+ 35 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_databases.jison

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

+ 58 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_files.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
+ : ShowFilesStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowFilesStatement_EDIT
+ ;
+
+ShowFilesStatement
+ : 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+ShowFilesStatement_EDIT
+ : 'SHOW' 'FILES' 'CURSOR'
+   {
+     parser.suggestKeywords(['IN']);
+   }
+ | 'SHOW' 'FILES' 'IN' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName_EDIT OptionalPartitionSpec
+ | 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec 'CURSOR'
+   {
+     parser.addTablePrimary($4);
+     if (!$5) {
+       parser.suggestKeywords(['PARTITION']);
+     }
+   }
+ | 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec_EDIT
+ | 'SHOW' 'FILES' 'CURSOR' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec
+   {
+     parser.addTablePrimary($4);
+     parser.suggestKeywords(['IN']);
+   }
+ ;

+ 63 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_functions.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
+ : ShowFunctionsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowFunctionsStatement_EDIT
+ ;
+
+ShowFunctionsStatement
+ : 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase
+ | 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase 'LIKE' QuotedValue
+ ;
+
+ShowFunctionsStatement_EDIT
+ : 'SHOW' AggregateOrAnalytic 'CURSOR'
+   {
+     parser.suggestKeywords(['FUNCTIONS']);
+   }
+ | 'SHOW' 'CURSOR' 'FUNCTIONS' OptionalInDatabase
+   {
+     parser.suggestKeywords(['AGGREGATE', 'ANALYTICAL']);
+   }
+ | 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase 'CURSOR'
+   {
+     if (!$4) {
+       parser.suggestKeywords(['IN', 'LIKE']);
+     } else {
+       parser.suggestKeywords(['LIKE']);
+     }
+   }
+ | 'SHOW' AggregateOrAnalytic 'CURSOR' OptionalInDatabase 'LIKE' QuotedValue
+   {
+     parser.suggestKeywords(['FUNCTIONS']);
+   }
+ | 'SHOW' 'CURSOR' 'FUNCTIONS' OptionalInDatabase 'LIKE' QuotedValue
+   {
+     parser.suggestKeywords(['AGGREGATE', 'ANALYTICAL']);
+   }
+ | 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase 'CURSOR' QuotedValue
+   {
+     if (!$4) {
+       parser.suggestKeywords([{ value: 'IN', weight: 2 }, { value: 'LIKE', weight: 1 }]);
+     } else {
+       parser.suggestKeywords(['LIKE']);
+     }
+   }
+ ;

+ 63 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/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' GroupRoleOrUser RegularOrBacktickedIdentifier
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'DATABASE' RegularOrBacktickedIdentifier
+   {
+     parser.addDatabaseLocation(@7, [ { name: $7 } ]);
+   }
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'SERVER'
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'TABLE' SchemaQualifiedTableIdentifier
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'URI' RegularOrBacktickedIdentifier
+ ;
+
+ShowGrantStatement_EDIT
+ : 'SHOW' 'GRANT' 'CURSOR'
+   {
+     parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
+   }
+ | 'SHOW' 'GRANT' GroupRoleOrUser 'CURSOR'
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'CURSOR'
+   {
+     parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
+   }
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'CURSOR'
+   {
+     parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
+   }
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'DATABASE' 'CURSOR'
+   {
+     parser.suggestDatabases();
+   }
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'TABLE' 'CURSOR'
+   {
+     parser.suggestDatabases({
+       appendDot: true
+     });
+     parser.suggestTables();
+   }
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'TABLE' SchemaQualifiedTableIdentifier_EDIT
+ | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'URI' 'CURSOR'
+ ;

+ 41 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_partitions.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
+ : ShowPartitionsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowPartitionsStatement_EDIT
+ ;
+
+ShowPartitionsStatement
+ : 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+ShowPartitionsStatement_EDIT
+ : 'SHOW' 'PARTITIONS' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT
+ ;

+ 41 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_range_partitions.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
+ : ShowRangePartitionsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowRangePartitionsStatement_EDIT
+ ;
+
+ShowRangePartitionsStatement
+ : 'SHOW' 'RANGE' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($3);
+   }
+ ;
+
+ShowRangePartitionsStatement_EDIT
+ : 'SHOW' 'RANGE' 'PARTITIONS' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'RANGE' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT
+ ;

+ 42 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_role.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
+ : ShowRoleStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowRoleStatement_EDIT
+ ;
+
+ShowRoleStatement
+ : 'SHOW' 'ROLE' 'GRANT' 'GROUP' RegularIdentifier
+ ;
+
+ShowRoleStatement_EDIT
+ : 'SHOW' 'ROLE' 'CURSOR'
+   {
+     parser.suggestKeywords(['GRANT']);
+   }
+ | 'SHOW' 'ROLE' 'GRANT' 'CURSOR'
+   {
+     parser.suggestKeywords(['GROUP']);
+   }
+ | 'SHOW' 'ROLE' 'GRANT' 'CURSOR' RegularIdentifier
+   {
+     parser.suggestKeywords(['GROUP']);
+   }
+ ;

+ 23 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/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'
+ ;

+ 45 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/show/show_table_stats.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
+ : ShowTableStatsStatement
+ ;
+
+DataDefinition_EDIT
+ : ShowTableStatsStatement_EDIT
+ ;
+
+ShowTableStatsStatement
+ : 'SHOW' 'TABLE' 'STATS' RegularOrBackTickedSchemaQualifiedName
+   {
+     parser.addTablePrimary($4);
+   }
+ ;
+
+ShowTableStatsStatement_EDIT
+ : 'SHOW' 'TABLE' 'CURSOR'
+   {
+     parser.suggestKeywords(['STATS']);
+   }
+ | 'SHOW' 'TABLE' 'STATS' 'CURSOR'
+   {
+     parser.suggestTables();
+     parser.suggestDatabases({
+       appendDot: true
+     });
+   }
+ | 'SHOW' 'TABLE' 'STATS' RegularOrBackTickedSchemaQualifiedName_EDIT
+ ;

+ 40 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/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']);
+     }
+   }
+ ;

+ 0 - 372
desktop/core/src/desktop/js/parse/jison/sql/impala/sql_show.jison

@@ -1,372 +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
- : ShowColumnStatsStatement
- | ShowCreateTableStatement
- | ShowCurrentRolesStatement
- | ShowDatabasesStatement
- | ShowFilesStatement
- | ShowFunctionsStatement
- | ShowGrantStatement
- | ShowPartitionsStatement
- | ShowRoleStatement
- | ShowRolesStatement
- | ShowTableStatsStatement
- | ShowTablesStatement
- ;
-
-ShowStatement_EDIT
- : 'SHOW' 'CURSOR'
-   {
-     parser.suggestKeywords(['AGGREGATE FUNCTIONS', 'ANALYTIC FUNCTIONS', 'COLUMN STATS', 'CREATE TABLE', 'CURRENT ROLES', 'CREATE VIEW', 'DATABASES', 'FILES IN', 'FUNCTIONS', 'GRANT ROLE', 'GRANT USER', 'PARTITIONS', 'RANGE PARTITIONS', 'ROLE GRANT GROUP', 'ROLES', 'SCHEMAS', 'TABLE STATS', 'TABLES']);
-   }
- | 'SHOW' 'CURSOR' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($3);
-     parser.suggestKeywords(['COLUMN STATS', 'CREATE TABLE', 'CREATE VIEW', 'FILES IN', 'PARTITIONS', 'RANGE PARTITIONS', 'TABLE STATS']);
-   }
- | 'SHOW' 'CURSOR' 'LIKE' SingleQuotedValue
-   {
-     parser.suggestKeywords(['AGGREGATE FUNCTIONS', 'ANALYTIC FUNCTIONS', 'DATABASES', 'FUNCTIONS', 'SCHEMAS', 'TABLES']);
-   }
- | ShowColumnStatsStatement_EDIT
- | ShowCreateTableStatement_EDIT
- | ShowCurrentRolesStatement_EDIT
- | ShowDatabasesStatement_EDIT
- | ShowFilesStatement_EDIT
- | ShowFunctionsStatement_EDIT
- | ShowGrantStatement_EDIT
- | ShowPartitionsStatement_EDIT
- | ShowRoleStatement_EDIT
- | ShowTableStatsStatement_EDIT
- | ShowTablesStatement_EDIT
- ;
-
-ShowColumnStatsStatement
- : 'SHOW' 'COLUMN' 'STATS' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-ShowColumnStatsStatement_EDIT
- : 'SHOW' 'COLUMN' 'CURSOR'
-   {
-     parser.suggestKeywords(['STATS']);
-   }
- | 'SHOW' 'COLUMN' 'STATS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'COLUMN' 'STATS' RegularOrBackTickedSchemaQualifiedName_EDIT
- ;
-
-ShowCreateTableStatement
- : 'SHOW' 'CREATE' TableOrView RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-ShowCreateTableStatement_EDIT
- : 'SHOW' 'CREATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['TABLE', 'VIEW']);
-   }
- | 'SHOW' 'CREATE' TableOrView 'CURSOR'
-   {
-     if ($3.isView) {
-       parser.suggestTables({ onlyViews: true });
-     } else {
-       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', 'VIEW']);
-   }
- ;
-
-TableOrView
- : 'TABLE'
- | 'VIEW'   -> { isView: true }
- ;
-
-ShowCurrentRolesStatement
- : 'SHOW' 'CURRENT' 'ROLES'
- ;
-
-ShowCurrentRolesStatement_EDIT
- : 'SHOW' 'CURRENT' 'CURSOR'
-   {
-     parser.suggestKeywords([ 'ROLES' ]);
-   }
- | 'SHOW' 'CURSOR' 'ROLES'
-   {
-     parser.suggestKeywords([ 'CURRENT' ]);
-   }
- ;
-
-ShowDatabasesStatement
- : 'SHOW' DatabasesOrSchemas 'LIKE' SingleQuotedValue
- | 'SHOW' 'DATABASES' SingleQuotedValue
- ;
-
-ShowDatabasesStatement_EDIT
- : 'SHOW' DatabasesOrSchemas 'CURSOR'
-   {
-     parser.suggestKeywords(['LIKE']);
-   }
- ;
-
-ShowFilesStatement
- : 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-ShowFilesStatement_EDIT
- : 'SHOW' 'FILES' 'CURSOR'
-   {
-     parser.suggestKeywords(['IN']);
-   }
- | 'SHOW' 'FILES' 'IN' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName_EDIT OptionalPartitionSpec
- | 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec 'CURSOR'
-   {
-     parser.addTablePrimary($4);
-     if (!$5) {
-       parser.suggestKeywords(['PARTITION']);
-     }
-   }
- | 'SHOW' 'FILES' 'IN' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec_EDIT
- | 'SHOW' 'FILES' 'CURSOR' RegularOrBackTickedSchemaQualifiedName OptionalPartitionSpec
-   {
-     parser.addTablePrimary($4);
-     parser.suggestKeywords(['IN']);
-   }
- ;
-
-ShowFunctionsStatement
- : 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase
- | 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase 'LIKE' QuotedValue
- ;
-
-ShowFunctionsStatement_EDIT
- : 'SHOW' AggregateOrAnalytic 'CURSOR'
-   {
-     parser.suggestKeywords(['FUNCTIONS']);
-   }
- | 'SHOW' 'CURSOR' 'FUNCTIONS' OptionalInDatabase
-   {
-     parser.suggestKeywords(['AGGREGATE', 'ANALYTICAL']);
-   }
- | 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase 'CURSOR'
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IN', 'LIKE']);
-     } else {
-       parser.suggestKeywords(['LIKE']);
-     }
-   }
- | 'SHOW' AggregateOrAnalytic 'CURSOR' OptionalInDatabase 'LIKE' QuotedValue
-   {
-     parser.suggestKeywords(['FUNCTIONS']);
-   }
- | 'SHOW' 'CURSOR' 'FUNCTIONS' OptionalInDatabase 'LIKE' QuotedValue
-   {
-     parser.suggestKeywords(['AGGREGATE', 'ANALYTICAL']);
-   }
- | 'SHOW' OptionalAggregateOrAnalytic 'FUNCTIONS' OptionalInDatabase 'CURSOR' QuotedValue
-   {
-     if (!$4) {
-       parser.suggestKeywords([{ value: 'IN', weight: 2 }, { value: 'LIKE', weight: 1 }]);
-     } else {
-       parser.suggestKeywords(['LIKE']);
-     }
-   }
- ;
-
-ShowGrantStatement
- : 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'DATABASE' RegularOrBacktickedIdentifier
-   {
-     parser.addDatabaseLocation(@7, [ { name: $7 } ]);
-   }
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'SERVER'
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'TABLE' SchemaQualifiedTableIdentifier
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'URI' RegularOrBacktickedIdentifier
- ;
-
-ShowGrantStatement_EDIT
- : 'SHOW' 'GRANT' 'CURSOR'
-   {
-     parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
-   }
- | 'SHOW' 'GRANT' GroupRoleOrUser 'CURSOR'
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
-   }
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'CURSOR'
-   {
-     parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
-   }
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'DATABASE' 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'TABLE' 'CURSOR'
-   {
-     parser.suggestDatabases({
-       appendDot: true
-     });
-     parser.suggestTables();
-   }
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'TABLE' SchemaQualifiedTableIdentifier_EDIT
- | 'SHOW' 'GRANT' GroupRoleOrUser RegularOrBacktickedIdentifier 'ON' 'URI' 'CURSOR'
- ;
-
-OptionalPrincipalName
- :
- | RegularIdentifier
- ;
-
-OptionalPrincipalName_EDIT
- : 'CURSOR'
- | RegularIdentifier 'CURSOR'
- ;
-
-ShowPartitionsStatement
- : 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($3);
-   }
- | 'SHOW' 'RANGE' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($3);
-   }
- ;
-
-ShowPartitionsStatement_EDIT
- : 'SHOW' 'PARTITIONS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT
- | 'SHOW' 'RANGE' 'PARTITIONS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'RANGE' 'PARTITIONS' RegularOrBackTickedSchemaQualifiedName_EDIT
- ;
-
-ShowRoleStatement
- : 'SHOW' 'ROLE' 'GRANT' 'GROUP' RegularIdentifier
- ;
-
-ShowRoleStatement_EDIT
- : 'SHOW' 'ROLE' 'CURSOR'
-   {
-     parser.suggestKeywords(['GRANT']);
-   }
- | 'SHOW' 'ROLE' 'GRANT' 'CURSOR'
-   {
-     parser.suggestKeywords(['GROUP']);
-   }
- | 'SHOW' 'ROLE' 'GRANT' 'CURSOR' RegularIdentifier
-   {
-     parser.suggestKeywords(['GROUP']);
-   }
- ;
-
-ShowRolesStatement
- : 'SHOW' 'ROLES'
- ;
-
-ShowTableStatsStatement
- : 'SHOW' 'TABLE' 'STATS' RegularOrBackTickedSchemaQualifiedName
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-ShowTableStatsStatement_EDIT
- : 'SHOW' 'TABLE' 'CURSOR'
-   {
-     parser.suggestKeywords(['STATS']);
-   }
- | 'SHOW' 'TABLE' 'STATS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- | 'SHOW' 'TABLE' 'STATS' RegularOrBackTickedSchemaQualifiedName_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']);
-     }
-   }
- ;

+ 30 - 4
desktop/core/src/desktop/js/parse/jison/sql/impala/structure.json

@@ -38,14 +38,27 @@
     "revoke/revoke_on.jison",
     "revoke/revoke_role.jison",
     "set/set.jison",
+    "show/show_column_stats.jison",
+    "show/show_common.jison",
+    "show/show_create_table.jison",
+    "show/show_current_roles.jison",
+    "show/show_databases.jison",
+    "show/show_files.jison",
+    "show/show_functions.jison",
+    "show/show_grant.jison",
+    "show/show_partitions.jison",
+    "show/show_range_partitions.jison",
+    "show/show_role.jison",
+    "show/show_roles.jison",
+    "show/show_table_stats.jison",
+    "show/show_tables.jison",
     "truncate/truncate_table.jison",
+    "update/update.jison",
     "upsert/cte_upsert.jison",
     "upsert/upsert.jison",
     "sql_error.jison",
     "sql_main.jison",
-    "sql_show.jison",
     "sql_udf.jison",
-    "sql_update.jison",
     "../generic/use/use.jison",
     "sql_valueExpression.jison",
     "../generic/autocomplete_footer.jison"
@@ -88,13 +101,26 @@
     "revoke/revoke_on.jison",
     "revoke/revoke_role.jison",
     "set/set.jison",
+    "show/show_column_stats.jison",
+    "show/show_common.jison",
+    "show/show_create_table.jison",
+    "show/show_current_roles.jison",
+    "show/show_databases.jison",
+    "show/show_files.jison",
+    "show/show_functions.jison",
+    "show/show_grant.jison",
+    "show/show_partitions.jison",
+    "show/show_range_partitions.jison",
+    "show/show_role.jison",
+    "show/show_roles.jison",
+    "show/show_table_stats.jison",
+    "show/show_tables.jison",
     "truncate/truncate_table.jison",
+    "update/update.jison",
     "upsert/cte_upsert.jison",
     "upsert/upsert.jison",
     "sql_main.jison",
-    "sql_show.jison",
     "sql_udf.jison",
-    "sql_update.jison",
     "../generic/use/use.jison",
     "sql_valueExpression.jison",
     "../generic/syntax_footer.jison"

+ 0 - 0
desktop/core/src/desktop/js/parse/jison/sql/impala/sql_update.jison → desktop/core/src/desktop/js/parse/jison/sql/impala/update/update.jison


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/impala/impalaAutocompleteParser.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
desktop/core/src/desktop/js/parse/sql/impala/impalaSyntaxParser.js


+ 3 - 0
desktop/core/src/desktop/js/parse/sql/impala/sqlParseSupport.js

@@ -28,6 +28,9 @@ const initSqlParser = function (parser) {
 
   parser.GRANT_KEYWORDS = ['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT'];
   parser.REVOKE_KEYWORDS = ['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT'];
+  parser.SHOW_KEYWORDS = ['AGGREGATE FUNCTIONS', 'ANALYTIC FUNCTIONS', 'COLUMN STATS', 'CREATE TABLE', 'CURRENT ROLES', 'CREATE VIEW', 'DATABASES', 'FILES IN', 'FUNCTIONS', 'GRANT ROLE', 'GRANT USER', 'PARTITIONS', 'RANGE PARTITIONS', 'ROLE GRANT GROUP', 'ROLES', 'SCHEMAS', 'TABLE STATS', 'TABLES'];
+  parser.SHOW_IDENTIFIER_KEYWORDS = ['COLUMN STATS', 'CREATE TABLE', 'CREATE VIEW', 'FILES IN', 'PARTITIONS', 'RANGE PARTITIONS', 'TABLE STATS'];
+  parser.SHOW_LIKE_KEYWORDS = ['AGGREGATE FUNCTIONS', 'ANALYTIC FUNCTIONS', 'DATABASES', 'FUNCTIONS', 'SCHEMAS', 'TABLES'];
 
   parser.prepareNewStatement = function () {
     linkTablePrimaries();

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно