Просмотр исходного кода

HUE-9370 [frontend] Switch to structure.json for the flink parser

Johan Ahlen 5 лет назад
Родитель
Сommit
0280d489e7
18 измененных файлов с 302 добавлено и 5513 удалено
  1. 0 19
      desktop/core/src/desktop/js/parse/jison/sql/flink/autocomplete_footer.jison
  2. 0 29
      desktop/core/src/desktop/js/parse/jison/sql/flink/autocomplete_header.jison
  3. 0 226
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql.jisonlex
  4. 0 109
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_alter.jison
  5. 0 615
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_create.jison
  6. 0 184
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_drop.jison
  7. 0 132
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_error.jison
  8. 0 72
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_insert.jison
  9. 0 2762
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_main.jison
  10. 0 46
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_set.jison
  11. 0 122
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_update.jison
  12. 0 39
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_use.jison
  13. 0 839
      desktop/core/src/desktop/js/parse/jison/sql/flink/sql_valueExpression.jison
  14. 30 0
      desktop/core/src/desktop/js/parse/jison/sql/flink/structure.json
  15. 0 19
      desktop/core/src/desktop/js/parse/jison/sql/flink/syntax_footer.jison
  16. 0 28
      desktop/core/src/desktop/js/parse/jison/sql/flink/syntax_header.jison
  17. 138 138
      desktop/core/src/desktop/js/parse/sql/flink/flinkAutocompleteParser.js
  18. 134 134
      desktop/core/src/desktop/js/parse/sql/flink/flinkSyntaxParser.js

+ 0 - 19
desktop/core/src/desktop/js/parse/jison/sql/flink/autocomplete_footer.jison

@@ -1,19 +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.
-
-%%
-
-SqlParseSupport.initSqlParser(parser);

+ 0 - 29
desktop/core/src/desktop/js/parse/jison/sql/flink/autocomplete_header.jison

@@ -1,29 +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.
-
-%left 'AND' 'OR'
-%left 'BETWEEN'
-%left 'NOT' '!' '~'
-%left '=' '<' '>' 'COMPARISON_OPERATOR'
-%left '-' '*' 'ARITHMETIC_OPERATOR'
-
-%left ';' ','
-%nonassoc 'CURSOR' 'PARTIAL_CURSOR'
-%nonassoc 'IN' 'IS' 'LIKE' 'RLIKE' 'REGEXP' 'EXISTS' NEGATION
-
-%start SqlAutocomplete
-
-%%

+ 0 - 226
desktop/core/src/desktop/js/parse/jison/sql/flink/sql.jisonlex

@@ -1,226 +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.
-
-%options case-insensitive flex
-%s between
-%x hdfs doubleQuotedValue singleQuotedValue backtickedValue
-%%
-
-\s                                         { /* skip whitespace */ }
-'--'.*                                     { /* skip comments */ }
-[/][*][^*]*[*]+([^/*][^*]*[*]+)*[/]        { /* skip comments */ }
-
-'\u2020'                                   { parser.yy.partialCursor = false; parser.yy.cursorFound = yylloc; return 'CURSOR'; }
-'\u2021'                                   { parser.yy.partialCursor = true; parser.yy.cursorFound = yylloc; return 'PARTIAL_CURSOR'; }
-
-<between>'AND'                             { this.popState(); return 'BETWEEN_AND'; }
-
-// Reserved Keywords
-'ALL'                                      { return 'ALL'; }
-'ALTER'                                    { parser.determineCase(yytext); parser.addStatementTypeLocation('ALTER', yylloc, yy.lexer.upcomingInput()); return 'ALTER'; }
-'AND'                                      { return 'AND'; }
-'AS'                                       { return 'AS'; }
-'ASC'                                      { return 'ASC'; }
-'BETWEEN'                                  { this.begin('between'); return 'BETWEEN'; }
-'BIGINT'                                   { return 'BIGINT'; }
-'BOOLEAN'                                  { return 'BOOLEAN'; }
-'BY'                                       { return 'BY'; }
-'CASCADE'                                  { return 'CASCADE'; }
-'CASE'                                     { return 'CASE'; }
-'CHAR'                                     { return 'CHAR'; }
-'COMMENT'                                  { return 'COMMENT'; }
-'CREATE'                                   { parser.determineCase(yytext); return 'CREATE'; }
-'CROSS'                                    { return 'CROSS'; }
-'CURRENT'                                  { return 'CURRENT'; }
-'DATABASE'                                 { return 'DATABASE'; }
-'DECIMAL'                                  { return 'DECIMAL'; }
-'DESC'                                     { return 'DESC'; }
-'DISTINCT'                                 { return 'DISTINCT'; }
-'DIV'                                      { return 'ARITHMETIC_OPERATOR'; }
-'DOUBLE'                                   { return 'DOUBLE'; }
-'DROP'                                     { parser.determineCase(yytext); parser.addStatementTypeLocation('DROP', yylloc, yy.lexer.upcomingInput()); return 'DROP'; }
-'ELSE'                                     { return 'ELSE'; }
-'END'                                      { return 'END'; }
-'EXISTS'                                   { parser.yy.correlatedSubQuery = true; return 'EXISTS'; }
-'FALSE'                                    { return 'FALSE'; }
-'FLOAT'                                    { return 'FLOAT'; }
-'FOLLOWING'                                { return 'FOLLOWING'; }
-'FROM'                                     { parser.determineCase(yytext); return 'FROM'; }
-'FULL'                                     { return 'FULL'; }
-'GROUP'                                    { return 'GROUP'; }
-'HAVING'                                   { return 'HAVING'; }
-'IF'                                       { return 'IF'; }
-'IN'                                       { return 'IN'; }
-'INNER'                                    { return 'INNER'; }
-'INSERT'                                   { return 'INSERT'; }
-'INT'                                      { return 'INT'; }
-'INTO'                                     { return 'INTO'; }
-'IS'                                       { return 'IS'; }
-'JOIN'                                     { return 'JOIN'; }
-'LEFT'                                     { return 'LEFT'; }
-'LIKE'                                     { return 'LIKE'; }
-'LIMIT'                                    { return 'LIMIT'; }
-'NOT'                                      { return 'NOT'; }
-'NULL'                                     { return 'NULL'; }
-'ON'                                       { return 'ON'; }
-'OPTION'                                   { return 'OPTION'; }
-'OR'                                       { return 'OR'; }
-'ORDER'                                    { return 'ORDER'; }
-'OUTER'                                    { return 'OUTER'; }
-'PARTITION'                                { return 'PARTITION'; }
-'PRECEDING'                                { return 'PRECEDING'; }
-'PURGE'                                    { return 'PURGE'; }
-'RANGE'                                    { return 'RANGE'; }
-'REGEXP'                                   { return 'REGEXP'; }
-'RIGHT'                                    { return 'RIGHT'; }
-'RLIKE'                                    { return 'RLIKE'; }
-'ROW'                                      { return 'ROW'; }
-'ROLE'                                     { return 'ROLE'; }
-'ROWS'                                     { return 'ROWS'; }
-'SCHEMA'                                   { return 'SCHEMA'; }
-'SELECT'                                   { parser.determineCase(yytext); parser.addStatementTypeLocation('SELECT', yylloc); return 'SELECT'; }
-'SEMI'                                     { return 'SEMI'; }
-'SET'                                      { parser.determineCase(yytext); parser.addStatementTypeLocation('SET', yylloc); return 'SET'; }
-'SHOW'                                     { parser.determineCase(yytext); parser.addStatementTypeLocation('SHOW', yylloc); return 'SHOW'; }
-'SMALLINT'                                 { return 'SMALLINT'; }
-'STRING'                                   { return 'STRING'; }
-'TABLE'                                    { return 'TABLE'; }
-'THEN'                                     { return 'THEN'; }
-'TIMESTAMP'                                { return 'TIMESTAMP'; }
-'TINYINT'                                  { return 'TINYINT'; }
-'TO'                                       { return 'TO'; }
-'TRUE'                                     { return 'TRUE'; }
-'TRUNCATE'                                 { parser.determineCase(yytext); parser.addStatementTypeLocation('TRUNCATE', yylloc, yy.lexer.upcomingInput()); return 'TRUNCATE'; }
-'UNBOUNDED'                                { return 'UNBOUNDED'; }
-'UNION'                                    { return 'UNION'; }
-'UPDATE'                                   { parser.determineCase(yytext); return 'UPDATE'; }
-'USE'                                      { parser.determineCase(yytext); parser.addStatementTypeLocation('USE', yylloc); return 'USE'; }
-'VALUES'                                   { return 'VALUES'; }
-'VARCHAR'                                  { return 'VARCHAR'; }
-'VIEW'                                     { return 'VIEW'; }
-'WHEN'                                     { return 'WHEN'; }
-'WHERE'                                    { return 'WHERE'; }
-'WITH'                                     { parser.determineCase(yytext); parser.addStatementTypeLocation('WITH', yylloc); return 'WITH'; }
-
-// Non-reserved Keywords
-'OVER'                                     { return 'OVER'; }
-'ROLE'                                     { return 'ROLE'; }
-
-// --- UDFs ---
-AVG\s*\(                                   { yy.lexer.unput('('); yytext = 'avg'; parser.addFunctionLocation(yylloc, yytext); return 'AVG'; }
-CAST\s*\(                                  { yy.lexer.unput('('); yytext = 'cast'; parser.addFunctionLocation(yylloc, yytext); return 'CAST'; }
-COUNT\s*\(                                 { yy.lexer.unput('('); yytext = 'count'; parser.addFunctionLocation(yylloc, yytext); return 'COUNT'; }
-MAX\s*\(                                   { yy.lexer.unput('('); yytext = 'max'; parser.addFunctionLocation(yylloc, yytext); return 'MAX'; }
-MIN\s*\(                                   { yy.lexer.unput('('); yytext = 'min'; parser.addFunctionLocation(yylloc, yytext); return 'MIN'; }
-STDDEV_POP\s*\(                            { yy.lexer.unput('('); yytext = 'stddev_pop'; parser.addFunctionLocation(yylloc, yytext); return 'STDDEV_POP'; }
-STDDEV_SAMP\s*\(                           { yy.lexer.unput('('); yytext = 'stddev_samp'; parser.addFunctionLocation(yylloc, yytext); return 'STDDEV_SAMP'; }
-SUM\s*\(                                   { yy.lexer.unput('('); yytext = 'sum'; parser.addFunctionLocation(yylloc, yytext); return 'SUM'; }
-VAR_POP\s*\(                               { yy.lexer.unput('('); yytext = 'var_pop'; parser.addFunctionLocation(yylloc, yytext); return 'VAR_POP'; }
-VAR_SAMP\s*\(                              { yy.lexer.unput('('); yytext = 'var_samp'; parser.addFunctionLocation(yylloc, yytext); return 'VAR_SAMP'; }
-VARIANCE\s*\(                              { yy.lexer.unput('('); yytext = 'variance'; parser.addFunctionLocation(yylloc, yytext); return 'VARIANCE'; }
-
-// Analytical functions
-CUME_DIST\s*\(                             { yy.lexer.unput('('); yytext = 'cume_dist'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-DENSE_RANK\s*\(                            { yy.lexer.unput('('); yytext = 'dense_rank'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-FIRST_VALUE\s*\(                           { yy.lexer.unput('('); yytext = 'first_value'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-LAG\s*\(                                   { yy.lexer.unput('('); yytext = 'lag'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-LAST_VALUE\s*\(                            { yy.lexer.unput('('); yytext = 'last_value'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-LEAD\s*\(                                  { yy.lexer.unput('('); yytext = 'lead'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-RANK\s*\(                                  { yy.lexer.unput('('); yytext = 'rank'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-ROW_NUMBER\s*\(                            { yy.lexer.unput('('); yytext = 'row_number'; parser.addFunctionLocation(yylloc, yytext); return 'ANALYTIC'; }
-
-[0-9]+                                     { return 'UNSIGNED_INTEGER'; }
-[0-9]+(?:[YSL]|BD)?                        { return 'UNSIGNED_INTEGER'; }
-[0-9]+E                                    { return 'UNSIGNED_INTEGER_E'; }
-[A-Za-z0-9_]+                              { return 'REGULAR_IDENTIFIER'; }
-
-<hdfs>'\u2020'                             { parser.yy.cursorFound = true; return 'CURSOR'; }
-<hdfs>'\u2021'                             { parser.yy.cursorFound = true; return 'PARTIAL_CURSOR'; }
-<hdfs>\s+['"]                              { return 'HDFS_START_QUOTE'; }
-<hdfs>[^'"\u2020\u2021]+                   { parser.addFileLocation(yylloc, yytext); return 'HDFS_PATH'; }
-<hdfs>['"]                                 { this.popState(); return 'HDFS_END_QUOTE'; }
-<hdfs><<EOF>>                              { return 'EOF'; }
-
-'&&'                                       { return 'AND'; }
-'||'                                       { return 'OR'; }
-
-'='                                        { return '='; }
-'<'                                        { return '<'; }
-'>'                                        { return '>'; }
-'!='                                       { return 'COMPARISON_OPERATOR'; }
-'<='                                       { return 'COMPARISON_OPERATOR'; }
-'>='                                       { return 'COMPARISON_OPERATOR'; }
-'<>'                                       { return 'COMPARISON_OPERATOR'; }
-'<=>'                                      { return 'COMPARISON_OPERATOR'; }
-
-'-'                                        { return '-'; }
-'*'                                        { return '*'; }
-'+'                                        { return 'ARITHMETIC_OPERATOR'; }
-'/'                                        { return 'ARITHMETIC_OPERATOR'; }
-'%'                                        { return 'ARITHMETIC_OPERATOR'; }
-'|'                                        { return 'ARITHMETIC_OPERATOR'; }
-'^'                                        { return 'ARITHMETIC_OPERATOR'; }
-'&'                                        { return 'ARITHMETIC_OPERATOR'; }
-
-','                                        { return ','; }
-'.'                                        { return '.'; }
-':'                                        { return ':'; }
-';'                                        { return ';'; }
-'~'                                        { return '~'; }
-'!'                                        { return '!'; }
-
-'('                                        { return '('; }
-')'                                        { return ')'; }
-'['                                        { return '['; }
-']'                                        { return ']'; }
-
-\$\{[^}]*\}                                { return 'VARIABLE_REFERENCE'; }
-
-\`                                         { this.begin('backtickedValue'); return 'BACKTICK'; }
-<backtickedValue>[^`]+                     {
-                                             if (parser.handleQuotedValueWithCursor(this, yytext, yylloc, '`')) {
-                                               return 'PARTIAL_VALUE';
-                                             }
-                                             return 'VALUE';
-                                           }
-<backtickedValue>\`                        { this.popState(); return 'BACKTICK'; }
-
-\'                                         { this.begin('singleQuotedValue'); return 'SINGLE_QUOTE'; }
-<singleQuotedValue>(?:\\\\|\\[']|[^'])+         {
-                                             if (parser.handleQuotedValueWithCursor(this, yytext, yylloc, '\'')) {
-                                               return 'PARTIAL_VALUE';
-                                             }
-                                             return 'VALUE';
-                                           }
-<singleQuotedValue>\'                      { this.popState(); return 'SINGLE_QUOTE'; }
-
-\"                                         { this.begin('doubleQuotedValue'); return 'DOUBLE_QUOTE'; }
-<doubleQuotedValue>(?:\\\\|\\["]|[^"])+         {
-                                             if (parser.handleQuotedValueWithCursor(this, yytext, yylloc, '"')) {
-                                               return 'PARTIAL_VALUE';
-                                             }
-                                             return 'VALUE';
-                                           }
-<doubleQuotedValue>\"                      { this.popState(); return 'DOUBLE_QUOTE'; }
-
-<<EOF>>                                    { return 'EOF'; }
-
-.                                          { /* To prevent console logging of unknown chars */ }
-<between>.                                 { }
-<hdfs>.                                    { }
-<backtickedValue>.                         { }
-<singleQuotedValue>.                       { }
-<doubleQuotedValue>.                       { }

+ 0 - 109
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_alter.jison

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

+ 0 - 615
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_create.jison

@@ -1,615 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-DataDefinition
- : CreateStatement
- ;
-
-DataDefinition_EDIT
- : CreateStatement_EDIT
- ;
-
-CreateStatement
- : DatabaseDefinition
- | TableDefinition
- | ViewDefinition
- | RoleDefinition
- ;
-
-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
- ;
-
-TableDefinition_EDIT
- : 'CREATE' 'TABLE' OptionalIfNotExists TableDefinitionRightPart_EDIT
- | 'CREATE' 'TABLE' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' 'TABLE' OptionalIfNotExists_EDIT
- ;
-
-TableDefinitionRightPart
- : TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalAsSelectStatement
- ;
-
-TableDefinitionRightPart_EDIT
- : TableIdentifierAndOptionalColumnSpecification_EDIT OptionalPartitionedBy OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification PartitionedBy_EDIT OptionalAsSelectStatement
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy OptionalAsSelectStatement_EDIT
- | TableIdentifierAndOptionalColumnSpecification OptionalPartitionedBy 'CURSOR'
-   {
-     var keywords = [];
-     if (!$1 && !$2) {
-       keywords.push({ value: 'LIKE', weight: 1 });
-     } else {
-       if (!$2) {
-         keywords.push({ value: 'PARTITIONED BY', weight: 12 });
-       }
-       keywords.push({ value: 'AS', weight: 1 });
-     }
-
-     if (keywords.length > 0) {
-       parser.suggestKeywords(keywords);
-     }
-   }
- ;
-
-TableIdentifierAndOptionalColumnSpecification
- : SchemaQualifiedIdentifier OptionalColumnSpecificationsOrLike
-   {
-     parser.addNewTableLocation(@1, $1, $2);
-     $$ = $2;
-   }
- ;
-
-TableIdentifierAndOptionalColumnSpecification_EDIT
- : SchemaQualifiedIdentifier OptionalColumnSpecificationsOrLike_EDIT
- | SchemaQualifiedIdentifier_EDIT OptionalColumnSpecificationsOrLike
- ;
-
-OptionalColumnSpecificationsOrLike
- :
- | ParenthesizedColumnSpecificationList
- | 'LIKE' SchemaQualifiedTableIdentifier    -> []
- ;
-
-OptionalColumnSpecificationsOrLike_EDIT
- : ParenthesizedColumnSpecificationList_EDIT
- | 'LIKE' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'LIKE' SchemaQualifiedTableIdentifier_EDIT
- ;
-
-ParenthesizedColumnSpecificationList
- : '(' ColumnSpecificationList ')'                              -> $2
- ;
-
-ParenthesizedColumnSpecificationList_EDIT
- : '(' ColumnSpecificationList_EDIT RightParenthesisOrError
- ;
-
-ColumnSpecificationList
- : ColumnSpecification                              -> [$1]
- | ColumnSpecificationList ',' ColumnSpecification  -> $1.concat($3)
- ;
-
-ColumnSpecificationList_EDIT
- : ColumnSpecification_EDIT
- | ColumnSpecification_EDIT ',' ColumnSpecificationList
- | ColumnSpecificationList ',' ColumnSpecification_EDIT
- | ColumnSpecificationList ',' ColumnSpecification_EDIT ',' ColumnSpecificationList
- | ColumnSpecification 'CURSOR'
-   {
-     parser.checkForKeywords($1);
-   }
- | ColumnSpecification 'CURSOR' ',' ColumnSpecificationList
-   {
-     parser.checkForKeywords($1);
-   }
- | ColumnSpecificationList ',' ColumnSpecification 'CURSOR'
-   {
-     parser.checkForKeywords($3);
-   }
- | ColumnSpecificationList ',' ColumnSpecification 'CURSOR' ',' ColumnSpecificationList
-   {
-     parser.checkForKeywords($3);
-   }
- ;
-
-ColumnSpecification
- : ColumnIdentifier ColumnDataType OptionalColumnOptions
-   {
-     $$ = $1;
-     $$.type = $2;
-     var keywords = [];
-     if (!$3['comment']) {
-       keywords.push('COMMENT');
-     }
-     if (keywords.length > 0) {
-       $$.suggestKeywords = keywords;
-     }
-   }
- ;
-
-ColumnSpecification_EDIT
- : ColumnIdentifier 'CURSOR' OptionalColumnOptions
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | ColumnIdentifier ColumnDataType_EDIT OptionalColumnOptions
- | ColumnIdentifier ColumnDataType ColumnOptions_EDIT
- ;
-
-OptionalColumnOptions
- :                      -> {}
- | ColumnOptions
- ;
-
-ColumnOptions
- : ColumnOption
-   {
-     $$ = {};
-     $$[$1] = true;
-   }
- | ColumnOptions ColumnOption
-   {
-     $1[$2] = true;
-   }
- ;
-
-ColumnOptions_EDIT
- : ColumnOption_EDIT
- | ColumnOption_EDIT ColumnOptions
- | ColumnOptions ColumnOption_EDIT
- | ColumnOptions ColumnOption_EDIT ColumnOptions
- ;
-
-ColumnOption
- : 'NOT' 'NULL'                                              -> 'null'
- | 'NULL'                                                    -> 'null'
- | Comment                                                   -> 'comment'
- ;
-
-ColumnOption_EDIT
- : 'NOT' 'CURSOR'
-   {
-     parser.suggestKeywords(['NULL']);
-   }
- ;
-
-ColumnDataType
- : PrimitiveType
- | ArrayType
- | MapType
- | StructType
- | ArrayType_INVALID
- | MapType_INVALID
- | StructType_INVALID
- ;
-
-ColumnDataType_EDIT
- : ArrayType_EDIT
- | MapType_EDIT
- | StructType_EDIT
- ;
-
-ArrayType
- : 'ARRAY' '<' ColumnDataType '>'
- ;
-
-ArrayType_INVALID
- : 'ARRAY' '<' '>'
- ;
-
-ArrayType_EDIT
- : 'ARRAY' '<' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | 'ARRAY' '<' ColumnDataType_EDIT GreaterThanOrError
- ;
-
-MapType
- : 'MAP' '<' PrimitiveType ',' ColumnDataType '>'
- ;
-
-MapType_INVALID
- : 'MAP' '<' '>'
- ;
-
-MapType_EDIT
- : 'MAP' '<' PrimitiveType ',' ColumnDataType_EDIT GreaterThanOrError
- | 'MAP' '<' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-   }
- | 'MAP' '<' PrimitiveType ',' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | 'MAP' '<' ',' AnyCursor GreaterThanOrError
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- ;
-
-StructType
- : 'STRUCT' '<' StructDefinitionList '>'
- ;
-
-StructType_INVALID
- : 'STRUCT' '<' '>'
- ;
-
-StructType_EDIT
- : 'STRUCT' '<' StructDefinitionList_EDIT GreaterThanOrError
- ;
-
-StructDefinitionList
- : StructDefinition
- | StructDefinitionList ',' StructDefinition
- ;
-
-StructDefinitionList_EDIT
- : StructDefinition_EDIT
- | StructDefinition_EDIT Commas
- | StructDefinition_EDIT Commas StructDefinitionList
- | StructDefinitionList ',' StructDefinition_EDIT
- | StructDefinitionList ',' StructDefinition_EDIT Commas StructDefinitionList
- ;
-
-StructDefinition
- : RegularOrBacktickedIdentifier ':' ColumnDataType OptionalComment
- ;
-
-StructDefinition_EDIT
- : Commas RegularOrBacktickedIdentifier ':' ColumnDataType 'CURSOR'
-   {
-     parser.suggestKeywords(['COMMENT']);
-   }
- | Commas RegularOrBacktickedIdentifier ':' AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | Commas RegularOrBacktickedIdentifier ':' ColumnDataType_EDIT
- | RegularOrBacktickedIdentifier ':' ColumnDataType 'CURSOR'
-   {
-     parser.suggestKeywords(['COMMENT']);
-   }
- | RegularOrBacktickedIdentifier ':' AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | RegularOrBacktickedIdentifier ':' ColumnDataType_EDIT
- ;
-
-ColumnDataTypeList
- : ColumnDataType
- | ColumnDataTypeList ',' ColumnDataType
- ;
-
-ColumnDataTypeList_EDIT
- : ColumnDataTypeListInner_EDIT
- | ColumnDataTypeListInner_EDIT Commas
- | ColumnDataTypeList ',' ColumnDataTypeListInner_EDIT
- | ColumnDataTypeListInner_EDIT Commas ColumnDataTypeList
- | ColumnDataTypeList ',' ColumnDataTypeListInner_EDIT Commas ColumnDataTypeList
- ;
-
-ColumnDataTypeListInner_EDIT
- : Commas AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | Commas ColumnDataType_EDIT
- | AnyCursor
-   {
-     parser.suggestKeywords(parser.getColumnDataTypeKeywords());
-   }
- | ColumnDataType_EDIT
- ;
-
-GreaterThanOrError
- : '>'
- | error
- ;
-
-OptionalPartitionedBy
- :
- | PartitionedBy
- ;
-
-PartitionedBy
- : 'PARTITION' 'BY' RangeClause
- ;
-
-PartitionedBy_EDIT
- : 'PARTITION' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'PARTITION' 'BY' 'CURSOR'
-   {
-     parser.suggestKeywords(['RANGE']);
-   }
- | 'PARTITION' 'BY' RangeClause_EDIT
- ;
-
-RangeClause
- : 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList
- ;
-
-RangeClause_EDIT
- : 'RANGE' 'CURSOR'
- | 'RANGE' ParenthesizedColumnList_EDIT
- | 'RANGE' ParenthesizedColumnList 'CURSOR'
- | 'RANGE' ParenthesizedColumnList ParenthesizedPartitionValuesList_EDIT
- | 'RANGE' ParenthesizedColumnList_EDIT ParenthesizedPartitionValuesList
- ;
-
-ParenthesizedPartitionValuesList
- : '(' PartitionValueList ')'
- ;
-
-ParenthesizedPartitionValuesList_EDIT
- : '(' 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- |'(' PartitionValueList_EDIT RightParenthesisOrError
- ;
-
-PartitionValueList
- : PartitionValue
- | PartitionValueList ',' PartitionValue
- ;
-
-PartitionValueList_EDIT
- : PartitionValue_EDIT
- | PartitionValueList ',' 'CURSOR'
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- | PartitionValueList ',' 'CURSOR' ',' PartitionValueList
-   {
-     parser.suggestKeywords(['PARTITION']);
-   }
- | PartitionValueList ',' PartitionValue_EDIT
- | PartitionValueList ',' PartitionValue_EDIT ',' PartitionValueList
- ;
-
-PartitionValue
- : 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression
- | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES'
- ;
-
-PartitionValue_EDIT
- : 'PARTITION' 'CURSOR'
-   {
-     parser.suggestKeywords(['VALUE', 'VALUES']);
-   }
- | 'PARTITION' ValueExpression_EDIT
-   {
-     if ($2.endsWithLessThanOrEqual) {
-      parser.suggestKeywords(['VALUES']);
-     }
-   }
- | 'PARTITION' ValueExpression 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=']);
-   }
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'CURSOR'
-   {
-     parser.suggestKeywords(['VALUES']);
-   }
- | 'PARTITION' ValueExpression_EDIT LessThanOrEqualTo 'VALUES'
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=']);
-   }
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo 'CURSOR'
-   {
-     parser.suggestFunctions();
-   }
- | 'PARTITION' ValueExpression LessThanOrEqualTo 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
- | 'PARTITION' 'VALUES' 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=']);
-   }
- | 'PARTITION' 'VALUES' LessThanOrEqualTo 'CURSOR'
-   {
-     parser.suggestFunctions();
-   }
- | 'PARTITION' 'VALUES' LessThanOrEqualTo ValueExpression_EDIT
- ;
-
-LessThanOrEqualTo
- : '<'
- | 'COMPARISON_OPERATOR' // This is fine for autocompletion
- ;
-
-OptionalAsSelectStatement
- :
- | 'AS' CommitLocations QuerySpecification
- ;
-
-OptionalAsSelectStatement_EDIT
- : 'AS' CommitLocations 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | 'AS' CommitLocations QuerySpecification_EDIT
- ;
-
-CommitLocations
- : /* empty */
-   {
-     parser.commitLocations();
-   }
- ;
-
-ViewDefinition
- : 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
- ;
-
-ViewDefinition_EDIT
- : 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists 'CURSOR' SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF NOT EXISTS']);
-     }
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists_EDIT
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier ParenthesizedViewColumnList_EDIT OptionalComment
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'CURSOR'
-   {
-     var keywords = [{value: 'AS', weight: 1 }];
-     if (!$6) {
-       keywords.push({ value: 'COMMENT', weight: 3 });
-     }
-     parser.suggestKeywords(keywords);
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification_EDIT
- | 'CREATE' 'VIEW' OptionalIfNotExists SchemaQualifiedIdentifier_EDIT OptionalParenthesizedViewColumnList OptionalComment 'AS' QuerySpecification
- ;
-
-OptionalParenthesizedViewColumnList
- :
- | ParenthesizedViewColumnList
- ;
-
-ParenthesizedViewColumnList
- : '(' ViewColumnList ')'
- ;
-
-ParenthesizedViewColumnList_EDIT
- : '(' ViewColumnList_EDIT RightParenthesisOrError
-   {
-     if (!$2) {
-       parser.suggestKeywords(['COMMENT']);
-     }
-   }
- ;
-
-ViewColumnList
- : ColumnReference OptionalComment
- | ViewColumnList ',' ColumnReference OptionalComment
- ;
-
-ViewColumnList_EDIT
- : ColumnReference OptionalComment 'CURSOR'                                        -> $2
- | ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList                     -> $2
- | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR'                     -> $4
- | ViewColumnList ',' ColumnReference OptionalComment 'CURSOR' ',' ViewColumnList  -> $4
- ;
-
-RoleDefinition
- : 'CREATE' 'ROLE' RegularIdentifier
- ;

+ 0 - 184
desktop/core/src/desktop/js/parse/jison/sql/flink/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
- ;

+ 0 - 132
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_error.jison

@@ -1,132 +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.
-
-SqlStatements
- : error
- | NonStartingToken error // Having just ': error' does not work for some reason, jison bug?
- ;
-
-SqlStatement_EDIT
- : AnyCursor error
-   {
-     parser.suggestDdlAndDmlKeywords();
-   }
- ;
-
-SelectStatement
- : 'SELECT' OptionalAllOrDistinct SelectList_ERROR TableExpression
- | 'SELECT' OptionalAllOrDistinct SelectList TableExpression_ERROR
- ;
-
-SelectStatement_EDIT
- : 'SELECT' OptionalAllOrDistinct SelectList_ERROR_EDIT TableExpression
-   {
-     parser.selectListNoTableSuggest($3, $2);
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList_ERROR TableExpression_EDIT
- ;
-
-SelectList_ERROR
- : ErrorList
- | SelectList ',' ErrorList
- | ErrorList ',' SelectList ',' ErrorList
- | ErrorList ',' SelectList
- | SelectList ',' ErrorList ',' SelectList
- ;
-
-SelectList_ERROR_EDIT
- : ErrorList ',' SelectList_EDIT                               -> $3
- | SelectList ',' ErrorList ',' SelectList_EDIT                -> $5
- | ErrorList ',' SelectList ',' ErrorList ',' SelectList_EDIT  -> $7
- | ErrorList ',' AnyCursor
-   {
-     $$ = { cursorAtStart : false, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
-   }
- | SelectList ',' ErrorList ',' AnyCursor
-   {
-     $$ = { cursorAtStart : false, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
-   }
- | ErrorList ',' SelectList ',' Errors ',' AnyCursor
-   {
-     $$ = { cursorAtStart : true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
-   }
- ;
-
-SetSpecification
- : 'SET' SetOption '=' error
- ;
-
-ErrorList
- : error
- | Errors ',' error
- ;
-
-JoinType_EDIT
- : 'FULL' 'CURSOR' error
-   {
-     parser.suggestKeywords(['JOIN', 'OUTER JOIN']);
-   }
- | 'LEFT' 'CURSOR' error
-   {
-     parser.suggestKeywords(['JOIN', 'OUTER JOIN']);
-   }
- | 'RIGHT' 'CURSOR' error
-   {
-     parser.suggestKeywords(['JOIN', 'OUTER JOIN']);
-   }
- ;
-
-OptionalSelectConditions_EDIT
- : WhereClause error 'CURSOR' OptionalGroupByClause OptionalHavingClause OptionalOrderByClause OptionalLimitClause
-   {
-     $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$4, $5, $6, $7], [{ value: 'GROUP BY', weight: 8 }, { value: 'HAVING', weight: 7 }, { value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }], [true, true, true, true]),
-       cursorAtEnd: !$4 && !$5 && !$6 && !$7
-     };
-   }
- | OptionalWhereClause OptionalGroupByClause HavingClause error 'CURSOR' OptionalOrderByClause OptionalLimitClause
-   {
-     $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$6, $7], [{ value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }], [true, true]),
-       cursorAtEnd: !$6 && !$7
-     }
-   }
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OrderByClause error 'CURSOR' OptionalLimitClause
-   {
-     $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$7], [{ value: 'LIMIT', weight: 3 }], [true]),
-       cursorAtEnd: !$7
-     }
-   }
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OptionalOrderByClause LimitClause error 'CURSOR'
- ;
-
-OptionalSelectConditions_EDIT
- : WhereClause error GroupByClause_EDIT OptionalHavingClause OptionalOrderByClause OptionalLimitClause
- | WhereClause error OptionalGroupByClause HavingClause_EDIT OptionalOrderByClause OptionalLimitClause
- | WhereClause error OptionalGroupByClause OptionalHavingClause OrderByClause_EDIT OptionalLimitClause
- | WhereClause error OptionalGroupByClause OptionalHavingClause OptionalOrderByClause LimitClause_EDIT
- | OptionalWhereClause GroupByClause error HavingClause_EDIT OptionalOrderByClause OptionalLimitClause
- | OptionalWhereClause GroupByClause error OptionalHavingClause OrderByClause_EDIT OptionalLimitClause
- | OptionalWhereClause GroupByClause error OptionalHavingClause OptionalOrderByClause LimitClause_EDIT
- | OptionalWhereClause OptionalGroupByClause HavingClause error OrderByClause_EDIT OptionalLimitClause
- | OptionalWhereClause OptionalGroupByClause HavingClause error OptionalOrderByClause LimitClause_EDIT
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OrderByClause error LimitClause_EDIT
- ;
-
-DatabaseDefinition_EDIT
- : 'CREATE' DatabaseOrSchema OptionalIfNotExists RegularIdentifier DatabaseDefinitionOptionals_EDIT error
- ;

+ 0 - 72
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_insert.jison

@@ -1,72 +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.
-
-DataManipulation
- : InsertStatement
- ;
-
-InsertStatement
- : InsertValuesStatement
- ;
-
-DataManipulation_EDIT
- : InsertValuesStatement_EDIT
- ;
-
-InsertValuesStatement
- : 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier 'VALUES' InsertValuesList
-   {
-     $4.owner = 'insert';
-     parser.addTablePrimary($4);
-   }
- ;
-
-InsertValuesStatement_EDIT
- : 'INSERT' 'CURSOR'
-   {
-     parser.suggestKeywords(['INTO']);
-   }
- | 'INSERT' 'INTO' OptionalTable 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['TABLE']);
-     }
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier_EDIT
- | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier 'CURSOR'
-   {
-     $4.owner = 'insert';
-     parser.addTablePrimary($4);
-     parser.suggestKeywords(['VALUES']);
-   }
- | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier_EDIT 'VALUES' InsertValuesList
- ;
-
-InsertValuesList
- : ParenthesizedRowValuesList
- | InsertValuesList ',' ParenthesizedRowValuesList
- ;
-
-ParenthesizedRowValuesList
- : '(' InValueList ')'
- ;
-
-OptionalTable
- :
- | 'TABLE'
- ;

+ 0 - 2762
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_main.jison

@@ -1,2762 +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.
-
-SqlSyntax
- : NewStatement SqlStatements EOF
- ;
-
-SqlAutocomplete
- : NewStatement SqlStatements EOF
-   {
-     return parser.yy.result;
-   }
- | NewStatement SqlStatements_EDIT EOF
-   {
-     return parser.yy.result;
-   }
- ;
-
-NewStatement
- : /* empty */
-   {
-     parser.prepareNewStatement();
-   }
- ;
-
-SqlStatements
- :
- | SqlStatement
-   {
-     parser.addStatementLocation(@1);
-   }
- | SqlStatements ';' NewStatement SqlStatements
- ;
-
-SqlStatements_EDIT
- : SqlStatement_EDIT
-   {
-     parser.addStatementLocation(@1);
-   }
- | SqlStatement_EDIT ';' NewStatement SqlStatements
-   {
-     parser.addStatementLocation(@1);
-   }
- | SqlStatements ';' NewStatement SqlStatement_EDIT
-   {
-     parser.addStatementLocation(@4);
-   }
- | SqlStatements ';' NewStatement SqlStatement_EDIT ';' NewStatement SqlStatements
-   {
-     parser.addStatementLocation(@4);
-   }
- ;
-
-SqlStatement
- : DataDefinition
- | DataManipulation
- | QuerySpecification
- ;
-
-SqlStatement_EDIT
- : AnyCursor
-   {
-     parser.suggestDdlAndDmlKeywords();
-   }
- | CommonTableExpression 'CURSOR'
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | DataDefinition_EDIT
- | DataManipulation_EDIT
- | QuerySpecification_EDIT
- | SetSpecification_EDIT
- ;
-
-NonReservedKeyword
- : 'ROLE'
- | 'OPTION'
- | 'STRUCT'
- ;
-
-RegularIdentifier
- : 'REGULAR_IDENTIFIER'
- | 'VARIABLE_REFERENCE'
- | NonReservedKeyword
- ;
-
-// This is a work-around for error handling when a statement starts with some token that the parser can understand but
-// it's not a valid statement (see ErrorStatement). It contains everything except valid starting tokens ('SELECT', 'USE' etc.)
-NonStartingToken
- : '!'
- | '('
- | ')'
- | '*'
- | ','
- | '-'
- | '.'
- | '<'
- | '='
- | '>'
- | '['
- | ']'
- | '~'
- | 'ALL'
- | 'ANALYTIC'
- | 'AND'
- | 'ARITHMETIC_OPERATOR'
- | 'ARRAY'
- | 'AS'
- | 'ASC'
- | 'AVG'
- | 'BACKTICK'
- | 'BETWEEN'
- | 'BIGINT'
- | 'BOOLEAN'
- | 'BY'
- | 'CASE'
- | 'CAST'
- | 'CHAR'
- | 'COMPARISON_OPERATOR'
- | 'COUNT'
- | 'CROSS'
- | 'CURRENT'
- | 'DATABASE'
- | 'DECIMAL'
- | 'DESC'
- | 'DISTINCT'
- | 'DOUBLE'
- | 'DOUBLE_QUOTE'
- | 'ELSE'
- | 'END'
- | 'EXISTS'
- | 'FALSE'
- | 'FLOAT'
- | 'FOLLOWING'
- | 'FROM'
- | 'FULL'
- | 'GROUP'
- | 'HAVING'
- | 'HDFS_START_QUOTE'
- | 'IF'
- | 'IN'
- | 'INNER'
- | 'INT'
- | 'INTO'
- | 'IS'
- | 'JOIN'
- | 'LEFT'
- | 'LIKE'
- | 'LIMIT'
- | 'MAP'
- | 'MAX'
- | 'MIN'
- | 'NOT'
- | 'NULL'
- | 'ON'
- | 'OPTION'
- | 'OR'
- | 'ORDER'
- | 'OUTER'
- | 'OVER'
- | 'PARTITION'
- | 'PRECEDING'
- | 'PURGE'
- | 'RANGE'
- | 'REGEXP'
- | 'REGULAR_IDENTIFIER'
- | 'RIGHT'
- | 'RLIKE'
- | 'ROLE'
- | 'ROW'
- | 'ROWS'
- | 'SCHEMA'
- | 'SEMI'
- | 'SET'
- | 'SINGLE_QUOTE'
- | 'SMALLINT'
- | 'STDDEV_POP'
- | 'STDDEV_SAMP'
- | 'STRING'
- | 'STRUCT'
- | 'SUM'
- | 'TABLE'
- | 'THEN'
- | 'TIMESTAMP'
- | 'TINYINT'
- | 'TRUE'
- | 'UNION'
- | 'UNSIGNED_INTEGER'
- | 'UNSIGNED_INTEGER_E'
- | 'VALUES'
- | 'VAR_POP'
- | 'VAR_SAMP'
- | 'VARCHAR'
- | 'VARIABLE_REFERENCE'
- | 'VARIANCE'
- | 'WHEN'
- | 'WHERE'
- ;
-
-// ===================================== Commonly used constructs =====================================
-
-Commas
- : ','
- | Commas ','
- ;
-
-AnyCursor
- : 'CURSOR'
- | 'PARTIAL_CURSOR'
- ;
-
-FromOrIn
- : 'FROM'
- | 'IN'
- ;
-
-DatabaseOrSchema
- : 'DATABASE'
- | 'SCHEMA'
- ;
-
-SingleQuotedValue
- : 'SINGLE_QUOTE' 'VALUE' 'SINGLE_QUOTE'  -> $2
- | 'SINGLE_QUOTE' 'SINGLE_QUOTE'          -> ''
- ;
-
-SingleQuotedValue_EDIT
- : 'SINGLE_QUOTE' 'PARTIAL_VALUE'
- ;
-
-DoubleQuotedValue
- : 'DOUBLE_QUOTE' 'VALUE' 'DOUBLE_QUOTE'  -> $2
- | 'DOUBLE_QUOTE' 'DOUBLE_QUOTE'          -> ''
- ;
-
-DoubleQuotedValue_EDIT
- : 'DOUBLE_QUOTE' 'PARTIAL_VALUE'
- ;
-
-QuotedValue
- : SingleQuotedValue
- | DoubleQuotedValue
- ;
-
-QuotedValue_EDIT
- : SingleQuotedValue_EDIT
- | DoubleQuotedValue_EDIT
- ;
-
-OptionalFromDatabase
- :
- | FromOrIn DatabaseIdentifier
- ;
-
-OptionalFromDatabase_EDIT
- : FromOrIn DatabaseIdentifier_EDIT
- ;
-
-OptionalCascade
- :
- | 'CASCADE'
- ;
-
-OptionalIfExists
- :
- | 'IF' 'EXISTS'
-   {
-     parser.yy.correlatedSubQuery = false;
-   }
- ;
-
-OptionalIfExists_EDIT
- : 'IF' 'CURSOR'
-   {
-     parser.suggestKeywords(['EXISTS']);
-   }
- ;
-
-OptionalIfNotExists
- :
- | 'IF' 'NOT' 'EXISTS'
-   {
-     parser.yy.correlatedSubQuery = false;
-   }
- ;
-
-OptionalIfNotExists_EDIT
- : 'IF' 'CURSOR'
-   {
-     parser.suggestKeywords(['NOT EXISTS']);
-   }
- | 'IF' 'NOT' 'CURSOR'
-   {
-     parser.suggestKeywords(['EXISTS']);
-   }
- ;
-
-OptionalInDatabase
- :
- | 'IN' DatabaseIdentifier
- | 'IN' DatabaseIdentifier_EDIT
- ;
-
-OptionalPartitionSpec
- :
- | PartitionSpec
- ;
-
-OptionalPartitionSpec_EDIT
- : PartitionSpec_EDIT
- ;
-
-PartitionSpec
- : 'PARTITION' '(' PartitionSpecList ')'
- ;
-
-PartitionSpec_EDIT
- : 'PARTITION' '(' PartitionSpecList_EDIT RightParenthesisOrError
- ;
-
-RangePartitionSpec
- : UnsignedValueSpecification RangePartitionComparisonOperator 'VALUES' RangePartitionComparisonOperator UnsignedValueSpecification
- ;
-
-RangePartitionSpec_EDIT
- : UnsignedValueSpecification 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=', '<>', '=', '>', '>=']);
-   }
- | UnsignedValueSpecification RangePartitionComparisonOperator 'CURSOR'
-   {
-     parser.suggestKeywords(['VALUES']);
-   }
- | UnsignedValueSpecification RangePartitionComparisonOperator 'VALUES' 'CURSOR'
-   {
-     parser.suggestKeywords(['<', '<=', '<>', '=', '>', '>=']);
-   }
- | UnsignedValueSpecification 'CURSOR' 'VALUES' RangePartitionComparisonOperator UnsignedValueSpecification
-   {
-     parser.suggestKeywords(['<', '<=', '<>', '=', '>', '>=']);
-   }
- | UnsignedValueSpecification RangePartitionComparisonOperator 'CURSOR' RangePartitionComparisonOperator UnsignedValueSpecification
-   {
-     parser.suggestKeywords(['VALUES']);
-   }
- | UnsignedValueSpecification RangePartitionComparisonOperator 'VALUES' 'CURSOR' UnsignedValueSpecification
-   {
-     parser.suggestKeywords(['<', '<=', '<>', '=', '>', '>=']);
-   }
- ;
-
-RangePartitionComparisonOperator
- : 'COMPARISON_OPERATOR'
- | '='
- | '<'
- | '>'
- ;
-
-ConfigurationName
- : RegularIdentifier
- | 'CURSOR'
- ;
-
-PartialBacktickedOrAnyCursor
- : AnyCursor
- | PartialBacktickedIdentifier
- ;
-
-PartialBacktickedOrCursor
- : 'CURSOR'
- | PartialBacktickedIdentifier
- ;
-
-PartialBacktickedOrPartialCursor
- : 'PARTIAL_CURSOR'
- | PartialBacktickedIdentifier
- ;
-
-PartialBacktickedIdentifier
- : 'BACKTICK' 'PARTIAL_VALUE'
- ;
-
-RightParenthesisOrError
- : ')'
- | error
- ;
-
-OptionalParenthesizedColumnList
- :
- | ParenthesizedColumnList
- ;
-
-OptionalParenthesizedColumnList_EDIT
- : ParenthesizedColumnList_EDIT
- ;
-
-ParenthesizedColumnList
- : '(' ColumnList ')'
- ;
-
-ParenthesizedColumnList_EDIT
- : '(' ColumnList_EDIT RightParenthesisOrError
- | '(' AnyCursor RightParenthesisOrError
-   {
-     parser.suggestColumns();
-   }
- ;
-
-ColumnList
- : ColumnIdentifier
- | ColumnList ',' ColumnIdentifier
- ;
-
-ColumnList_EDIT
- : ColumnList ',' AnyCursor
-   {
-     parser.suggestColumns();
-   }
- | ColumnList ',' AnyCursor ',' ColumnList
-   {
-     parser.suggestColumns();
-   }
- ;
-
-ParenthesizedSimpleValueList
- : '(' SimpleValueList ')'
- ;
-
-SimpleValueList
- : UnsignedValueSpecification
- | SimpleValueList ',' UnsignedValueSpecification
- ;
-
-SchemaQualifiedTableIdentifier
- : RegularOrBacktickedIdentifier
-   {
-     parser.addTableLocation(@1, [ { name: $1 } ]);
-     $$ = { identifierChain: [ { name: $1 } ] };
-   }
- | RegularOrBacktickedIdentifier '.' RegularOrBacktickedIdentifier
-   {
-     parser.addDatabaseLocation(@1, [ { name: $1 } ]);
-     parser.addTableLocation(@3, [ { name: $1 }, { name: $3 } ]);
-     $$ = { identifierChain: [ { name: $1 }, { name: $3 } ] };
-   }
- ;
-
-SchemaQualifiedTableIdentifier_EDIT
- : PartialBacktickedIdentifier
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | PartialBacktickedIdentifier '.' RegularOrBacktickedIdentifier
-   {
-     parser.suggestDatabases();
-     $$ = { identifierChain: [{ name: $1 }] };
-   }
- | RegularOrBacktickedIdentifier '.' PartialBacktickedOrPartialCursor
-   {
-     parser.suggestTablesOrColumns($1);
-   }
- ;
-
-SchemaQualifiedIdentifier
- : RegularOrBacktickedIdentifier                                       -> [{ name: $1 }]
- | RegularOrBacktickedIdentifier '.' RegularOrBacktickedIdentifier  -> [{ name: $1 }, { name: $2 }]
- ;
-
-SchemaQualifiedIdentifier_EDIT
- : PartialBacktickedIdentifier
-   {
-     parser.suggestDatabases({ appendDot: true });
-   }
- | PartialBacktickedIdentifier '.' RegularOrBacktickedIdentifier
-   {
-     parser.suggestDatabases();
-     $$ = { identifierChain: [{ name: $1 }] };
-   }
- | RegularOrBacktickedIdentifier '.' PartialBacktickedOrPartialCursor
- ;
-
-DatabaseIdentifier
- : RegularOrBacktickedIdentifier
- ;
-
-DatabaseIdentifier_EDIT
- : PartialBacktickedOrCursor
-   {
-     parser.suggestDatabases();
-   }
- ;
-
-PartitionSpecList
- : PartitionExpression
- | PartitionSpecList ',' PartitionExpression
- ;
-
-PartitionSpecList_EDIT
- : PartitionExpression_EDIT
- | PartitionSpecList ',' PartitionExpression_EDIT
- | PartitionExpression_EDIT ',' PartitionSpecList
- | PartitionSpecList ',' PartitionExpression_EDIT ',' PartitionSpecList
- ;
-
-PartitionExpression
- : ColumnIdentifier '=' ValueExpression
- ;
-
-PartitionExpression_EDIT
- : ColumnIdentifier '=' ValueExpression_EDIT
- | ColumnIdentifier '=' AnyCursor
-   {
-     parser.valueExpressionSuggest();
-   }
- | PartialBacktickedIdentifier '=' ValueExpression
-   {
-     parser.suggestColumns();
-   }
- | AnyCursor
-   {
-     parser.suggestColumns();
-   }
- ;
-
-RegularOrBacktickedIdentifier
- : RegularIdentifier
- | 'BACKTICK' 'VALUE' 'BACKTICK'  -> $2
- | 'BACKTICK' 'BACKTICK'          -> ''
- ;
-
-// TODO: Same as SchemaQualifiedTableIdentifier?
-RegularOrBackTickedSchemaQualifiedName
- : RegularOrBacktickedIdentifier
-   {
-     parser.addTableLocation(@1, [ { name: $1 } ]);
-     $$ = { identifierChain: [ { name: $1 } ] };
-   }
- | RegularOrBacktickedIdentifier '.' RegularOrBacktickedIdentifier
-   {
-     parser.addDatabaseLocation(@1, [ { name: $1 } ]);
-     parser.addTableLocation(@3, [ { name: $1 }, { name: $3 } ]);
-     $$ = { identifierChain: [ { name: $1 }, { name: $3 } ] };
-   }
- ;
-
-RegularOrBackTickedSchemaQualifiedName_EDIT
- : PartialBacktickedIdentifier
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ prependDot: true });
-   }
- | RegularOrBacktickedIdentifier '.' PartialBacktickedOrPartialCursor
-   {
-     parser.suggestTablesOrColumns($1);
-   }
- ;
-
-
-LocalOrSchemaQualifiedName
- : RegularOrBackTickedSchemaQualifiedName
- | RegularOrBackTickedSchemaQualifiedName RegularOrBacktickedIdentifier  -> { identifierChain: $1.identifierChain, alias: $2 }
- ;
-
-LocalOrSchemaQualifiedName_EDIT
- : RegularOrBackTickedSchemaQualifiedName_EDIT
- | RegularOrBackTickedSchemaQualifiedName_EDIT RegularOrBacktickedIdentifier
- ;
-
-ColumnReference
- : BasicIdentifierChain
-   {
-     parser.yy.locations[parser.yy.locations.length - 1].type = 'column';
-   }
- | BasicIdentifierChain '.' '*'
-   {
-     parser.addAsteriskLocation(@3, $1.concat({ asterisk: true }));
-   }
- ;
-
-ColumnReference_EDIT
- : BasicIdentifierChain_EDIT
- ;
-
-BasicIdentifierChain
- : ColumnIdentifier
-   {
-     $$ = [ $1.identifier ];
-     parser.yy.firstChainLocation = parser.addUnknownLocation($1.location, [ $1.identifier ]);
-   }
- | BasicIdentifierChain '.' ColumnIdentifier
-   {
-     if (parser.yy.firstChainLocation) {
-       parser.yy.firstChainLocation.firstInChain = true;
-       delete parser.yy.firstChainLocation;
-     }
-     $1.push($3.identifier);
-     parser.addUnknownLocation($3.location, $1.concat());
-   }
- ;
-
-// TODO: Merge with DerivedColumnChain_EDIT ( issue is starting with PartialBacktickedOrPartialCursor)
-BasicIdentifierChain_EDIT
- : BasicIdentifierChain '.' PartialBacktickedOrPartialCursor
-   {
-     parser.suggestColumns({
-       identifierChain: $1
-     });
-     $$ = { suggestKeywords: [{ value: '*', weight: 10000 }] };
-   }
- | BasicIdentifierChain '.' PartialBacktickedOrPartialCursor '.' BasicIdentifierChain
-   {
-     parser.suggestColumns({
-       identifierChain: $1
-     });
-     $$ = { suggestKeywords: [{ value: '*', weight: 10000 }] };
-   }
- ;
-
-DerivedColumnChain
- : ColumnIdentifier  -> [ $1.identifier ]
- | DerivedColumnChain '.' ColumnIdentifier
-   {
-     $1.push($3.identifier);
-   }
- ;
-
-DerivedColumnChain_EDIT
- : PartialBacktickedIdentifierOrPartialCursor
-   {
-     parser.suggestColumns();
-   }
- | DerivedColumnChain '.' PartialBacktickedIdentifierOrPartialCursor
-   {
-     parser.suggestColumns({ identifierChain: $1 });
-   }
- | DerivedColumnChain '.' PartialBacktickedIdentifierOrPartialCursor '.' DerivedColumnChain
-   {
-     parser.suggestColumns({ identifierChain: $1 });
-   }
- | PartialBacktickedIdentifierOrPartialCursor '.' DerivedColumnChain
-   {
-     parser.suggestColumns();
-   }
- ;
-
-ColumnIdentifier
- : RegularOrBacktickedIdentifier                                                                               -> { identifier: { name: $1 }, location: @1 }
- ;
-
-PartialBacktickedIdentifierOrPartialCursor
- : PartialBacktickedIdentifier
- | 'PARTIAL_CURSOR'
- ;
-
-PrimitiveType
- : 'BIGINT'
- | 'BOOLEAN'
- | 'CHAR' OptionalTypeLength
- | 'DECIMAL' OptionalTypePrecision
- | 'DOUBLE'
- | 'FLOAT'
- | 'INT'
- | 'SMALLINT'
- | 'STRING'
- | 'TIMESTAMP'
- | 'TINYINT'
- | 'VARCHAR' OptionalTypeLength
- ;
-
-OptionalTypeLength
- :
- | '(' 'UNSIGNED_INTEGER' ')'
- ;
-
-OptionalTypePrecision
- :
- | '(' 'UNSIGNED_INTEGER' ')'
- | '(' 'UNSIGNED_INTEGER' ',' 'UNSIGNED_INTEGER' ')'
- ;
-
-// ===================================== SELECT statement =====================================
-
-QuerySpecification
- : SelectStatement OptionalUnions                                   -> $1
- | CommonTableExpression SelectStatement OptionalUnions
- | CommonTableExpression '(' QuerySpecification ')' OptionalUnions  -> $3
- ;
-
-QuerySpecification_EDIT
- : SelectStatement_EDIT OptionalUnions
- | SelectStatement OptionalUnions_EDIT
- | CommonTableExpression '(' QuerySpecification_EDIT ')'
-   {
-     parser.addCommonTableExpressions($1);
-   }
- | CommonTableExpression SelectStatement_EDIT OptionalUnions
-   {
-     parser.addCommonTableExpressions($1);
-   }
- | CommonTableExpression SelectStatement OptionalUnions_EDIT
-   {
-     parser.addCommonTableExpressions($1);
-   }
- | CommonTableExpression_EDIT
- | CommonTableExpression_EDIT '(' QuerySpecification ')'
- | CommonTableExpression_EDIT SelectStatement OptionalUnions
- ;
-
-SelectStatement
- : 'SELECT' OptionalAllOrDistinct SelectList
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     $$ = { selectList: $3 };
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList TableExpression
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     $$ = { selectList: $3, tableExpression: $4 }
-   }
- ;
-
-OptionalUnions
- :
- | Unions
- ;
-
-OptionalUnions_EDIT
- : Unions_EDIT
- ;
-
-Unions
- : UnionClause
- | Unions UnionClause
- ;
-
-Unions_EDIT
- : UnionClause_EDIT
- | Unions UnionClause_EDIT
- | UnionClause_EDIT Unions
- | Unions UnionClause_EDIT Unions
- ;
-
-UnionClause
- : 'UNION' NewStatement OptionalAllOrDistinct SelectStatement
- ;
-
-UnionClause_EDIT
- : 'UNION' NewStatement 'CURSOR'
-   {
-     parser.suggestKeywords(['ALL', 'DISTINCT', 'SELECT']);
-   }
- | 'UNION' NewStatement 'CURSOR' SelectStatement
-   {
-     parser.suggestKeywords(['ALL', 'DISTINCT']);
-   }
- | 'UNION' NewStatement OptionalAllOrDistinct SelectStatement_EDIT
- ;
-
-SelectStatement_EDIT
- : 'SELECT' OptionalAllOrDistinct SelectList_EDIT
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     if ($3.cursorAtStart) {
-       var keywords = parser.getSelectListKeywords();
-       if (!$2) {
-         keywords.push({ value: 'ALL', weight: 2 });
-         keywords.push({ value: 'DISTINCT', weight: 2 });
-       }
-       parser.suggestKeywords(keywords);
-     } else {
-       parser.checkForSelectListKeywords($4);
-     }
-     if ($3.suggestFunctions) {
-       parser.suggestFunctions();
-     }
-     if ($3.suggestColumns) {
-       parser.suggestColumns({ identifierChain: [], source: 'select' });
-     }
-     if ($3.suggestTables) {
-       parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
-     }
-     if ($3.suggestDatabases) {
-       parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
-     }
-     if ($3.suggestAggregateFunctions && (!$2 || $2 === 'ALL')) {
-       parser.suggestAggregateFunctions();
-       parser.suggestAnalyticFunctions();
-     }
-   }
- | 'SELECT' OptionalAllOrDistinct 'CURSOR'
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3, true);
-     var keywords = parser.getSelectListKeywords();
-     if (!$2 || $2 === 'ALL') {
-       parser.suggestAggregateFunctions();
-       parser.suggestAnalyticFunctions();
-     }
-     if (!$2) {
-       keywords.push({ value: 'ALL', weight: 2 });
-       keywords.push({ value: 'DISTINCT', weight: 2 });
-     }
-     parser.suggestKeywords(keywords);
-     parser.suggestFunctions();
-     parser.suggestColumns({ identifierChain: [], source: 'select' });
-     parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
-     parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList TableExpression_EDIT
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList_EDIT TableExpression
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     parser.selectListNoTableSuggest($3, $2);
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.source = 'select';
-     }
-   }
- | 'SELECT' OptionalAllOrDistinct 'CURSOR' TableExpression
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3, true);
-     var keywords = parser.getSelectListKeywords();
-     if (!$2 || $2 === 'ALL') {
-       parser.suggestAggregateFunctions();
-       parser.suggestAnalyticFunctions();
-     }
-     if (!$2) {
-       keywords.push({ value: 'ALL', weight: 2 });
-       keywords.push({ value: 'DISTINCT', weight: 2 });
-     }
-     parser.suggestKeywords(keywords);
-     parser.suggestFunctions();
-     parser.suggestColumns({ identifierChain: [], source: 'select' });
-     parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
-     parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList 'CURSOR' TableExpression
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     parser.checkForSelectListKeywords($3);
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList 'CURSOR' ',' TableExpression
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     parser.checkForSelectListKeywords($3);
-   }
- | 'SELECT' OptionalAllOrDistinct SelectList 'CURSOR'
-   {
-     parser.addClauseLocation('selectList', parser.firstDefined($2, @2, $1, @1), @3);
-     parser.checkForSelectListKeywords($3);
-     var keywords = ['FROM'];
-     if (parser.yy.result.suggestKeywords) {
-       keywords = parser.yy.result.suggestKeywords.concat(keywords);
-     }
-     parser.suggestKeywords(keywords);
-     parser.suggestTables({ prependFrom: true });
-     parser.suggestDatabases({ prependFrom: true, appendDot: true });
-   }
- ;
-
-CommonTableExpression
- : 'WITH' WithQueries  -> $2
- ;
-
-CommonTableExpression_EDIT
- : 'WITH' WithQueries_EDIT
- ;
-
-WithQueries
- : WithQuery                   -> [$1]
- | WithQueries ',' WithQuery   -> $1.concat([$3])
- ;
-
-WithQueries_EDIT
- : WithQuery_EDIT
- | WithQueries ',' WithQuery_EDIT
-   {
-     parser.addCommonTableExpressions($1);
-   }
- | WithQuery_EDIT ',' WithQueries
- | WithQueries ',' WithQuery_EDIT ',' WithQueries
-   {
-     parser.addCommonTableExpressions($1);
-   }
- ;
-
-WithQuery
- : RegularOrBacktickedIdentifier 'AS' '(' TableSubQueryInner ')'
-   {
-     parser.addCteAliasLocation(@1, $1);
-     $4.alias = $1;
-     $$ = $4;
-   }
- ;
-
-WithQuery_EDIT
- : RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['AS']);
-   }
- | RegularOrBacktickedIdentifier 'AS' '(' AnyCursor RightParenthesisOrError
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- | RegularOrBacktickedIdentifier 'AS' '(' TableSubQueryInner_EDIT RightParenthesisOrError
- ;
-
-OptionalAllOrDistinct
- :
- | 'ALL'
- | 'DISTINCT'
- ;
-
-TableExpression
- : FromClause OptionalSelectConditions
-   {
-     parser.addClauseLocation('whereClause', @1, $2.whereClauseLocation);
-     parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
-   }
- ;
-
-TableExpression_EDIT
- : FromClause_EDIT OptionalSelectConditions
-   {
-     parser.addClauseLocation('whereClause', @1, $2.whereClauseLocation);
-     parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
-   }
- | FromClause 'CURSOR' OptionalSelectConditions OptionalJoins
-   {
-     var keywords = [];
-
-     parser.addClauseLocation('whereClause', @1, $3.whereClauseLocation);
-     parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
-
-     if ($1) {
-       if (typeof $1.tableReferenceList.hasJoinCondition !== 'undefined' && !$1.tableReferenceList.hasJoinCondition) {
-         keywords.push({ value: 'ON', weight: 3 });
-       }
-       if ($1.suggestKeywords) {
-         keywords = parser.createWeightedKeywords($1.suggestKeywords, 3);
-       }
-       if ($1.tableReferenceList.suggestJoinConditions) {
-         parser.suggestJoinConditions($1.tableReferenceList.suggestJoinConditions);
-       }
-       if ($1.tableReferenceList.suggestJoins) {
-         parser.suggestJoins($1.tableReferenceList.suggestJoins);
-       }
-       if ($1.tableReferenceList.suggestKeywords) {
-         keywords = keywords.concat(parser.createWeightedKeywords($1.tableReferenceList.suggestKeywords, 3));
-       }
-
-       // Lower the weights for 'TABLESAMPLE'
-       keywords.forEach(function (keyword) {
-         if (keyword.value === 'TABLESAMPLE') {
-           keyword.weight = 1.1;
-         }
-       });
-
-       if ($1.tableReferenceList.types) {
-         var veKeywords = parser.getValueExpressionKeywords($1.tableReferenceList);
-         keywords = keywords.concat(veKeywords.suggestKeywords);
-         if (veKeywords.suggestColRefKeywords) {
-           parser.suggestColRefKeywords(veKeywords.suggestColRefKeywords);
-           parser.addColRefIfExists($1.tableReferenceList);
-         }
-       }
-     }
-
-     if ($3.empty && $4 && $4.joinType.toUpperCase() === 'JOIN') {
-       keywords = keywords.concat(['FULL', 'FULL OUTER', 'INNER', 'LEFT', 'LEFT OUTER', 'RIGHT', 'RIGHT OUTER']);
-       parser.suggestKeywords(keywords);
-       return;
-     }
-
-     if ($3.suggestKeywords) {
-       keywords = keywords.concat(parser.createWeightedKeywords($3.suggestKeywords, 2));
-     }
-
-     if ($3.suggestFilters) {
-       parser.suggestFilters($3.suggestFilters);
-     }
-     if ($3.suggestGroupBys) {
-       parser.suggestGroupBys($3.suggestGroupBys);
-     }
-     if ($3.suggestOrderBys) {
-       parser.suggestOrderBys($3.suggestOrderBys);
-     }
-
-     if ($3.empty) {
-       keywords.push({ value: 'UNION', weight: 2.11 });
-     }
-
-     keywords = keywords.concat([
-       { value: 'FULL JOIN', weight: 1 },
-       { value: 'FULL OUTER JOIN', weight: 1 },
-       { value: 'INNER JOIN', weight: 1 },
-       { value: 'JOIN', weight: 1 },
-       { value: 'LEFT JOIN', weight: 1 },
-       { value: 'LEFT OUTER JOIN', weight: 1 },
-       { value: 'RIGHT JOIN', weight: 1 },
-       { value: 'RIGHT OUTER JOIN', weight: 1 }
-     ]);
-     parser.suggestKeywords(keywords);
-  }
- | FromClause OptionalSelectConditions_EDIT OptionalJoins
-   {
-     // A couple of things are going on here:
-     // - If there are no SelectConditions (WHERE, GROUP BY, etc.) we should suggest complete join options
-     // - If there's an OptionalJoin at the end, i.e. 'SELECT * FROM foo | JOIN ...' we should suggest
-     //   different join types
-     // - The FromClause could end with a valueExpression, in which case we should suggest keywords like '='
-     //   or 'AND' based on type
-
-     if (!$2) {
-       parser.addClauseLocation('whereClause', @1);
-       parser.addClauseLocation('limitClause', @1);
-       return;
-     }
-     parser.addClauseLocation('whereClause', @1, $2.whereClauseLocation);
-     parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
-     var keywords = [];
-
-     if ($2.suggestColRefKeywords) {
-       parser.suggestColRefKeywords($2.suggestColRefKeywords);
-       parser.addColRefIfExists($2);
-     }
-
-     if ($2.suggestKeywords && $2.suggestKeywords.length) {
-       keywords = keywords.concat(parser.createWeightedKeywords($2.suggestKeywords, 2));
-     }
-
-     if ($2.cursorAtEnd) {
-       keywords.push({ value: 'UNION', weight: 2.11 });
-     }
-     parser.suggestKeywords(keywords);
-   }
- ;
-
-OptionalJoins
- :
- | Joins
- | Joins_INVALID
- ;
-
-FromClause
- : 'FROM' TableReferenceList
-   {
-     $$ = { tableReferenceList : $2 }
-   }
- ;
-
-FromClause_EDIT
- : 'FROM' 'CURSOR'
-   {
-       parser.suggestTables();
-       parser.suggestDatabases({ appendDot: true });
-   }
- | 'FROM' TableReferenceList_EDIT
- ;
-
-OptionalSelectConditions
- : OptionalWhereClause OptionalGroupByClause OptionalHavingClause OptionalOrderByClause OptionalLimitClause
-   {
-     var keywords = parser.getKeywordsForOptionalsLR(
-       [$1, $2, $3, $4, $5],
-       [{ value: 'WHERE', weight: 7 }, { value: 'GROUP BY', weight: 6 }, { value: 'HAVING', weight: 5 }, { value: 'ORDER BY', weight: 4 }, { value: 'LIMIT', weight: 3 }],
-       [true, true, true, true, true]);
-
-     if (keywords.length > 0) {
-       $$ = { suggestKeywords: keywords, empty: !$1 && !$2 && !$3 && !$4 && !$5 };
-     } else {
-       $$ = {};
-     }
-
-     $$.whereClauseLocation = $1 ? @1 : undefined;
-     $$.limitClausePreceding = parser.firstDefined($4, @4, $3, @3, $2, @2, $1, @1);
-     $$.limitClauseLocation = $5 ? @5 : undefined;
-
-     if (!$1 && !$2 && !$3 && !$4 && !$5) {
-       $$.suggestFilters = { prefix: 'WHERE', tablePrimaries: parser.yy.latestTablePrimaries.concat() };
-     }
-     if (!$2 && !$3 && !$4 && !$5) {
-       $$.suggestGroupBys = { prefix: 'GROUP BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() };
-     }
-     if (!$4 && !$5) {
-       $$.suggestOrderBys = { prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() };
-     }
-   }
- ;
-
-OptionalSelectConditions_EDIT
- : WhereClause_EDIT OptionalGroupByClause OptionalHavingClause OptionalOrderByClause OptionalLimitClause
-   {
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.source = 'where';
-     }
-   }
- | OptionalWhereClause GroupByClause_EDIT OptionalHavingClause OptionalOrderByClause OptionalLimitClause
-   {
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.source = 'group by';
-     }
-   }
- | OptionalWhereClause OptionalGroupByClause HavingClause_EDIT OptionalOrderByClause OptionalLimitClause
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OrderByClause_EDIT OptionalLimitClause
-   {
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.source = 'order by';
-     }
-   }
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OptionalOrderByClause LimitClause_EDIT
- ;
-
-OptionalSelectConditions_EDIT
- : WhereClause 'CURSOR' OptionalGroupByClause OptionalHavingClause OptionalOrderByClause OptionalLimitClause
-   {
-     var keywords = parser.getKeywordsForOptionalsLR(
-       [$3, $4, $5, $6],
-       [{ value: 'GROUP BY', weight: 8 }, { value: 'HAVING', weight: 7 }, { value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }],
-       [true, true, true, true]);
-     if ($1.suggestKeywords) {
-       keywords = keywords.concat(parser.createWeightedKeywords($1.suggestKeywords, 1));
-     }
-     $$ = parser.getValueExpressionKeywords($1, keywords);
-     $$.cursorAtEnd = !$3 && !$4 && !$5 && !$6;
-     if ($1.columnReference) {
-       $$.columnReference = $1.columnReference;
-     }
-     if (!$3) {
-       parser.suggestGroupBys({ prefix: 'GROUP BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-     }
-     if (!$3 && !$4 && !$5) {
-       parser.suggestOrderBys({ prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-     }
-     $$.whereClauseLocation = $1 ? @1 : undefined;
-     $$.limitClausePreceding = parser.firstDefined($5, @5, $4, @4, $3, @3, $1, @1);
-     $$.limitClauseLocation = $6 ? @6 : undefined;
-   }
- | OptionalWhereClause GroupByClause 'CURSOR' OptionalHavingClause OptionalOrderByClause OptionalLimitClause
-   {
-     var keywords = parser.getKeywordsForOptionalsLR(
-       [$4, $5, $6],
-       [{ value: 'HAVING', weight: 7 }, { value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }],
-       [true, true, true]);
-     if ($2.suggestKeywords) {
-       keywords = keywords.concat(parser.createWeightedKeywords($2.suggestKeywords, 8));
-     }
-     if ($2.valueExpression) {
-       $$ = parser.getValueExpressionKeywords($2.valueExpression, keywords);
-       if ($2.valueExpression.columnReference) {
-         $$.columnReference = $2.valueExpression.columnReference;
-       }
-     } else {
-       $$ = { suggestKeywords: keywords };
-     }
-     $$.cursorAtEnd = !$4 && !$5 && !$6;
-     if (!$4 && !$5) {
-       parser.suggestOrderBys({ prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-     }
-     $$.whereClauseLocation = $1 ? @1 : undefined;
-     $$.limitClausePreceding = parser.firstDefined($5, @5, $4, @4, $2, @2);
-     $$.limitClauseLocation = $6 ? @6 : undefined;
-   }
- | OptionalWhereClause OptionalGroupByClause HavingClause 'CURSOR' OptionalOrderByClause OptionalLimitClause
-   {
-     var keywords = parser.getKeywordsForOptionalsLR(
-       [$5, $6],
-       [{ value: 'ORDER BY', weight: 5 }, { value: 'LIMIT', weight: 3 }],
-       [true, true]);
-     $$ = { suggestKeywords: keywords, cursorAtEnd: !$5 && !$6 };
-     if (!$5) {
-       parser.suggestOrderBys({ prefix: 'ORDER BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-     }
-     $$.whereClauseLocation = $1 ? @1 : undefined;
-     $$.limitClausePreceding = parser.firstDefined($5, @5, $3, @3);
-     $$.limitClauseLocation = $6 ? @6 : undefined;
-   }
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OrderByClause 'CURSOR' OptionalLimitClause
-   {
-     var keywords = parser.getKeywordsForOptionalsLR(
-       [$6],
-       [{ value: 'LIMIT', weight: 3 }],
-       [true]);
-     if ($4.suggestKeywords) {
-       keywords = keywords.concat(parser.createWeightedKeywords($4.suggestKeywords, 4));
-     }
-     $$ = { suggestKeywords: keywords, cursorAtEnd: !$6 };
-     $$.whereClauseLocation = $1 ? @1 : undefined;
-     $$.limitClausePreceding = parser.firstDefined($4, @4);
-     $$.limitClauseLocation = $6 ? @6 : undefined;
-   }
- | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OptionalOrderByClause LimitClause 'CURSOR'
-   {
-     $$ = { suggestKeywords: [], cursorAtEnd: true };
-     $$.whereClauseLocation = $1 ? @1 : undefined;
-     $$.limitClausePreceding = parser.firstDefined($4, @4, $3, @3, $2, @2, $1, @1);
-     $$.limitClauseLocation = @5;
-   }
- ;
-
-OptionalWhereClause
- :
- | WhereClause
- ;
-
-WhereClause
- : 'WHERE' SearchCondition  -> $2
- ;
-
-WhereClause_EDIT
- : 'WHERE' SearchCondition_EDIT
-   {
-     if ($2.suggestFilters) {
-       parser.suggestFilters({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-     }
-   }
- | 'WHERE' 'CURSOR'
-   {
-     parser.suggestFunctions();
-     parser.suggestColumns();
-     parser.suggestKeywords(['EXISTS', 'NOT EXISTS']);
-     parser.suggestFilters({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-   }
- ;
-
-OptionalGroupByClause
- :
- | GroupByClause
- ;
-
-GroupByClause
- : 'GROUP' 'BY' GroupByColumnList
-   {
-     $$ = { valueExpression: $3 };
-   }
- ;
-
-GroupByClause_EDIT
- : 'GROUP' 'BY' GroupByColumnList_EDIT
-   {
-     parser.suggestSelectListAliases();
-   }
- | 'GROUP' 'BY' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestSelectListAliases();
-     parser.suggestGroupBys({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-   }
- | 'GROUP' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-     parser.suggestGroupBys({ prefix: 'BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-   }
- ;
-
-ColumnGroupingSets
- :
- | ColumnReference
- | ColumnGroupingSets ',' ColumnGroupingSets
- | '(' ColumnGroupingSets ')'
- ;
-
-ColumnGroupingSets_EDIT
- : ColumnGroupingSet_EDIT
- | ColumnGroupingSet_EDIT ',' ColumnGroupingSets
- | ColumnGroupingSets ',' ColumnGroupingSet_EDIT
- | ColumnGroupingSets ',' ColumnGroupingSet_EDIT ',' ColumnGroupingSets
- | '(' ColumnGroupingSets_EDIT RightParenthesisOrError
- ;
-
-ColumnGroupingSet_EDIT
- : AnyCursor
-   {
-     parser.suggestColumns();
-   }
- | ColumnReference_EDIT
- ;
-
-GroupByColumnList
- : ValueExpression
- | GroupByColumnList ',' ValueExpression  -> $3
- ;
-
-GroupByColumnList_EDIT
- : ValueExpression_EDIT
- | 'CURSOR' ValueExpression
-   {
-     parser.valueExpressionSuggest();
-   }
- | 'CURSOR' ',' GroupByColumnList
-   {
-     parser.valueExpressionSuggest();
-   }
- | ValueExpression_EDIT ',' GroupByColumnList
- | GroupByColumnList ',' GroupByColumnListPartTwo_EDIT
- | GroupByColumnList ',' GroupByColumnListPartTwo_EDIT ','
- | GroupByColumnList ',' GroupByColumnListPartTwo_EDIT ',' GroupByColumnList
- ;
-
-GroupByColumnListPartTwo_EDIT
- : ValueExpression_EDIT
- | AnyCursor ValueExpression
-   {
-     parser.valueExpressionSuggest();
-   }
- | AnyCursor
-   {
-     parser.valueExpressionSuggest();
-   }
- ;
-
-OptionalOrderByClause
- :
- | OrderByClause
- ;
-
-OrderByClause
- : 'ORDER' 'BY' OrderByColumnList  -> $3
- ;
-
-OrderByClause_EDIT
- : 'ORDER' 'BY' OrderByColumnList_EDIT
-   {
-     if ($3.emptyOrderBy) {
-       parser.suggestOrderBys({ tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-     }
-   }
- | 'ORDER' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-     parser.suggestOrderBys({ prefix: 'BY', tablePrimaries: parser.yy.latestTablePrimaries.concat() });
-   }
- ;
-
-OrderByColumnList
- : OrderByIdentifier
- | OrderByColumnList ',' OrderByIdentifier  -> $3
- ;
-
-OrderByColumnList_EDIT
- : OrderByIdentifier_EDIT
- | 'CURSOR' OrderByIdentifier
-   {
-     $$ = { emptyOrderBy: false }
-     parser.valueExpressionSuggest();
-     parser.suggestAnalyticFunctions();
-     parser.suggestSelectListAliases();
-   }
- | OrderByColumnList ',' OrderByIdentifier_EDIT                        -> { emptyOrderBy: false }
- | OrderByColumnList ',' OrderByIdentifier_EDIT ','                    -> { emptyOrderBy: false }
- | OrderByColumnList ',' OrderByIdentifier_EDIT ',' OrderByColumnList  -> { emptyOrderBy: false }
- ;
-
-OrderByIdentifier
- : ValueExpression OptionalAscOrDesc  -> parser.mergeSuggestKeywords($2)
- ;
-
-OrderByIdentifier_EDIT
- : ValueExpression_EDIT OptionalAscOrDesc
-   {
-     parser.suggestSelectListAliases();
-   }
- | AnyCursor OptionalAscOrDesc
-   {
-     $$ = { emptyOrderBy: true }
-     parser.valueExpressionSuggest();
-     parser.suggestAnalyticFunctions();
-     parser.suggestSelectListAliases();
-   }
- ;
-
-OptionalAscOrDesc
- :
-  {
-    $$ = { suggestKeywords: ['ASC', 'DESC'] };
-  }
- | 'ASC'
- | 'DESC'
- ;
-
-OptionalLimitClause
- :
- | LimitClause
- ;
-
-LimitClause
- : 'LIMIT' UnsignedNumericLiteral
- | 'LIMIT' UnsignedNumericLiteral ',' UnsignedNumericLiteral
- | 'LIMIT' 'VARIABLE_REFERENCE'
- | 'LIMIT' 'VARIABLE_REFERENCE' ',' 'VARIABLE_REFERENCE'
- ;
-
-LimitClause_EDIT
- : 'LIMIT' 'CURSOR'
- ;
-
-SearchCondition
- : ValueExpression
- ;
-
-SearchCondition_EDIT
- : ValueExpression_EDIT
- ;
-
-ValueExpression
- : NonParenthesizedValueExpressionPrimary
- ;
-
-ValueExpression_EDIT
- : NonParenthesizedValueExpressionPrimary_EDIT
- ;
-
-ValueExpression_EDIT
- : ValueExpression 'NOT' 'CURSOR'
-   {
-     parser.suggestKeywords(['BETWEEN', 'EXISTS', 'IN', 'LIKE', 'REGEXP', 'RLIKE']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- ;
-
-ValueExpressionList
- : ValueExpression
-   {
-     $1.position = 1;
-   }
- | ValueExpressionList ',' ValueExpression
-   {
-     $3.position = $1.position + 1;
-     $$ = $3;
-   }
- ;
-
-ValueExpressionList_EDIT
- : ValueExpression_EDIT
-   {
-     $1.position = 1;
-   }
- | ValueExpressionList ',' ValueExpression_EDIT
-   {
-     $1.position += 1;
-   }
- | ValueExpression_EDIT ',' ValueExpressionList
-   {
-     $1.position = 1;
-   }
- | ValueExpressionList ',' ValueExpression_EDIT ',' ValueExpressionList
-   {
-     $1.position += 1;
-   }
- | ValueExpressionList ',' AnyCursor
-   {
-     parser.valueExpressionSuggest();
-     $1.position += 1;
-   }
- | ValueExpressionList ',' AnyCursor ',' ValueExpressionList
-   {
-     parser.valueExpressionSuggest();
-     $1.position += 1;
-   }
- | ValueExpressionList 'CURSOR' ',' ValueExpressionList
-   {
-     parser.suggestValueExpressionKeywords($1);
-   }
- | AnyCursor ',' ValueExpressionList
-   {
-     parser.valueExpressionSuggest();
-     $$ = { cursorAtStart : true, position: 1 };
-   }
- | AnyCursor ','
-   {
-     parser.valueExpressionSuggest();
-     $$ = { cursorAtStart : true, position: 1 };
-   }
- | ',' AnyCursor
-   {
-     parser.valueExpressionSuggest();
-     $$ = { position: 2 };
-   }
- | ',' AnyCursor ',' ValueExpressionList
-   {
-     parser.valueExpressionSuggest();
-     $$ = { position: 2 };
-   }
- ;
-
-InValueList
- : NonParenthesizedValueExpressionPrimary
- | InValueList ',' NonParenthesizedValueExpressionPrimary
- ;
-
-NonParenthesizedValueExpressionPrimary
- : UnsignedValueSpecification
- | ColumnOrArbitraryFunctionRef             -> { types: ['COLREF'], columnReference: $1.chain }
- | ColumnOrArbitraryFunctionRef ArbitraryFunctionRightPart
-   {
-     // We need to handle arbitrary UDFs here instead of inside UserDefinedFunction or there will be a conflict
-     // with columnReference for functions like: db.udf(foo)
-     var fn = $1.chain[$1.chain.length - 1].name.toLowerCase();
-     $1.lastLoc.type = 'function';
-     $1.lastLoc.function = fn;
-     $1.lastLoc.location = {
-       first_line: $1.lastLoc.location.first_line,
-       last_line: $1.lastLoc.location.last_line,
-       first_column: $1.lastLoc.location.first_column,
-       last_column: $1.lastLoc.location.last_column - 1
-     }
-     if ($1.lastLoc !== $1.firstLoc) {
-        $1.firstLoc.type = 'database';
-     } else {
-       delete $1.lastLoc.identifierChain;
-     }
-     if ($2.expression) {
-       $$ = { function: fn, expression: $2.expression, types: ['UDFREF'] }
-     } else {
-       $$ = { function: fn, types: ['UDFREF'] }
-     }
-   }
- | ArbitraryFunctionName ArbitraryFunctionRightPart
-  {
-    parser.addFunctionLocation(@1, $1);
-    if ($2.expression) {
-      $$ = { function: $1, expression: $2.expression, types: ['UDFREF'] }
-    } else {
-      $$ = { function: $1, types: ['UDFREF'] }
-    }
-  }
- | UserDefinedFunction
- | 'NULL'                      -> { types: [ 'NULL' ] }
- ;
-
-NonParenthesizedValueExpressionPrimary_EDIT
- : UnsignedValueSpecification_EDIT
- | ColumnOrArbitraryFunctionRef_EDIT
-   {
-     if ($1.suggestKeywords) {
-       $$ = { types: ['COLREF'], columnReference: $1, suggestKeywords: $1.suggestKeywords };
-     } else {
-       $$ = { types: ['COLREF'], columnReference: $1 };
-     }
-   }
- | ColumnOrArbitraryFunctionRef ArbitraryFunctionRightPart_EDIT
-   {
-     var fn = $1.chain[$1.chain.length - 1].name.toLowerCase();
-     $1.lastLoc.type = 'function';
-     $1.lastLoc.function = fn;
-     $1.lastLoc.location = {
-       first_line: $1.lastLoc.location.first_line,
-       last_line: $1.lastLoc.location.last_line,
-       first_column: $1.lastLoc.location.first_column,
-       last_column: $1.lastLoc.location.last_column - 1
-     }
-     if ($1.lastLoc !== $1.firstLoc) {
-        $1.firstLoc.type = 'database';
-     } else {
-       delete $1.lastLoc.identifierChain;
-     }
-     if ($2.position) {
-       parser.applyArgumentTypesToSuggestions(fn, $2.position);
-     }
-     $$ = { function: fn, types: ['UDFREF'] };
-   }
- | ArbitraryFunctionName ArbitraryFunctionRightPart_EDIT
-   {
-     parser.addFunctionLocation(@1, $1);
-     if ($2.position) {
-       parser.applyArgumentTypesToSuggestions($1, $2.position);
-     }
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | UserDefinedFunction_EDIT
- ;
-
-ColumnOrArbitraryFunctionRef
- : BasicIdentifierChain
-   {
-     var lastLoc = parser.yy.locations[parser.yy.locations.length - 1];
-     if (lastLoc.type !== 'variable') {
-       lastLoc.type = 'column';
-     }
-     // used for function references with db prefix
-     var firstLoc = parser.yy.locations[parser.yy.locations.length - $1.length];
-     $$ = { chain: $1, firstLoc: firstLoc, lastLoc: lastLoc }
-   }
- | BasicIdentifierChain '.' '*'
-   {
-     parser.addAsteriskLocation(@3, $1.concat({ asterisk: true }));
-   }
- ;
-
-ColumnOrArbitraryFunctionRef_EDIT
- : BasicIdentifierChain_EDIT
- ;
-
-SignedInteger
- : UnsignedNumericLiteral
- | '-' UnsignedNumericLiteral
- | '+' UnsignedNumericLiteral
- ;
-
-UnsignedValueSpecification
- : UnsignedLiteral
- ;
-
-UnsignedValueSpecification_EDIT
- : UnsignedLiteral_EDIT
-   {
-     parser.suggestValues($1);
-   }
- ;
-
-UnsignedLiteral
- : UnsignedNumericLiteral  -> { types: [ 'NUMBER' ] }
- | GeneralLiteral
- ;
-
-UnsignedLiteral_EDIT
- : GeneralLiteral_EDIT
- ;
-
-UnsignedNumericLiteral
- : ExactNumericLiteral
- | ApproximateNumericLiteral
- ;
-
-ExactNumericLiteral
- : 'UNSIGNED_INTEGER'
- | 'UNSIGNED_INTEGER' '.'                     -> $1 + $2
- | 'UNSIGNED_INTEGER' '.' 'UNSIGNED_INTEGER'  -> $1 + $2 + $3
- | '.' 'UNSIGNED_INTEGER'                     -> $1 + $2
- ;
-
-ApproximateNumericLiteral
- : UNSIGNED_INTEGER_E 'UNSIGNED_INTEGER'
- | '.' UNSIGNED_INTEGER_E 'UNSIGNED_INTEGER'
- | 'UNSIGNED_INTEGER' '.' UNSIGNED_INTEGER_E 'UNSIGNED_INTEGER'
- ;
-
-GeneralLiteral
- : SingleQuotedValue
-   {
-     if (/\$\{[^}]*\}/.test($1)) {
-       parser.addVariableLocation(@1, $1);
-       $$ = { types: [ 'STRING' ], columnReference: [{ name: $1 }] }
-     } else {
-       $$ = { types: [ 'STRING' ] }
-     }
-   }
- | DoubleQuotedValue
-   {
-     if (/\$\{[^}]*\}/.test($1)) {
-       parser.addVariableLocation(@1, $1);
-       $$ = { types: [ 'STRING' ], columnReference: [{ name: $1 }] }
-     } else {
-       $$ = { types: [ 'STRING' ] }
-     }
-   }
- | TruthValue         -> { types: [ 'BOOLEAN' ] }
- ;
-
-GeneralLiteral_EDIT
- : SingleQuotedValue_EDIT
-  {
-    $$ = { partialQuote: '\'', missingEndQuote: parser.yy.missingEndQuote };
-  }
- | DoubleQuotedValue_EDIT
-  {
-    $$ = { partialQuote: '"', missingEndQuote: parser.yy.missingEndQuote };
-  }
- ;
-
-TruthValue
- : 'TRUE'
- | 'FALSE'
- ;
-
-OptionalNot
- :
- | 'NOT'
- ;
-
-SelectSpecification
- : ValueExpression OptionalCorrelationName
-   {
-     if ($2) {
-       parser.addColumnAliasLocation($2.location, $2.alias, @1);
-       $$ = { valueExpression: $1, alias: $2.alias };
-       if (!parser.yy.selectListAliases) {
-         parser.yy.selectListAliases = [];
-       }
-       parser.yy.selectListAliases.push($1.function && $1.types && $1.types.length && $1.types[0] === 'UDFREF' ? { name: $2.alias, udfRef: $1.function, types: $1.types } : { name: $2.alias, types: $1.types || ['T'] });
-     } else {
-       $$ = { valueExpression: $1 }
-     }
-   }
- | '*'
-   {
-     parser.addAsteriskLocation(@1, [{ asterisk: true }]);
-     $$ = { asterisk: true }
-   }
- ;
-
-SelectSpecification_EDIT
- : ValueExpression_EDIT OptionalCorrelationName
-   {
-     if ($2) {
-       parser.addColumnAliasLocation($2.location, $2.alias, @1);
-     }
-   }
-
- | AnyCursor 'AS' RegularOrBacktickedIdentifier
-   {
-     parser.suggestFunctions();
-     parser.suggestColumns();
-     parser.addColumnAliasLocation(@3, $3, @1);
-     $$ = { suggestAggregateFunctions: true };
-   }
- | ValueExpression OptionalCorrelationName_EDIT  -> $2
- ;
-
-SelectList
- : SelectSpecification                 -> [ $1 ]
- | SelectList ',' SelectSpecification
-   {
-     $1.push($3);
-   }
- ;
-
-SelectList_EDIT
- : SelectSpecification_EDIT
- | 'CURSOR' SelectList
-   {
-     $$ = { cursorAtStart : true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
-   }
- | 'CURSOR' ',' SelectList
-   {
-     $$ = { cursorAtStart : true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
-   }
- | SelectSpecification_EDIT ',' SelectList
- | SelectList 'CURSOR' SelectList
-   {
-     parser.checkForSelectListKeywords($1);
-   }
- | SelectList 'CURSOR' ',' SelectList
-   {
-     parser.checkForSelectListKeywords($1);
-   }
- | SelectList ',' AnyCursor
-   {
-     $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestTables: true, suggestDatabases: true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
-   }
- | SelectList ',' SelectSpecification_EDIT                 -> $3
- | SelectList ',' AnyCursor SelectList
-   {
-     $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true,  };
-   }
- | SelectList ',' AnyCursor ','
-   {
-     $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true,  };
-   }
- | SelectList ',' SelectSpecification_EDIT ','             -> $3
- | SelectList ',' AnyCursor ',' SelectList
-   {
-     $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true,  };
-   }
- | SelectList ',' SelectSpecification_EDIT ',' SelectList  -> $3
- ;
-
-TableReferenceList
- : TableReference
- | TableReferenceList ',' TableReference  -> $3
- ;
-
-TableReferenceList_EDIT
- : TableReference_EDIT
- | TableReference_EDIT ',' TableReference
- | TableReferenceList ',' TableReference_EDIT
- | TableReferenceList ',' TableReference_EDIT ',' TableReferenceList
- | TableReferenceList ',' AnyCursor
-   {
-       parser.suggestTables();
-       parser.suggestDatabases({ appendDot: true });
-   }
- ;
-
-TableReference
- : TablePrimaryOrJoinedTable
- ;
-
-TableReference_EDIT
- : TablePrimaryOrJoinedTable_EDIT
- ;
-
-TablePrimaryOrJoinedTable
- : TablePrimary
-   {
-     $$ = $1;
-
-     if (parser.yy.latestTablePrimaries.length > 0) {
-       var idx = parser.yy.latestTablePrimaries.length - 1;
-       var tables = [];
-       do {
-         var tablePrimary = parser.yy.latestTablePrimaries[idx];
-         if (!tablePrimary.subQueryAlias) {
-           tables.unshift(tablePrimary.alias ? { identifierChain: tablePrimary.identifierChain, alias: tablePrimary.alias } : { identifierChain: tablePrimary.identifierChain })
-         }
-         idx--;
-       } while (idx >= 0 && tablePrimary.join && !tablePrimary.subQueryAlias)
-
-       if (tables.length > 0) {
-         $$.suggestJoins = {
-           prependJoin: true,
-           tables: tables
-         };
-       }
-      }
-   }
- | JoinedTable
- ;
-
-TablePrimaryOrJoinedTable_EDIT
- : TablePrimary_EDIT
- | JoinedTable_EDIT
- ;
-
-JoinedTable
- : TablePrimary Joins  -> $2
- ;
-
-JoinedTable_EDIT
- : TablePrimary Joins_EDIT
- | TablePrimary_EDIT Joins
- ;
-
-Joins
- : JoinType TablePrimary OptionalJoinCondition
-   {
-     if ($3 && $3.valueExpression) {
-       $$ = $3.valueExpression;
-     } else {
-       $$ = {};
-     }
-     $$.joinType = $1;
-     if ($3.noJoinCondition) {
-       $$.suggestJoinConditions = { prependOn: true, tablePrimaries: parser.yy.latestTablePrimaries.concat() }
-     }
-     if ($3.suggestKeywords) {
-       $$.suggestKeywords = $3.suggestKeywords;
-     }
-     if (parser.yy.latestTablePrimaries.length > 0) {
-        parser.yy.latestTablePrimaries[parser.yy.latestTablePrimaries.length - 1].join = true;
-     }
-   }
- | Joins JoinType TablePrimary OptionalJoinCondition
-   {
-     if ($4 && $4.valueExpression) {
-       $$ = $4.valueExpression;
-     } else {
-       $$ = {};
-     }
-     $$.joinType = $1;
-     if ($4.noJoinCondition) {
-       $$.suggestJoinConditions = { prependOn: true, tablePrimaries: parser.yy.latestTablePrimaries.concat() }
-     }
-     if ($4.suggestKeywords) {
-       $$.suggestKeywords = $4.suggestKeywords;
-     }
-     if (parser.yy.latestTablePrimaries.length > 0) {
-       parser.yy.latestTablePrimaries[parser.yy.latestTablePrimaries.length - 1].join = true;
-     }
-   }
- ;
-
-Joins_INVALID
- : JoinType                                           -> { joinType: $1 }
- | JoinType Joins                                     -> { joinType: $1 }
- ;
-
-Join_EDIT
- : JoinType_EDIT TablePrimary OptionalJoinCondition
-   {
-     if ($1.suggestKeywords) {
-       parser.suggestKeywords($1.suggestKeywords);
-     }
-   }
- | JoinType_EDIT
-   {
-     if ($1.suggestKeywords) {
-       parser.suggestKeywords($1.suggestKeywords);
-     }
-   }
- | JoinType TablePrimary_EDIT OptionalJoinCondition
- | JoinType TablePrimary JoinCondition_EDIT
- | JoinType 'CURSOR' OptionalJoinCondition
-   {
-     if (parser.yy.latestTablePrimaries.length > 0) {
-       var idx = parser.yy.latestTablePrimaries.length - 1;
-       var tables = [];
-       do {
-         var tablePrimary = parser.yy.latestTablePrimaries[idx];
-         if (!tablePrimary.subQueryAlias) {
-           tables.unshift(tablePrimary.alias ? { identifierChain: tablePrimary.identifierChain, alias: tablePrimary.alias } : { identifierChain: tablePrimary.identifierChain })
-         }
-         idx--;
-       } while (idx >= 0 && tablePrimary.join && !tablePrimary.subQueryAlias)
-
-       if (tables.length > 0) {
-         parser.suggestJoins({
-           prependJoin: false,
-           joinType: $1,
-           tables: tables
-         })
-       }
-     }
-     parser.suggestTables();
-     parser.suggestDatabases({
-       appendDot: true
-     });
-   }
- ;
-
-Joins_EDIT
- : Join_EDIT
- | Join_EDIT Joins
- | Joins Join_EDIT
- | Joins Join_EDIT Joins
- ;
-
-JoinType
- : 'CROSS' 'JOIN'                 -> 'CROSS JOIN'
- | 'FULL' 'JOIN'                  -> 'FULL JOIN'
- | 'FULL' 'OUTER' 'JOIN'          -> 'FULL OUTER JOIN'
- | 'INNER' 'JOIN'                 -> 'INNER JOIN'
- | 'JOIN'                         -> 'JOIN'
- | 'LEFT' 'INNER' 'JOIN'          -> 'LEFT INNER JOIN'
- | 'LEFT' 'JOIN'                  -> 'LEFT JOIN'
- | 'LEFT' 'OUTER' 'JOIN'          -> 'LEFT OUTER JOIN'
- | 'LEFT' 'SEMI' 'JOIN'           -> 'LEFT SEMI JOIN'
- | 'OUTER' 'JOIN'                 -> 'OUTER JOIN'
- | 'RIGHT' 'INNER' 'JOIN'         -> 'RIGHT OUTER JOIN'
- | 'RIGHT' 'JOIN'                 -> 'RIGHT JOIN'
- | 'RIGHT' 'OUTER' 'JOIN'         -> 'RIGHT OUTER JOIN'
- | 'RIGHT' 'SEMI' 'JOIN'          -> 'RIGHT SEMI JOIN'
- | 'SEMI' 'JOIN'                  -> 'SEMI JOIN'
- ;
-
-JoinType_EDIT
- : 'CROSS' 'CURSOR'                 -> { suggestKeywords: ['JOIN'] }
- | 'FULL' 'CURSOR' 'JOIN'           -> { suggestKeywords: ['OUTER'] }
- | 'FULL' 'OUTER' 'CURSOR'          -> { suggestKeywords: ['JOIN'] }
- | 'INNER' 'CURSOR'                 -> { suggestKeywords: ['JOIN'] }
- | 'LEFT' 'CURSOR' 'JOIN'           -> { suggestKeywords: ['OUTER'] }
- | 'LEFT' 'INNER' 'CURSOR'          -> { suggestKeywords: ['JOIN'] }
- | 'LEFT' 'OUTER' 'CURSOR'          -> { suggestKeywords: ['JOIN'] }
- | 'LEFT' 'SEMI' 'CURSOR'           -> { suggestKeywords: ['JOIN'] }
- | 'OUTER' 'CURSOR'                 -> { suggestKeywords: ['JOIN'] }
- | 'RIGHT' 'CURSOR' 'JOIN'          -> { suggestKeywords: ['OUTER'] }
- | 'RIGHT' 'INNER' 'CURSOR'         -> { suggestKeywords: ['JOIN'] }
- | 'RIGHT' 'OUTER' 'CURSOR'         -> { suggestKeywords: ['JOIN'] }
- | 'RIGHT' 'SEMI' 'CURSOR'          -> { suggestKeywords: ['JOIN'] }
- | 'SEMI' 'CURSOR'                  -> { suggestKeywords: ['JOIN'] }
- ;
-
-OptionalJoinCondition
- :                                       -> { noJoinCondition: true, suggestKeywords: ['ON'] }
- | 'ON' ValueExpression                  -> { valueExpression: $2 }
- ;
-
-UsingColList
- : RegularOrBacktickedIdentifier
- | UsingColList ',' RegularOrBacktickedIdentifier
- ;
-
-JoinCondition_EDIT
- : 'ON' ValueExpression_EDIT
- | 'ON' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestJoinConditions({ prependOn: false });
-   }
- ;
-
-TablePrimary
- : TableOrQueryName OptionalCorrelationName
-   {
-     $$ = {
-       primary: $1
-     }
-     if ($1.identifierChain) {
-       if ($2) {
-         $1.alias = $2.alias
-         parser.addTableAliasLocation($2.location, $2.alias, $1.identifierChain);
-       }
-       parser.addTablePrimary($1);
-     }
-
-     var keywords = [];
-     if (!$2) {
-       keywords = ['AS'];
-     } else if ($2.suggestKeywords) {
-       keywords = $2.suggestKeywords;
-     }
-     if (keywords.length > 0) {
-       $$.suggestKeywords = keywords;
-     }
-   }
- | DerivedTable OptionalCorrelationName
-   {
-     $$ = {
-       primary: $1
-     };
-
-     if ($2) {
-       $$.primary.alias = $2.alias;
-       parser.addTablePrimary({ subQueryAlias: $2.alias });
-       parser.addSubqueryAliasLocation($2.location, $2.alias, $1.identifierChain);
-     }
-
-     var keywords = [];
-     if (!$2) {
-       keywords = ['AS'];
-     }
-     if (keywords.length > 0) {
-       $$.suggestKeywords = keywords;
-     }
-   }
- ;
-
-TablePrimary_EDIT
- : TableOrQueryName_EDIT OptionalCorrelationName
-   {
-     if ($2) {
-       parser.addTableAliasLocation($2.location, $2.alias, $1.identifierChain);
-     }
-   }
- | DerivedTable_EDIT OptionalCorrelationName
-   {
-     if ($2) {
-       parser.addTablePrimary({ subQueryAlias: $2.alias });
-       parser.addSubqueryAliasLocation($2.location, $2.alias);
-     }
-   }
- | DerivedTable OptionalCorrelationName_EDIT
- ;
-
-TableOrQueryName
- : SchemaQualifiedTableIdentifier
- ;
-
-TableOrQueryName_EDIT
- : SchemaQualifiedTableIdentifier_EDIT
- ;
-
-DerivedTable
- : TableSubQuery
- ;
-
-DerivedTable_EDIT
- : TableSubQuery_EDIT
- ;
-
-OptionalOnColumn
- :
- | 'ON' ValueExpression
- ;
-
-OptionalOnColumn_EDIT
- : 'ON' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-   }
- | 'ON' ValueExpression_EDIT
- ;
-
-PushQueryState
- :
-   {
-     parser.pushQueryState();
-   }
- ;
-
-PopQueryState
- :
-   {
-     parser.popQueryState();
-   }
- ;
-
-TableSubQuery
- : '(' TableSubQueryInner ')'  -> $2
- | '(' DerivedTable OptionalCorrelationName ')'
-   {
-     if ($3) {
-       $2.alias = $3.alias;
-       parser.addTablePrimary({ subQueryAlias: $3.alias });
-       parser.addSubqueryAliasLocation($3.location, $3.alias, $2.identifierChain);
-     }
-     $$ = $2;
-   }
- ;
-
-TableSubQuery_EDIT
- : '(' TableSubQueryInner_EDIT RightParenthesisOrError
- | '(' AnyCursor RightParenthesisOrError
-   {
-     parser.suggestKeywords(['SELECT']);
-   }
- ;
-
-TableSubQueryInner
- : PushQueryState SubQuery
-   {
-     var subQuery = parser.getSubQuery($2);
-     subQuery.columns.forEach(function (column) {
-       parser.expandIdentifierChain({ wrapper: column });
-       delete column.linked;
-     });
-     parser.popQueryState(subQuery);
-     $$ = subQuery;
-   }
- ;
-
-TableSubQueryInner_EDIT
- : PushQueryState SubQuery_EDIT PopQueryState
- ;
-
-SubQuery
- : QueryExpression
- ;
-
-SubQuery_EDIT
- : QueryExpression_EDIT
- ;
-
-QueryExpression
- : QueryExpressionBody
- ;
-
-QueryExpression_EDIT
- : QueryExpressionBody_EDIT
- ;
-
-QueryExpressionBody
- : NonJoinQueryExpression
- ;
-
-QueryExpressionBody_EDIT
- : NonJoinQueryExpression_EDIT
- ;
-
-NonJoinQueryExpression
- : NonJoinQueryTerm
- ;
-
-NonJoinQueryExpression_EDIT
- : NonJoinQueryTerm_EDIT
- ;
-
-NonJoinQueryTerm
- : NonJoinQueryPrimary
- ;
-
-NonJoinQueryTerm_EDIT
- : NonJoinQueryPrimary_EDIT
- ;
-
-NonJoinQueryPrimary
- : SimpleTable
- ;
-
-NonJoinQueryPrimary_EDIT
- : SimpleTable_EDIT
- ;
-
-SimpleTable
- : QuerySpecification
- ;
-
-SimpleTable_EDIT
- : QuerySpecification_EDIT
- ;
-
-OptionalCorrelationName
- :
- | RegularOrBacktickedIdentifier        -> { alias: $1, location: @1 }
- | QuotedValue                          -> { alias: $1, location: @1 }
- | 'AS' RegularOrBacktickedIdentifier  -> { alias: $2, location: @2 }
- | 'AS' QuotedValue                    -> { alias: $2, location: @2 }
- ;
-
-OptionalCorrelationName_EDIT
- : PartialBacktickedIdentifier
- | QuotedValue_EDIT
- | 'AS' PartialBacktickedIdentifier
- | 'AS' QuotedValue_EDIT
- | 'AS' 'CURSOR'
- ;
-
-UserDefinedFunction
- : AggregateFunction OptionalOverClause
-   {
-     if (!$2) {
-       $1.suggestKeywords = ['OVER'];
-     }
-   }
- | AnalyticFunction OverClause
- | CastFunction
- ;
-
-UserDefinedFunction_EDIT
- : AggregateFunction_EDIT
- | AggregateFunction OptionalOverClause_EDIT
- | AnalyticFunction_EDIT
- | AnalyticFunction_EDIT OverClause
- | AnalyticFunction 'CURSOR'
-   {
-     parser.suggestKeywords(['OVER']);
-   }
- | AnalyticFunction OverClause_EDIT
- | CastFunction_EDIT
- ;
-
-ArbitraryFunction
- : RegularIdentifier ArbitraryFunctionRightPart
-   {
-     parser.addFunctionLocation(@1, $1);
-     if ($2.expression) {
-       $$ = { function: $1, expression: $2.expression, types: ['UDFREF'] }
-     } else {
-       $$ = { function: $1, types: ['UDFREF'] }
-     }
-   }
- | ArbitraryFunctionName ArbitraryFunctionRightPart
-   {
-     parser.addFunctionLocation(@1, $1);
-     if ($2.expression) {
-       $$ = { function: $1, expression: $2.expression, types: ['UDFREF'] }
-     } else {
-       $$ = { function: $1, types: ['UDFREF'] }
-     }
-   }
- ;
-
-ArbitraryFunction_EDIT
- : RegularIdentifier ArbitraryFunctionRightPart_EDIT
-   {
-     parser.addFunctionLocation(@1, $1);
-     if ($2.position) {
-       parser.applyArgumentTypesToSuggestions($1, $2.position);
-     }
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | ArbitraryFunctionName ArbitraryFunctionRightPart_EDIT
-   {
-     parser.addFunctionLocation(@1, $1);
-     if ($2.position) {
-       parser.applyArgumentTypesToSuggestions($1, $2.position);
-     }
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- ;
-
-ArbitraryFunctionName
- : 'ARRAY'
- | 'IF'
- | 'MAP'
- | 'TRUNCATE'
- ;
-
-ArbitraryFunctionRightPart
- : '(' ')'
- | '(' ValueExpressionList ')'  -> { expression: $2 }
- ;
-
-ArbitraryFunctionRightPart_EDIT
- : '(' AnyCursor RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = { position: 1 }
-   }
- | '(' ValueExpressionList 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($3);
-   }
- | '(' ValueExpressionList_EDIT RightParenthesisOrError      -> $2
- ;
-
-AggregateFunction
- : CountFunction
- | SumFunction
- | OtherAggregateFunction
- ;
-
-AggregateFunction_EDIT
- : CountFunction_EDIT
- | SumFunction_EDIT
- | OtherAggregateFunction_EDIT
- ;
-
-AnalyticFunction
- : 'ANALYTIC' '(' ')'                      -> { function: $1, types: ['UDFREF'] }
- | 'ANALYTIC' '(' ValueExpressionList ')'  -> { function: $1, expression: $2, types: ['UDFREF'] }
- ;
-
-AnalyticFunction_EDIT
- : 'ANALYTIC' '(' AnyCursor RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     parser.applyArgumentTypesToSuggestions($1, 1);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | 'ANALYTIC' '(' ValueExpressionList 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($3);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | 'ANALYTIC' '(' ValueExpressionList_EDIT RightParenthesisOrError
-   {
-     parser.applyArgumentTypesToSuggestions($1, $3.position);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- ;
-
-OptionalOverClause
- :
- | OverClause
- ;
-
-OptionalOverClause_EDIT
- : OverClause_EDIT
- ;
-
-OverClause
- : 'OVER' RegularOrBacktickedIdentifier
- | 'OVER' WindowExpression
- ;
-
-OverClause_EDIT
- : 'OVER' WindowExpression_EDIT
- ;
-
-WindowExpression
- : '(' OptionalPartitionBy OptionalOrderByAndWindow ')'
- ;
-
-WindowExpression_EDIT
- : '(' PartitionBy_EDIT OptionalOrderByAndWindow RightParenthesisOrError
-   {
-     if (parser.yy.result.suggestFunctions) {
-       parser.suggestAggregateFunctions();
-     }
-   }
- | '(' OptionalPartitionBy OptionalOrderByAndWindow_EDIT RightParenthesisOrError
-   {
-     if (parser.yy.result.suggestFunctions) {
-       parser.suggestAggregateFunctions();
-     }
-   }
- | '(' AnyCursor OptionalPartitionBy OptionalOrderByAndWindow RightParenthesisOrError
-   {
-     if (!$3 && !$4) {
-       parser.suggestKeywords([{ value: 'PARTITION BY', weight: 2 }, { value: 'ORDER BY', weight: 1 }]);
-     } else if (!$3) {
-       parser.suggestKeywords(['PARTITION BY']);
-     }
-   }
- | '(' 'PARTITION' 'BY' ValueExpressionList 'CURSOR' OptionalOrderByAndWindow RightParenthesisOrError
-    {
-      if (!$6) {
-        parser.suggestValueExpressionKeywords($4, [{ value: 'ORDER BY', weight: 2 }]);
-      } else {
-        parser.suggestValueExpressionKeywords($4);
-      }
-    }
-  ;
-
-OptionalPartitionBy
- :
- | PartitionBy
- ;
-
-PartitionBy
- : 'PARTITION' 'BY' ValueExpressionList  -> $3
- ;
-
-PartitionBy_EDIT
- : 'PARTITION' 'CURSOR'
-   {
-     parser.suggestKeywords(['BY']);
-   }
- | 'PARTITION' 'BY' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-   }
- | 'PARTITION' 'BY' ValueExpressionList_EDIT
- ;
-
-OptionalOrderByAndWindow
- :
- | OrderByClause OptionalWindowSpec
- ;
-
-OptionalOrderByAndWindow_EDIT
-  : OrderByClause_EDIT
-    {
-      // Only allowed in last order by
-      delete parser.yy.result.suggestAnalyticFunctions;
-    }
-  | OrderByClause 'CURSOR' OptionalWindowSpec
-    {
-      var keywords = [];
-      if ($1.suggestKeywords) {
-        keywords = parser.createWeightedKeywords($1.suggestKeywords, 2);
-      }
-      if (!$3) {
-        keywords = keywords.concat([{ value: 'RANGE BETWEEN', weight: 1 }, { value: 'ROWS BETWEEN', weight: 1 }]);
-      }
-      parser.suggestKeywords(keywords);
-    }
-  | OrderByClause WindowSpec_EDIT
-  ;
-
-OptionalWindowSpec
- :
- | WindowSpec
- ;
-
-WindowSpec
- : RowsOrRange 'BETWEEN' PopLexerState OptionalCurrentOrPreceding OptionalAndFollowing
- | RowsOrRange 'UNBOUNDED' PopLexerState OptionalCurrentOrPreceding OptionalAndFollowing
- ;
-
-WindowSpec_EDIT
- : RowsOrRange 'CURSOR'
-   {
-     parser.suggestKeywords(['BETWEEN']);
-   }
- | RowsOrRange 'BETWEEN' PopLexerState OptionalCurrentOrPreceding OptionalAndFollowing 'CURSOR'
-   {
-     if (!$4 && !$5) {
-       parser.suggestKeywords(['CURRENT ROW', 'UNBOUNDED PRECEDING']);
-     } else if (!$5) {
-       parser.suggestKeywords(['AND']);
-     }
-   }
- | RowsOrRange 'BETWEEN' PopLexerState OptionalCurrentOrPreceding_EDIT OptionalAndFollowing
- | RowsOrRange 'BETWEEN' PopLexerState OptionalCurrentOrPreceding OptionalAndFollowing_EDIT
- | RowsOrRange 'UNBOUNDED' PopLexerState OptionalCurrentOrPreceding 'CURSOR'
- | RowsOrRange 'UNBOUNDED' PopLexerState OptionalCurrentOrPreceding_EDIT
- ;
-
-PopLexerState
- :
-  {
-    lexer.popState();
-  }
- ;
-
-PushHdfsLexerState
- :
-  {
-    lexer.begin('hdfs');
-  }
- ;
-
-HdfsPath
- : 'HDFS_START_QUOTE' 'HDFS_PATH' 'HDFS_END_QUOTE'
- ;
-
-HdfsPath_EDIT
- : 'HDFS_START_QUOTE' 'HDFS_PATH' 'PARTIAL_CURSOR' 'HDFS_PATH' 'HDFS_END_QUOTE'
-    {
-      parser.suggestHdfs({ path: $2 });
-    }
- | 'HDFS_START_QUOTE' 'HDFS_PATH' 'PARTIAL_CURSOR' 'HDFS_END_QUOTE'
-   {
-     parser.suggestHdfs({ path: $2 });
-   }
- | 'HDFS_START_QUOTE' 'HDFS_PATH' 'PARTIAL_CURSOR'
-    {
-      parser.suggestHdfs({ path: $2 });
-    }
- | 'HDFS_START_QUOTE' 'PARTIAL_CURSOR' 'HDFS_END_QUOTE'
-   {
-     parser.suggestHdfs({ path: '' });
-   }
- | 'HDFS_START_QUOTE' 'PARTIAL_CURSOR'
-    {
-      parser.suggestHdfs({ path: '' });
-    }
- ;
-
-RowsOrRange
- : 'ROWS'
- | 'RANGE'
- ;
-
-OptionalCurrentOrPreceding
- :
- | IntegerOrUnbounded 'PRECEDING'
- | 'CURRENT' 'ROW'
- ;
-
-OptionalCurrentOrPreceding_EDIT
- : IntegerOrUnbounded 'CURSOR'
-   {
-     parser.suggestKeywords(['PRECEDING']);
-   }
- | 'CURRENT' 'CURSOR'
-   {
-     parser.suggestKeywords(['ROW']);
-   }
- ;
-
-OptionalAndFollowing
- :
- | 'AND' 'CURRENT' 'ROW'
- | 'AND' IntegerOrUnbounded 'FOLLOWING'
- ;
-
-OptionalAndFollowing_EDIT
- : 'AND' 'CURSOR'
-   {
-     parser.suggestKeywords(['CURRENT ROW', 'UNBOUNDED FOLLOWING']);
-   }
- | 'AND' 'CURRENT' 'CURSOR'
-   {
-     parser.suggestKeywords(['ROW']);
-   }
- | 'AND' IntegerOrUnbounded 'CURSOR'
-   {
-     parser.suggestKeywords(['FOLLOWING']);
-   }
- ;
-
-IntegerOrUnbounded
- : 'UNSIGNED_INTEGER'
- | 'UNBOUNDED'
- ;
-
-OptionalHavingClause
- :
- | HavingClause
- ;
-
-HavingClause
- : 'HAVING' ValueExpression
- ;
-
-HavingClause_EDIT
- : 'HAVING' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestAggregateFunctions();
-     parser.suggestSelectListAliases(true);
-   }
- | 'HAVING' ValueExpression_EDIT
-   {
-     parser.suggestAggregateFunctions();
-     parser.suggestSelectListAliases(true);
-   }
- ;
-
-CastFunction
- : 'CAST' '(' ValueExpression 'AS' PrimitiveType ')'  -> { types: [ $5.toUpperCase() ] }
- | 'CAST' '(' ')'                                      -> { types: [ 'T' ] }
- ;
-
-CastFunction_EDIT
- : 'CAST' '(' AnyCursor 'AS' PrimitiveType RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = { types: [ $5.toUpperCase() ] };
-   }
- | 'CAST' '(' AnyCursor 'AS' RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = { types: [ 'T' ] };
-   }
- | 'CAST' '(' AnyCursor RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = { types: [ 'T' ] };
-   }
- | 'CAST' '(' ValueExpression_EDIT 'AS' PrimitiveType RightParenthesisOrError  -> { types: [ $5.toUpperCase() ] }
- | 'CAST' '(' ValueExpression_EDIT 'AS' RightParenthesisOrError                -> { types: [ 'T' ] }
- | 'CAST' '(' ValueExpression_EDIT RightParenthesisOrError                      -> { types: [ 'T' ] }
- | 'CAST' '(' ValueExpression 'CURSOR' PrimitiveType RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($3, [{ value: 'AS', weight: 2 }]);
-     $$ =  { types: [ $5.toUpperCase() ] };
-   }
- | 'CAST' '(' ValueExpression 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($3, [{ value: 'AS', weight: 2 }]);
-     $$ = { types: [ 'T' ] };
-   }
- | 'CAST' '(' ValueExpression 'AS' 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-     $$ = { types: [ 'T' ] };
-   }
- | 'CAST' '(' 'AS' 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestKeywords(parser.getTypeKeywords());
-     $$ = { types: [ 'T' ] };
-   }
- ;
-
-CountFunction
- : 'COUNT' '(' '*' ')'                                        -> { function: $1, types: ['UDFREF'] }
- | 'COUNT' '(' ')'                                            -> { function: $1, types: ['UDFREF'] }
- | 'COUNT' '(' OptionalAllOrDistinct ValueExpressionList ')'  -> { function: $1, types: ['UDFREF'] }
- ;
-
-CountFunction_EDIT
- : 'COUNT' '(' OptionalAllOrDistinct AnyCursor RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     var keywords = parser.getSelectListKeywords();
-     if (!$3) {
-       keywords.push('DISTINCT');
-       if (parser.yy.result.suggestKeywords) {
-         keywords = parser.yy.result.suggestKeywords.concat(keywords);
-       }
-     }
-     parser.suggestKeywords(keywords);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | 'COUNT' '(' OptionalAllOrDistinct ValueExpressionList 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($4);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | 'COUNT' '(' OptionalAllOrDistinct ValueExpressionList_EDIT RightParenthesisOrError
-   {
-     if ($4.cursorAtStart) {
-       var keywords = parser.getSelectListKeywords();
-       if (!$3) {
-         keywords.push('DISTINCT');
-       }
-       parser.suggestKeywords(keywords);
-     }
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- ;
-
-OtherAggregateFunction
- : OtherAggregateFunction_Type '(' OptionalAllOrDistinct ')'                      -> { function: $1, types: ['UDFREF'] }
- | OtherAggregateFunction_Type '(' OptionalAllOrDistinct ValueExpressionList ')'  -> { function: $1, types: ['UDFREF'] }
- ;
-
-OtherAggregateFunction_EDIT
- : OtherAggregateFunction_Type '(' OptionalAllOrDistinct AnyCursor RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     var keywords = parser.getSelectListKeywords(true);
-     if (!$3) {
-       if ($1.toLowerCase() === 'group_concat') {
-         keywords.push('ALL');
-       } else {
-         keywords.push('DISTINCT');
-       }
-     }
-     if (parser.yy.result.suggestKeywords) {
-       keywords = parser.yy.result.suggestKeywords.concat(keywords);
-     }
-     parser.suggestKeywords(keywords);
-     parser.applyArgumentTypesToSuggestions($1, 1);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | OtherAggregateFunction_Type '(' OptionalAllOrDistinct ValueExpressionList 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($4);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | OtherAggregateFunction_Type '(' OptionalAllOrDistinct ValueExpressionList_EDIT RightParenthesisOrError
-   {
-     if ($4.cursorAtStart) {
-       var keywords = parser.getSelectListKeywords(true);
-       if (!$3) {
-         if ($1.toLowerCase() === 'group_concat') {
-           keywords.push('ALL');
-         } else {
-           keywords.push('DISTINCT');
-         }
-       }
-       if (parser.yy.result.suggestKeywords) {
-         keywords = parser.yy.result.suggestKeywords.concat(keywords);
-       }
-       parser.suggestKeywords(keywords);
-     }
-     if (parser.yy.result.suggestFunctions && !parser.yy.result.suggestFunctions.types) {
-       parser.applyArgumentTypesToSuggestions($1, $4.position);
-     }
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- ;
-
-OtherAggregateFunction_Type
- : 'AVG'
- | 'MAX'
- | 'MIN'
- | 'STDDEV_POP'
- | 'STDDEV_SAMP'
- | 'VAR_POP'
- | 'VAR_SAMP'
- | 'VARIANCE'
- ;
-
-FromOrComma
- : 'FROM'
- | ','
- ;
-
-SumFunction
- : 'SUM' '(' OptionalAllOrDistinct ValueExpression ')'  -> { function: $1, types: ['UDFREF'] }
- | 'SUM' '(' ')'                                        -> { function: $1, types: ['UDFREF'] }
- ;
-
-SumFunction_EDIT
- : 'SUM' '(' OptionalAllOrDistinct AnyCursor RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     parser.applyArgumentTypesToSuggestions($1, 1);
-     var keywords = parser.getSelectListKeywords(true);
-     if (!$3) {
-       keywords.push('DISTINCT');
-     }
-     if (parser.yy.result.suggestKeywords) {
-       keywords = parser.yy.result.suggestKeywords.concat(keywords);
-     }
-     parser.suggestKeywords(keywords);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | 'SUM' '(' OptionalAllOrDistinct ValueExpression 'CURSOR' RightParenthesisOrError
-   {
-     parser.suggestValueExpressionKeywords($4);
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- | 'SUM' '(' OptionalAllOrDistinct ValueExpression_EDIT RightParenthesisOrError
-   {
-     if (parser.yy.result.suggestFunctions && ! parser.yy.result.suggestFunctions.types) {
-       parser.applyArgumentTypesToSuggestions($1, 1);
-     }
-     $$ = { function: $1, types: ['UDFREF'] };
-   }
- ;

+ 0 - 46
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_set.jison

@@ -1,46 +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
- : SetSpecification
- ;
-
-DataDefinition_EDIT
- : 'SET' 'CURSOR'
-   {
-     parser.suggestSetOptions();
-   }
- ;
-
-SetSpecification
- : 'SET' SetOption '=' SetValue
- | 'SET' 'ALL'
- ;
-
-SetOption
- : RegularIdentifier
- | SetOption '.' RegularIdentifier
- ;
-
-SetValue
- : RegularIdentifier
- | SignedInteger
- | SignedInteger RegularIdentifier
- | QuotedValue
- | 'TRUE'
- | 'FALSE'
- | 'NULL'
- ;

+ 0 - 122
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_update.jison

@@ -1,122 +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.
-
-DataManipulation
- : UpdateStatement
- ;
-
-DataManipulation_EDIT
- : UpdateStatement_EDIT
- ;
-
-UpdateStatement
- : 'UPDATE' TargetTable 'SET' SetClauseList OptionalFromJoinedTable OptionalWhereClause
- ;
-
-UpdateStatement_EDIT
- : 'UPDATE' TargetTable_EDIT 'SET' SetClauseList OptionalFromJoinedTable OptionalWhereClause
- | 'UPDATE' TargetTable 'SET' SetClauseList_EDIT OptionalFromJoinedTable OptionalWhereClause
- | 'UPDATE' TargetTable 'SET' SetClauseList FromJoinedTable_EDIT OptionalWhereClause
- | 'UPDATE' TargetTable 'SET' SetClauseList OptionalFromJoinedTable WhereClause_EDIT
- | 'UPDATE' TargetTable 'SET' SetClauseList OptionalFromJoinedTable OptionalWhereClause 'CURSOR'
-   {
-     parser.suggestKeywords([ 'WHERE' ]);
-   }
- | 'UPDATE' TargetTable 'CURSOR'
-   {
-     parser.suggestKeywords([ 'SET' ]);
-   }
- | 'UPDATE' TargetTable_EDIT
- | 'UPDATE' TargetTable
- | 'UPDATE' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- ;
-
-TargetTable
- : TableName
- ;
-
-TargetTable_EDIT
- : TableName_EDIT
- ;
-
-TableName
- : LocalOrSchemaQualifiedName
-   {
-     parser.addTablePrimary($1);
-   }
- ;
-
-TableName_EDIT
- : LocalOrSchemaQualifiedName_EDIT
- ;
-
-SetClauseList
- : SetClause
- | SetClauseList ',' SetClause
- ;
-
-SetClauseList_EDIT
- : SetClause_EDIT
- | SetClauseList ',' SetClause_EDIT
- | SetClause_EDIT ',' SetClauseList
- | SetClauseList ',' SetClause_EDIT ',' SetClauseList
- ;
-
-SetClause
- : SetTarget '=' UpdateSource
- ;
-
-SetClause_EDIT
- : SetTarget '=' UpdateSource_EDIT
- | SetTarget 'CURSOR'
-   {
-     parser.suggestKeywords([ '=' ]);
-   }
- | 'CURSOR'
-   {
-     parser.suggestColumns();
-   }
- ;
-
-SetTarget
- : ColumnReference
- ;
-
-UpdateSource
- : ValueExpression
- ;
-
-UpdateSource_EDIT
- : ValueExpression_EDIT
- ;
-
-OptionalFromJoinedTable
- :
- | 'FROM' TableReference  -> $2
- ;
-
-FromJoinedTable_EDIT
- : 'FROM' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'FROM' TableReference_EDIT
- ;

+ 0 - 39
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_use.jison

@@ -1,39 +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
- : UseStatement
- ;
-
-DataDefinition_EDIT
- : UseStatement_EDIT
- ;
-
-UseStatement
- : 'USE' RegularIdentifier
-   {
-     if (! parser.yy.cursorFound) {
-       parser.yy.result.useDatabase = $2;
-     }
-   }
- ;
-
-UseStatement_EDIT
- : 'USE' 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- ;

+ 0 - 839
desktop/core/src/desktop/js/parse/jison/sql/flink/sql_valueExpression.jison

@@ -1,839 +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.
-
-ValueExpression
- : 'NOT' ValueExpression
-   {
-     // verifyType($2, 'BOOLEAN');
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | '!' ValueExpression
-   {
-     // verifyType($2, 'BOOLEAN');
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | '~' ValueExpression                                                 -> $2
- | '-' ValueExpression %prec NEGATION
-   {
-     // verifyType($2, 'NUMBER');
-     $$ = $2;
-     $2.types = ['NUMBER'];
-   }
- | ValueExpression 'IS' OptionalNot 'NULL'                             -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'IS' OptionalNot 'TRUE'                             -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'IS' OptionalNot 'FALSE'                            -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'IS' OptionalNot 'DISTINCT' 'FROM' ValueExpression  -> { types: [ 'BOOLEAN' ] }
- ;
-
-ValueExpression_EDIT
- : 'NOT' ValueExpression_EDIT                           -> { types: [ 'BOOLEAN' ], suggestFilters: $2.suggestFilters }
- | 'NOT' 'CURSOR'
-   {
-     parser.suggestFunctions();
-     parser.suggestColumns();
-     parser.suggestKeywords(['EXISTS']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | '!' ValueExpression_EDIT                             -> { types: [ 'BOOLEAN' ], suggestFilters: $2.suggestFilters }
- | '!' AnyCursor
-   {
-     parser.suggestFunctions({ types: [ 'BOOLEAN' ] });
-     parser.suggestColumns({ types: [ 'BOOLEAN' ] });
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | '~' ValueExpression_EDIT                             -> { types: [ 'T' ], suggestFilters: $2.suggestFilters }
- | '~' 'PARTIAL_CURSOR'
-   {
-     parser.suggestFunctions();
-     parser.suggestColumns();
-     $$ = { types: [ 'T' ] };
-   }
- | '-' ValueExpression_EDIT %prec NEGATION
-   {
-     if (!$2.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $2.suggestFilters };
-   }
- | '-' 'PARTIAL_CURSOR' %prec NEGATION
-   {
-     parser.suggestFunctions({ types: [ 'NUMBER' ] });
-     parser.suggestColumns({ types: [ 'NUMBER' ] });
-     $$ = { types: [ 'NUMBER' ] };
-   }
- | ValueExpression 'IS' 'CURSOR'
-   {
-     parser.suggestKeywords(['FALSE', 'NOT NULL', 'NOT TRUE', 'NOT FALSE', 'NULL', 'TRUE']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' 'NOT' 'CURSOR'
-   {
-     parser.suggestKeywords(['FALSE', 'NULL', 'TRUE']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' OptionalNot 'DISTINCT' 'CURSOR'
-   {
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' 'CURSOR' 'NULL'
-   {
-     parser.suggestKeywords(['NOT']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' 'CURSOR' 'FALSE'
-   {
-     parser.suggestKeywords(['NOT']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' 'CURSOR' 'TRUE'
-   {
-     parser.suggestKeywords(['NOT']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' OptionalNot 'DISTINCT' 'FROM' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest($1, $3 ? 'IS NOT DISTINCT FROM' : 'IS DISTINCT FROM');
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'IS' OptionalNot 'DISTINCT' 'FROM' ValueExpression_EDIT
-   {
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $6.suggestFilters }
-   }
- ;
-
-// ------------------  EXISTS and parenthesized ------------------
-ValueExpression
- : 'EXISTS' TableSubQuery
-   {
-     $$ = { types: [ 'BOOLEAN' ] };
-     // clear correlated flag after completed sub-query (set by lexer)
-     parser.yy.correlatedSubQuery = false;
-   }
- | '(' ValueExpression ')'                                -> $2
- ;
-
-ValueExpression_EDIT
- : 'EXISTS' TableSubQuery_EDIT                               -> { types: [ 'BOOLEAN' ] }
- | '(' ValueExpression_EDIT RightParenthesisOrError
-   {
-     $$ = $2;
-   }
- | '(' 'CURSOR' RightParenthesisOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = { types: ['T'], typeSet: true };
-   }
- ;
-
-// ------------------  COMPARISON ------------------
-
-ValueExpression
- : ValueExpression '=' ValueExpression
-   {
-     parser.addColRefToVariableIfExists($1, $3);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression '<' ValueExpression
-   {
-     parser.addColRefToVariableIfExists($1, $3);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression '>' ValueExpression
-   {
-     parser.addColRefToVariableIfExists($1, $3);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'COMPARISON_OPERATOR' ValueExpression
-   {
-     parser.addColRefToVariableIfExists($1, $3);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- ;
-
-ValueExpression_EDIT
- : 'CURSOR' '=' ValueExpression
-   {
-     parser.valueExpressionSuggest($3, $2);
-     parser.applyTypeToSuggestions($3);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true };
-   }
- | 'CURSOR' '<' ValueExpression
-   {
-     parser.valueExpressionSuggest($3, $2);
-     parser.applyTypeToSuggestions($3);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | 'CURSOR' '>' ValueExpression
-   {
-     parser.valueExpressionSuggest($3, $2);
-     parser.applyTypeToSuggestions($3);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | 'CURSOR' 'COMPARISON_OPERATOR' ValueExpression
-   {
-     parser.valueExpressionSuggest($3, $2);
-     parser.applyTypeToSuggestions($3);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression_EDIT '=' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions($3);
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression_EDIT '<' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions($3);
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression_EDIT '>' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions($3);
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression_EDIT 'COMPARISON_OPERATOR' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions($3);
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression '=' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest($1, $2);
-     parser.applyTypeToSuggestions($1);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression '<' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest($1, $2);
-     parser.applyTypeToSuggestions($1);
-     $$ = { types: [ 'BOOLEAN' ] , typeSet: true, endsWithLessThanOrEqual: true };
-   }
- | ValueExpression '>' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest($1, $2);
-     parser.applyTypeToSuggestions($1);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression 'COMPARISON_OPERATOR' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest($1, $2);
-     parser.applyTypeToSuggestions($1);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true, endsWithLessThanOrEqual: $2 === '<='  };
-   }
- | ValueExpression '=' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions($1);
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters }
-   }
- | ValueExpression '<' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions($1);
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters }
-   }
- | ValueExpression '>' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions($1);
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters }
-   }
- | ValueExpression 'COMPARISON_OPERATOR' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions($1);
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters }
-   }
- ;
-
-
-// ------------------  IN ------------------
-
-ValueExpression
- : ValueExpression 'NOT' 'IN' '(' TableSubQueryInner ')'   -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'NOT' 'IN' '(' ValueExpressionList ')'  -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'IN' '(' TableSubQueryInner ')'         -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'IN' '(' ValueExpressionList ')'        -> { types: [ 'BOOLEAN' ] }
- ;
-
-ValueExpression_EDIT
- : ValueExpression 'NOT' 'IN' ValueExpressionInSecondPart_EDIT
-   {
-     if ($4.inValueEdit) {
-       parser.valueExpressionSuggest($1, $2 + ' ' + $3);
-       parser.applyTypeToSuggestions($1);
-     }
-     if ($4.cursorAtStart) {
-       parser.suggestKeywords(['SELECT']);
-     }
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression 'IN' ValueExpressionInSecondPart_EDIT
-   {
-     if ($3.inValueEdit) {
-       parser.valueExpressionSuggest($1, $2);
-       parser.applyTypeToSuggestions($1);
-     }
-     if ($3.cursorAtStart) {
-       parser.suggestKeywords(['SELECT']);
-     }
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression_EDIT 'NOT' 'IN' '(' ValueExpressionList RightParenthesisOrError  -> { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
- | ValueExpression_EDIT 'NOT' 'IN' '(' TableSubQueryInner RightParenthesisOrError   -> { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
- | ValueExpression_EDIT 'IN' '(' ValueExpressionList RightParenthesisOrError        -> { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
- | ValueExpression_EDIT 'IN' '(' TableSubQueryInner RightParenthesisOrError         -> { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
- ;
-
-ValueExpressionInSecondPart_EDIT
- : '(' TableSubQueryInner_EDIT RightParenthesisOrError
- | '(' ValueExpressionList_EDIT RightParenthesisOrError -> { inValueEdit: true }
- | '(' AnyCursor RightParenthesisOrError                -> { inValueEdit: true, cursorAtStart: true }
- ;
-
-// ------------------  BETWEEN ------------------
-
-ValueExpression
- : ValueExpression 'NOT' 'BETWEEN' ValueExpression 'BETWEEN_AND' ValueExpression  -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'BETWEEN' ValueExpression 'BETWEEN_AND' ValueExpression        -> { types: [ 'BOOLEAN' ] }
- ;
-
-ValueExpression_EDIT
- : ValueExpression_EDIT 'NOT' 'BETWEEN' ValueExpression 'BETWEEN_AND' ValueExpression
-   {
-     if ($4.types[0] === $6.types[0] && !$1.typeSet) {
-       parser.applyTypeToSuggestions($4);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters };
-   }
- | ValueExpression 'NOT' 'BETWEEN' ValueExpression_EDIT 'BETWEEN_AND' ValueExpression
-   {
-     if ($1.types[0] === $6.types[0] && !$4.typeSet) {
-       parser.applyTypeToSuggestions($1);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $4.suggestFilters };
-   }
- | ValueExpression 'NOT' 'BETWEEN' ValueExpression 'BETWEEN_AND' ValueExpression_EDIT
-   {
-     if ($1.types[0] === $4.types[0] && !$6.typeSet) {
-       parser.applyTypeToSuggestions($1);
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $6.suggestFilters };
-   }
- | ValueExpression 'NOT' 'BETWEEN' ValueExpression 'BETWEEN_AND' 'CURSOR'
-   {
-     parser.valueExpressionSuggest($1, $5);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression 'NOT' 'BETWEEN' ValueExpression 'CURSOR'
-   {
-     parser.suggestValueExpressionKeywords($4, ['AND']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'NOT' 'BETWEEN' 'CURSOR'
-   {
-     parser.valueExpressionSuggest($1, $2 + ' ' + $3);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression_EDIT 'BETWEEN' ValueExpression 'BETWEEN_AND' ValueExpression
-   {
-     if ($1.types[0] === $3.types[0] && !$1.typeSet) {
-       parser.applyTypeToSuggestions($1)
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters };
-   }
- | ValueExpression 'BETWEEN' ValueExpression_EDIT 'BETWEEN_AND' ValueExpression
-   {
-     if ($1.types[0] === $3.types[0] && !$3.typeSet) {
-       parser.applyTypeToSuggestions($1)
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters };
-   }
- | ValueExpression 'BETWEEN' ValueExpression 'BETWEEN_AND' ValueExpression_EDIT
-   {
-     if ($1.types[0] === $3.types[0] && !$5.typeSet) {
-       parser.applyTypeToSuggestions($1)
-     }
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $5.suggestFilters };
-   }
- | ValueExpression 'BETWEEN' ValueExpression 'BETWEEN_AND' 'CURSOR'
-   {
-     parser.valueExpressionSuggest($1, $4);
-     parser.applyTypeToSuggestions($1);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true  };
-   }
- | ValueExpression 'BETWEEN' ValueExpression 'CURSOR'
-   {
-     parser.suggestValueExpressionKeywords($3, ['AND']);
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'BETWEEN' 'CURSOR'
-   {
-     parser.valueExpressionSuggest($1, $2);
-     parser.applyTypeToSuggestions($1);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true };
-   }
- ;
-
-// ------------------  BOOLEAN ------------------
-
-ValueExpression
- : ValueExpression 'OR' ValueExpression
-   {
-     // verifyType($1, 'BOOLEAN');
-     // verifyType($3, 'BOOLEAN');
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- | ValueExpression 'AND' ValueExpression
-   {
-     // verifyType($1, 'BOOLEAN');
-     // verifyType($3, 'BOOLEAN');
-     $$ = { types: [ 'BOOLEAN' ] };
-   }
- ;
-
-ValueExpression_EDIT
- : 'CURSOR' 'OR' ValueExpression
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true, suggestFilters: true };
-   }
- | ValueExpression_EDIT 'OR' ValueExpression
-   {
-     parser.addColRefIfExists($3);
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression 'OR' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true, suggestFilters: true };
-   }
- | ValueExpression 'OR' ValueExpression_EDIT
-   {
-     parser.addColRefIfExists($1);
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters }
-   }
- | 'CURSOR' 'AND' ValueExpression
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true, suggestFilters: true };
-   }
- | ValueExpression_EDIT 'AND' ValueExpression
-   {
-     parser.addColRefIfExists($3);
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression 'AND' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true, suggestFilters: true };
-   }
- | ValueExpression 'AND' ValueExpression_EDIT
-   {
-     parser.addColRefIfExists($1);
-     $$ = { types: [ 'BOOLEAN' ], suggestFilters: $3.suggestFilters }
-   }
- ;
-
-// ------------------  ARITHMETIC ------------------
-
-ValueExpression
- : ValueExpression '-' ValueExpression
-   {
-     // verifyType($1, 'NUMBER');
-     // verifyType($3, 'NUMBER');
-     $$ = { types: [ 'NUMBER' ] };
-   }
- | ValueExpression '*' ValueExpression
-   {
-     // verifyType($1, 'NUMBER');
-     // verifyType($3, 'NUMBER');
-     $$ = { types: [ 'NUMBER' ] };
-   }
- | ValueExpression 'ARITHMETIC_OPERATOR' ValueExpression
-   {
-     // verifyType($1, 'NUMBER');
-     // verifyType($3, 'NUMBER');
-     $$ = { types: [ 'NUMBER' ] };
-   }
- ;
-
-ValueExpression_EDIT
- : 'CURSOR' '*' ValueExpression
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     parser.applyTypeToSuggestions({ types: [ 'NUMBER' ] });
-     $$ = { types: [ 'NUMBER' ], typeSet: true };
-   }
- | 'CURSOR' 'ARITHMETIC_OPERATOR' ValueExpression
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     parser.applyTypeToSuggestions({ types: [ 'NUMBER' ] });
-     $$ = { types: [ 'NUMBER' ], typeSet: true };
-   }
- | ValueExpression_EDIT '-' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression_EDIT '*' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression_EDIT 'ARITHMETIC_OPERATOR' ValueExpression
-   {
-     if (!$1.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-       parser.addColRefIfExists($3);
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $1.suggestFilters }
-   }
- | ValueExpression '-' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-     $$ = { types: [ 'NUMBER' ], typeSet: true };
-   }
- | ValueExpression '*' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-     $$ = { types: [ 'NUMBER' ], typeSet: true };
-   }
- | ValueExpression 'ARITHMETIC_OPERATOR' PartialBacktickedOrAnyCursor
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-     $$ = { types: [ 'NUMBER' ], typeSet: true };
-   }
- | ValueExpression '-' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $3.suggestFilters };
-   }
- | ValueExpression '*' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $3.suggestFilters };
-   }
- | ValueExpression 'ARITHMETIC_OPERATOR' ValueExpression_EDIT
-   {
-     if (!$3.typeSet) {
-       parser.applyTypeToSuggestions({ types: ['NUMBER'] });
-       parser.addColRefIfExists($1);
-     }
-     $$ = { types: [ 'NUMBER' ], suggestFilters: $3.suggestFilters };
-   }
- ;
-
-// ------------------  LIKE, RLIKE and REGEXP ------------------
-
-ValueExpression
- : ValueExpression LikeRightPart          -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'NOT' LikeRightPart    -> { types: [ 'BOOLEAN' ] }
- ;
-
-LikeRightPart
- : 'LIKE' ValueExpression             -> { suggestKeywords: ['NOT'] }
- | 'RLIKE' ValueExpression            -> { suggestKeywords: ['NOT'] }
- | 'REGEXP' ValueExpression           -> { suggestKeywords: ['NOT'] }
- ;
-
-LikeRightPart_EDIT
- : 'LIKE' ValueExpression_EDIT
- | 'RLIKE' ValueExpression_EDIT
- | 'REGEXP' ValueExpression_EDIT
- | 'LIKE' PartialBacktickedOrCursor
-   {
-     parser.suggestFunctions({ types: [ 'STRING' ] });
-     parser.suggestColumns({ types: [ 'STRING' ] });
-     $$ = { types: ['BOOLEAN'] }
-   }
- | 'RLIKE' PartialBacktickedOrCursor
-   {
-     parser.suggestFunctions({ types: [ 'STRING' ] });
-     parser.suggestColumns({ types: [ 'STRING' ] });
-     $$ = { types: ['BOOLEAN'] }
-   }
- | 'REGEXP' PartialBacktickedOrCursor
-   {
-     parser.suggestFunctions({ types: [ 'STRING' ] });
-     parser.suggestColumns({ types: [ 'STRING' ] });
-     $$ = { types: ['BOOLEAN'] }
-   }
- ;
-
-ValueExpression_EDIT
- : ValueExpression_EDIT LikeRightPart               -> { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
- | ValueExpression_EDIT 'NOT' LikeRightPart         -> { types: [ 'BOOLEAN' ], suggestFilters: $1.suggestFilters }
- | ValueExpression LikeRightPart_EDIT               -> { types: [ 'BOOLEAN' ] }
- | ValueExpression 'NOT' LikeRightPart_EDIT         -> { types: [ 'BOOLEAN' ] }
- | 'CURSOR' LikeRightPart
-   {
-     parser.valueExpressionSuggest(undefined, $2);
-     parser.applyTypeToSuggestions({ types: [ 'STRING' ] });
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true };
-   }
- | 'CURSOR' 'NOT' LikeRightPart
-   {
-     parser.valueExpressionSuggest(undefined, $2 + ' ' + $3);
-     parser.applyTypeToSuggestions({ types: [ 'STRING' ] });
-     $$ = { types: [ 'BOOLEAN' ], typeSet: true };
-   }
- ;
-
-// ------------------  CASE, WHEN, THEN ------------------
-
-ValueExpression
- : 'CASE' CaseRightPart                  -> $2
- | 'CASE' ValueExpression CaseRightPart  -> $3
- ;
-
-ValueExpression_EDIT
- : 'CASE' CaseRightPart_EDIT                         -> $2
- | 'CASE' 'CURSOR' EndOrError
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestKeywords(['WHEN']);
-     $$ = { types: [ 'T' ], typeSet: true };
-   }
- | 'CASE' ValueExpression CaseRightPart_EDIT         -> $3
- | 'CASE' ValueExpression 'CURSOR' EndOrError
-   {
-     parser.suggestValueExpressionKeywords($2, ['WHEN']);
-     $$ = { types: [ 'T' ], typeSet: true };
-   }
- | 'CASE' ValueExpression_EDIT CaseRightPart
-    {
-      $$ = $3;
-      $$.suggestFilters = $2.suggestFilters;
-    }
- | 'CASE' ValueExpression_EDIT EndOrError            -> { types: [ 'T' ], suggestFilters: $2.suggestFilters }
- | 'CASE' 'CURSOR' CaseRightPart                     -> { types: [ 'T' ] }
- ;
-
-CaseRightPart
- : CaseWhenThenList 'END'                         -> parser.findCaseType($1)
- | CaseWhenThenList 'ELSE' ValueExpression 'END'
-   {
-     $1.caseTypes.push($3);
-     $$ = parser.findCaseType($1);
-   }
- ;
-
-CaseRightPart_EDIT
- : CaseWhenThenList_EDIT EndOrError                            -> parser.findCaseType($1)
- | CaseWhenThenList 'ELSE' ValueExpression 'CURSOR'
-   {
-     parser.suggestValueExpressionKeywords($3, ['END']);
-     $1.caseTypes.push($3);
-     $$ = parser.findCaseType($1);
-   }
- | CaseWhenThenList_EDIT 'ELSE' ValueExpression EndOrError
-   {
-     $1.caseTypes.push($3);
-     $$ = parser.findCaseType($1);
-   }
- | CaseWhenThenList_EDIT 'ELSE' EndOrError                      -> parser.findCaseType($1)
- | CaseWhenThenList 'CURSOR' ValueExpression EndOrError
-   {
-     if ($4.toLowerCase() !== 'end') {
-       parser.suggestValueExpressionKeywords($1, [{ value: 'END', weight: 3 }, { value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
-     } else {
-       parser.suggestValueExpressionKeywords($1, [{ value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
-     }
-     $$ = parser.findCaseType($1);
-   }
- | CaseWhenThenList 'CURSOR' EndOrError
-   {
-     if ($3.toLowerCase() !== 'end') {
-       parser.suggestValueExpressionKeywords($1, [{ value: 'END', weight: 3 }, { value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
-     } else {
-       parser.suggestValueExpressionKeywords($1, [{ value: 'ELSE', weight: 2 }, { value: 'WHEN', weight: 1 }]);
-     }
-     $$ = parser.findCaseType($1);
-   }
- | CaseWhenThenList 'ELSE' ValueExpression_EDIT EndOrError
-   {
-     $1.caseTypes.push($3);
-     $$ = parser.findCaseType($1);
-     $$.suggestFilters = $3.suggestFilters
-   }
- | CaseWhenThenList 'ELSE' 'CURSOR' EndOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = parser.findCaseType($1);
-   }
- | 'ELSE' 'CURSOR' EndOrError
-   {
-     parser.valueExpressionSuggest();
-     $$ = { types: [ 'T' ], typeSet: true };
-   }
- | 'CURSOR' 'ELSE' ValueExpression EndOrError
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestKeywords(['WHEN']);
-     $$ = $3;
-   }
- | 'CURSOR' 'ELSE' EndOrError
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestKeywords(['WHEN']);
-     $$ = { types: [ 'T' ] };
-   }
- ;
-
-EndOrError
- : 'END'
- | error
- ;
-
-CaseWhenThenList
- : CaseWhenThenListPartTwo                   -> { caseTypes: [ $1 ], lastType: $1 }
- | CaseWhenThenList CaseWhenThenListPartTwo
-   {
-     $1.caseTypes.push($2);
-     $$ = { caseTypes: $1.caseTypes, lastType: $2 };
-   }
- ;
-
-CaseWhenThenList_EDIT
- : CaseWhenThenListPartTwo_EDIT
- | CaseWhenThenList CaseWhenThenListPartTwo_EDIT
- | CaseWhenThenList CaseWhenThenListPartTwo_EDIT CaseWhenThenList
- | CaseWhenThenList 'CURSOR' CaseWhenThenList
-   {
-     parser.suggestValueExpressionKeywords($1, ['WHEN']);
-   }
- | CaseWhenThenListPartTwo_EDIT CaseWhenThenList                   -> $2
- ;
-
-CaseWhenThenListPartTwo
- : 'WHEN' ValueExpression 'THEN' ValueExpression  -> $4
- ;
-
-CaseWhenThenListPartTwo_EDIT
- : 'WHEN' ValueExpression_EDIT                         -> { caseTypes: [{ types: ['T'] }], suggestFilters: $2.suggestFilters }
- | 'WHEN' ValueExpression_EDIT 'THEN'                  -> { caseTypes: [{ types: ['T'] }], suggestFilters: $2.suggestFilters }
- | 'WHEN' ValueExpression_EDIT 'THEN' ValueExpression  -> { caseTypes: [$4], suggestFilters: $2.suggestFilters }
- | 'WHEN' ValueExpression 'THEN' ValueExpression_EDIT  -> { caseTypes: [$4], suggestFilters: $4.suggestFilters }
- | 'WHEN' 'THEN' ValueExpression_EDIT                  -> { caseTypes: [$3], suggestFilters: $3.suggestFilters }
- | 'CURSOR' ValueExpression 'THEN'
-   {
-     parser.suggestKeywords(['WHEN']);
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'CURSOR' ValueExpression 'THEN' ValueExpression
-   {
-     parser.suggestKeywords(['WHEN']);
-     $$ = { caseTypes: [$4] };
-   }
- | 'CURSOR' 'THEN'
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestKeywords(['WHEN']);
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'CURSOR' 'THEN' ValueExpression
-    {
-      parser.valueExpressionSuggest();
-      parser.suggestKeywords(['WHEN']);
-      $$ = { caseTypes: [{ types: ['T'] }] };
-    }
- | 'WHEN' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
-   }
- | 'WHEN' 'CURSOR' ValueExpression
-   {
-     parser.valueExpressionSuggest();
-     parser.suggestKeywords(['THEN']);
-     $$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
-   }
- | 'WHEN' 'CURSOR' 'THEN'
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };
-   }
- | 'WHEN' 'CURSOR' 'THEN' ValueExpression
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [$4], suggestFilters: true };
-   }
- | 'WHEN' ValueExpression 'CURSOR'
-   {
-     parser.suggestValueExpressionKeywords($2, ['THEN']);
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'WHEN' ValueExpression 'CURSOR' ValueExpression
-   {
-     parser.suggestValueExpressionKeywords($2, ['THEN']);
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'WHEN' ValueExpression 'THEN' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'WHEN' ValueExpression 'THEN' 'CURSOR' ValueExpression
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'WHEN' 'THEN' 'CURSOR' ValueExpression
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- | 'WHEN' 'THEN' 'CURSOR'
-   {
-     parser.valueExpressionSuggest();
-     $$ = { caseTypes: [{ types: ['T'] }] };
-   }
- ;

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

@@ -0,0 +1,30 @@
+{
+  "lexer": "../generic/sql.jisonlex",
+  "autocomplete": [
+    "../generic/autocomplete_header.jison",
+    "../generic/sql_alter.jison",
+    "../generic/sql_create.jison",
+    "../generic/sql_drop.jison",
+    "../generic/sql_error.jison",
+    "../generic/sql_insert.jison",
+    "../generic/sql_main.jison",
+    "../generic/sql_set.jison",
+    "../generic/sql_update.jison",
+    "../generic/sql_use.jison",
+    "../generic/sql_valueExpression.jison",
+    "../generic/autocomplete_footer.jison"
+  ],
+  "syntax": [
+    "../generic/syntax_header.jison",
+    "../generic/sql_alter.jison",
+    "../generic/sql_create.jison",
+    "../generic/sql_drop.jison",
+    "../generic/sql_insert.jison",
+    "../generic/sql_main.jison",
+    "../generic/sql_set.jison",
+    "../generic/sql_update.jison",
+    "../generic/sql_use.jison",
+    "../generic/sql_valueExpression.jison",
+    "../generic/syntax_footer.jison"
+  ]
+}

+ 0 - 19
desktop/core/src/desktop/js/parse/jison/sql/flink/syntax_footer.jison

@@ -1,19 +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.
-
-%%
-
-SqlParseSupport.initSyntaxParser(parser);

+ 0 - 28
desktop/core/src/desktop/js/parse/jison/sql/flink/syntax_header.jison

@@ -1,28 +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.
-
-%left 'AND' 'OR'
-%left 'BETWEEN'
-%left 'NOT' '!' '~'
-%left '=' '<' '>' 'COMPARISON_OPERATOR'
-%left '-' '*' 'ARITHMETIC_OPERATOR'
-
-%left ';' ','
-%nonassoc 'IN' 'IS' 'LIKE' 'RLIKE' 'REGEXP' 'EXISTS' NEGATION
-
-%start SqlSyntax
-
-%%

Разница между файлами не показана из-за своего большого размера
+ 138 - 138
desktop/core/src/desktop/js/parse/sql/flink/flinkAutocompleteParser.js


Разница между файлами не показана из-за своего большого размера
+ 134 - 134
desktop/core/src/desktop/js/parse/sql/flink/flinkSyntaxParser.js


Некоторые файлы не были показаны из-за большого количества измененных файлов