Browse Source

HUE-8856 [autocomplete] Extract jison for Hive DROP, GRANT, INSERT and LOAD

Johan Ahlen 6 năm trước cách đây
mục cha
commit
3b49117152

+ 3 - 3
desktop/core/src/desktop/js/parse/jison/hive/sql_alter.jison

@@ -530,20 +530,20 @@ DropOperations_EDIT
  ;
 
 AlterTableLeftSide
- : 'ALTER' AnyTable SchemaQualifiedTableIdentifier
+ : 'ALTER' 'TABLE' SchemaQualifiedTableIdentifier
    {
      parser.addTablePrimary($3);
    }
  ;
 
 AlterTableLeftSide_EDIT
- : 'ALTER' AnyTable SchemaQualifiedTableIdentifier_EDIT
+ : 'ALTER' 'TABLE' SchemaQualifiedTableIdentifier_EDIT
    {
      if (parser.yy.result.suggestTables) {
        parser.yy.result.suggestTables.onlyTables = true;
      }
    }
- | 'ALTER' AnyTable 'CURSOR'
+ | 'ALTER' 'TABLE' 'CURSOR'
    {
      parser.suggestTables({ onlyTables: true });
      parser.suggestDatabases({ appendDot: true });

+ 4 - 4
desktop/core/src/desktop/js/parse/jison/hive/sql_create.jison

@@ -161,18 +161,18 @@ PropertyAssignment
  ;
 
 TableDefinition
- : 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal AnyTable OptionalIfNotExists TableDefinitionRightPart
+ : 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal 'TABLE' OptionalIfNotExists TableDefinitionRightPart
  ;
 
 TableDefinition_EDIT
- : 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal AnyTable OptionalIfNotExists TableDefinitionRightPart_EDIT
- | 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal AnyTable OptionalIfNotExists 'CURSOR'
+ : 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal 'TABLE' OptionalIfNotExists TableDefinitionRightPart_EDIT
+ | 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal 'TABLE' OptionalIfNotExists 'CURSOR'
    {
      if (!$6) {
        parser.suggestKeywords(['IF NOT EXISTS']);
      }
    }
- | 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal AnyTable OptionalIfNotExists_EDIT
+ | 'CREATE' OptionalTemporary OptionalTransactional OptionalExternal 'TABLE' OptionalIfNotExists_EDIT
  ;
 
 TableDefinitionRightPart

+ 53 - 236
desktop/core/src/desktop/js/parse/jison/hive/sql_drop.jison

@@ -16,29 +16,26 @@
 
 DataDefinition
  : DropStatement
- | HiveAbortStatement
+ | AbortStatement
  ;
 
 DataDefinition_EDIT
  : DropStatement_EDIT
- | HiveAbortStatement_EDIT
+ | AbortStatement_EDIT
  ;
 
 DataManipulation
- : HiveDeleteStatement
- | ImpalaDeleteStatement
+ : DeleteStatement
  ;
 
 DataManipulation_EDIT
- : HiveDeleteStatement_EDIT
- | ImpalaDeleteStatement_EDIT
+ : DeleteStatement_EDIT
  ;
 
 DropStatement
  : DropDatabaseStatement
  | DropFunctionStatement
  | DropRoleStatement
- | DropStatsStatement
  | DropTableStatement
  | DropIndexStatement
  | DropMacroStatement
@@ -49,7 +46,6 @@ DropStatement
 DropStatement_EDIT
  : DropDatabaseStatement_EDIT
  | DropFunctionStatement_EDIT
- | DropStatsStatement_EDIT
  | DropTableStatement_EDIT
  | DropIndexStatement_EDIT
  | DropMacroStatement_EDIT
@@ -57,13 +53,7 @@ DropStatement_EDIT
  | TruncateTableStatement_EDIT
  | 'DROP' 'CURSOR'
    {
-     if (parser.isHive()) {
-       parser.suggestKeywords(['DATABASE', 'FUNCTION', 'INDEX', 'ROLE', 'SCHEMA', 'TABLE', 'TEMPORARY FUNCTION', 'TEMPORARY MACRO', 'VIEW']);
-     } else if (parser.isImpala()) {
-       parser.suggestKeywords(['AGGREGATE FUNCTION', 'DATABASE', 'FUNCTION', 'INCREMENTAL STATS', 'ROLE', 'SCHEMA', 'STATS', 'TABLE', 'VIEW']);
-     } else {
-       parser.suggestKeywords(['ROLE', 'SCHEMA', 'TABLE', 'VIEW']);
-     }
+     parser.suggestKeywords(['DATABASE', 'FUNCTION', 'INDEX', 'ROLE', 'SCHEMA', 'TABLE', 'TEMPORARY FUNCTION', 'TEMPORARY MACRO', 'VIEW']);
    }
  ;
 
@@ -83,9 +73,7 @@ DropDatabaseStatement_EDIT
    }
  | 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
    {
-     if (parser.isHive() || parser.isImpala()) {
-       parser.suggestKeywords(['CASCADE', 'RESTRICT']);
-     }
+     parser.suggestKeywords(['CASCADE', 'RESTRICT']);
    }
  | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
  | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR' RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
@@ -97,158 +85,49 @@ DropDatabaseStatement_EDIT
  ;
 
 DropFunctionStatement
- : DropImpalaFunction
- | DropHiveFunction
+ : 'DROP' 'FUNCTION' OptionalIfExists SchemaQualifiedIdentifier
+ | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists RegularIdentifier
  ;
 
 DropFunctionStatement_EDIT
- : DropImpalaFunction_EDIT
- | DropHiveFunction_EDIT
- ;
-
-// OptionalAggregate is no go for look ahead reasons
-DropImpalaFunction
- : 'DROP' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList
- | 'DROP' '<impala>AGGREGATE' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList
- ;
-
-DropImpalaFunction_EDIT
- : 'DROP' '<impala>FUNCTION' OptionalIfExists 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DROP' '<impala>AGGREGATE' '<impala>FUNCTION' OptionalIfExists 'CURSOR'
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DROP' '<impala>FUNCTION' OptionalIfExists 'CURSOR' SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList
-   {
-     if (!$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' '<impala>FUNCTION' OptionalIfExists_EDIT
- | 'DROP' 'CURSOR' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList
-   {
-     parser.suggestKeywords(['AGGREGATE']);
-   }
- | 'DROP' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList_EDIT
- | 'DROP' '<impala>AGGREGATE' 'CURSOR'
-   {
-     parser.suggestKeywords(['FUNCTION']);
-   }
- | 'DROP' '<impala>AGGREGATE' '<impala>FUNCTION' OptionalIfExists 'CURSOR' SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList
-   {
-     if (!$4) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
-   }
- | 'DROP' '<impala>AGGREGATE' '<impala>FUNCTION' OptionalIfExists_EDIT
- | 'DROP' '<impala>AGGREGATE' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier ParenthesizedImpalaArgumentList_EDIT
- | 'DROP' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier_EDIT ParenthesizedImpalaArgumentList
- | 'DROP' '<impala>AGGREGATE' '<impala>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier_EDIT ParenthesizedImpalaArgumentList
- ;
-
-DropHiveFunction
- : 'DROP' '<hive>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier
- | 'DROP' '<hive>TEMPORARY' '<hive>FUNCTION' OptionalIfExists RegularIdentifier
- ;
-
-DropHiveFunction_EDIT
- : 'DROP' '<hive>FUNCTION' OptionalIfExists 'CURSOR'
+ : 'DROP' 'FUNCTION' OptionalIfExists 'CURSOR'
    {
      if (!$3) {
        parser.suggestKeywords(['IF EXISTS']);
      }
    }
- | 'DROP' '<hive>FUNCTION' OptionalIfExists 'CURSOR' SchemaQualifiedIdentifier
+ | 'DROP' 'FUNCTION' OptionalIfExists 'CURSOR' SchemaQualifiedIdentifier
    {
      if (!$3) {
        parser.suggestKeywords(['IF EXISTS']);
      }
    }
- | 'DROP' '<hive>FUNCTION' OptionalIfExists_EDIT
- | 'DROP' '<hive>FUNCTION' OptionalIfExists_EDIT SchemaQualifiedIdentifier
- | 'DROP' '<hive>FUNCTION' OptionalIfExists SchemaQualifiedIdentifier_EDIT
- | 'DROP' '<hive>TEMPORARY' '<hive>FUNCTION' OptionalIfExists 'CURSOR'
+ | 'DROP' 'FUNCTION' OptionalIfExists_EDIT
+ | 'DROP' 'FUNCTION' OptionalIfExists_EDIT SchemaQualifiedIdentifier
+ | 'DROP' 'FUNCTION' OptionalIfExists SchemaQualifiedIdentifier_EDIT
+ | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists 'CURSOR'
    {
      if (!$4) {
        parser.suggestKeywords(['IF EXISTS']);
      }
    }
- | 'DROP' '<hive>TEMPORARY' '<hive>FUNCTION' OptionalIfExists_EDIT
+ | 'DROP' 'TEMPORARY' 'FUNCTION' OptionalIfExists_EDIT
  ;
 
 DropRoleStatement
  : 'DROP' 'ROLE' RegularIdentifier
  ;
 
-DropStatsStatement
- : 'DROP' '<impala>STATS' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($3);
-   }
- | 'DROP' '<impala>INCREMENTAL' '<impala>STATS' SchemaQualifiedTableIdentifier PartitionSpec
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
-DropStatsStatement_EDIT
- : 'DROP' '<impala>STATS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DROP' '<impala>STATS' SchemaQualifiedTableIdentifier_EDIT
- | 'DROP' 'CURSOR' '<impala>STATS' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($4);
-     parser.suggestKeywords(['INCREMENTAL']);
-   }
- | 'DROP' 'CURSOR' '<impala>STATS' SchemaQualifiedTableIdentifier PartitionSpec
-   {
-     parser.addTablePrimary($4);
-     parser.suggestKeywords(['INCREMENTAL']);
-   }
- | 'DROP' '<impala>INCREMENTAL' 'CURSOR'
-   {
-     parser.suggestKeywords(['STATS']);
-   }
- | 'DROP' '<impala>INCREMENTAL' '<impala>STATS' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | 'DROP' '<impala>INCREMENTAL' '<impala>STATS' SchemaQualifiedTableIdentifier_EDIT
- | 'DROP' '<impala>INCREMENTAL' '<impala>STATS' SchemaQualifiedTableIdentifier_EDIT PartitionSpec
- | 'DROP' '<impala>INCREMENTAL' '<impala>STATS' SchemaQualifiedTableIdentifier 'CURSOR'
-   {
-     parser.addTablePrimary($4);
-     parser.suggestKeywords(['PARTITION']);
-   }
- | 'DROP' '<impala>INCREMENTAL' '<impala>STATS' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
-   {
-     parser.addTablePrimary($4);
-   }
- ;
-
 DropTableStatement
- : 'DROP' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge
+ : 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge
    {
      parser.addTablePrimary($4);
    }
  ;
 
 DropTableStatement_EDIT
- : 'DROP' AnyTable OptionalIfExists_EDIT
- | 'DROP' AnyTable OptionalIfExists 'CURSOR'
+ : 'DROP' 'TABLE' OptionalIfExists_EDIT
+ | 'DROP' 'TABLE' OptionalIfExists 'CURSOR'
    {
      if (!$3) {
        parser.suggestKeywords(['IF EXISTS']);
@@ -258,14 +137,14 @@ DropTableStatement_EDIT
        appendDot: true
      });
    }
- | 'DROP' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier_EDIT OptionalPurge
+ | 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier_EDIT OptionalPurge
    {
      if (parser.yy.result.suggestTables) {
        parser.yy.result.suggestTables.onlyTables = true;
      }
    }
- | 'DROP' AnyTable OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPurge
- | 'DROP' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge 'CURSOR'
+ | 'DROP' 'TABLE' OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPurge
+ | 'DROP' 'TABLE' OptionalIfExists SchemaQualifiedTableIdentifier OptionalPurge 'CURSOR'
    {
      parser.addTablePrimary($4);
      if (!$5) {
@@ -277,51 +156,50 @@ DropTableStatement_EDIT
 OptionalPurge
  :
  | 'PURGE'
- | '<hive>PURGE'
  ;
 
 
 DropIndexStatement
- : 'DROP' '<hive>INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier
+ : 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier
    {
      parser.addTablePrimary($6);
    }
  ;
 
 DropIndexStatement_EDIT
- : 'DROP' '<hive>INDEX' OptionalIfExists 'CURSOR'
+ : 'DROP' 'INDEX' OptionalIfExists 'CURSOR'
    {
      parser.suggestKeywords(['IF EXISTS']);
    }
- | 'DROP' '<hive>INDEX' OptionalIfExists_EDIT
- | 'DROP' '<hive>INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
+ | 'DROP' 'INDEX' OptionalIfExists_EDIT
+ | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
    {
      parser.suggestKeywords(['ON']);
    }
- | 'DROP' '<hive>INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' 'CURSOR'
+ | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | 'DROP' '<hive>INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier_EDIT
+ | 'DROP' 'INDEX' OptionalIfExists RegularOrBacktickedIdentifier 'ON' SchemaQualifiedTableIdentifier_EDIT
  ;
 
 DropMacroStatement
- : 'DROP' '<hive>TEMPORARY' '<hive>MACRO' OptionalIfExists RegularIdentifier
+ : 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists RegularIdentifier
  ;
 
 DropMacroStatement_EDIT
- : 'DROP' '<hive>TEMPORARY' 'CURSOR'
+ : 'DROP' 'TEMPORARY' 'CURSOR'
    {
      parser.suggestKeywords(['FUNCTION', 'MACRO']);
    }
- | 'DROP' '<hive>TEMPORARY' '<hive>MACRO' OptionalIfExists 'CURSOR'
+ | 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists 'CURSOR'
    {
      if (!$4) {
        parser.suggestKeywords(['IF EXISTS']);
      }
    }
- | 'DROP' '<hive>TEMPORARY' '<hive>MACRO' OptionalIfExists_EDIT
+ | 'DROP' 'TEMPORARY' 'MACRO' OptionalIfExists_EDIT
  ;
 
 DropViewStatement
@@ -361,9 +239,9 @@ DropViewStatement_EDIT
  ;
 
 TruncateTableStatement
- : 'TRUNCATE' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ : 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
-     parser.addTablePrimary($4);
+     parser.addTablePrimary($3);
    }
  ;
 
@@ -372,127 +250,66 @@ TruncateTableStatement_EDIT
    {
      parser.suggestKeywords(['TABLE']);
    }
- | 'TRUNCATE' AnyTable OptionalIfExists 'CURSOR' OptionalPartitionSpec
+ | 'TRUNCATE' 'TABLE' 'CURSOR' OptionalPartitionSpec
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
-     if (parser.isImpala() && !$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
    }
- | 'TRUNCATE' AnyTable OptionalIfExists_EDIT OptionalPartitionSpec
- | 'TRUNCATE' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
- | 'TRUNCATE' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+ | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
    {
-     parser.addTablePrimary($4);
-     if (parser.isHive() && !$5) {
+     parser.addTablePrimary($3);
+     if (!$4) {
        parser.suggestKeywords(['PARTITION']);
      }
    }
- | 'TRUNCATE' AnyTable OptionalIfExists SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
+ | 'TRUNCATE' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
    {
-     parser.addTablePrimary($4);
+     parser.addTablePrimary($3);
    }
- | 'TRUNCATE' AnyTable OptionalIfExists 'CURSOR' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ | 'TRUNCATE' 'TABLE' 'CURSOR' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
      parser.addTablePrimary($4);
-     if (parser.isImpala() && !$3) {
-       parser.suggestKeywords(['IF EXISTS']);
-     }
    }
- | 'TRUNCATE' AnyTable OptionalIfExists_EDIT SchemaQualifiedTableIdentifier OptionalPartitionSpec
  ;
 
-HiveDeleteStatement
- : '<hive>DELETE' 'FROM' SchemaQualifiedTableIdentifier OptionalWhereClause
+DeleteStatement
+ : 'DELETE' 'FROM' SchemaQualifiedTableIdentifier OptionalWhereClause
    {
      parser.addTablePrimary($3);
    }
  ;
 
-HiveDeleteStatement_EDIT
- : '<hive>DELETE' 'CURSOR'
+DeleteStatement_EDIT
+ : 'DELETE' 'CURSOR'
    {
      parser.suggestKeywords(['FROM']);
    }
- | '<hive>DELETE' 'FROM' 'CURSOR'
+ | 'DELETE' 'FROM' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | '<hive>DELETE' 'FROM' SchemaQualifiedTableIdentifier 'CURSOR' OptionalWhereClause
+ | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier 'CURSOR' OptionalWhereClause
    {
      parser.addTablePrimary($3);
      if (!$5) {
        parser.suggestKeywords(['WHERE']);
      }
    }
- | '<hive>DELETE' 'FROM' SchemaQualifiedTableIdentifier_EDIT OptionalWhereClause
- | '<hive>DELETE' 'FROM' SchemaQualifiedTableIdentifier WhereClause_EDIT
+ | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier_EDIT OptionalWhereClause
+ | 'DELETE' 'FROM' SchemaQualifiedTableIdentifier WhereClause_EDIT
    {
      parser.addTablePrimary($3);
    }
  ;
 
-ImpalaDeleteStatement
- : '<impala>DELETE' OptionalImpalaDeleteTableRef 'FROM' TableReference OptionalWhereClause
- ;
-
-ImpalaDeleteStatement_EDIT
- : '<impala>DELETE' OptionalImpalaDeleteTableRef 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM']);
-     if (parser.isImpala() && !$2) {
-       parser.suggestTables();
-       parser.suggestDatabases({ appendDot: true });
-     }
-   }
- | '<impala>DELETE' ImpalaDeleteTableRef_EDIT
- | '<impala>DELETE' OptionalImpalaDeleteTableRef 'FROM' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | '<impala>DELETE' OptionalImpalaDeleteTableRef 'FROM' TableReference 'CURSOR' OptionalWhereClause
-   {
-     var keywords = [{ value: 'FULL JOIN', weight: 1 }, { value: 'FULL OUTER 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 }, { value: 'INNER JOIN', weight: 1 },  { value: 'LEFT ANTI JOIN', weight: 1 }, { value: 'LEFT SEMI JOIN', weight: 1 }, { value: 'RIGHT ANTI JOIN', weight: 1 }, { value: 'RIGHT SEMI JOIN', weight: 1 }];
-     if (!$6) {
-       keywords.push({ value: 'WHERE', weight: 3 });
-     }
-     if ($4.suggestJoinConditions) {
-       parser.suggestJoinConditions($4.suggestJoinConditions);
-     }
-     if ($4.suggestJoins) {
-       parser.suggestJoins($4.suggestJoins);
-     }
-     if ($4.suggestKeywords) {
-       keywords = keywords.concat(parser.createWeightedKeywords($4.suggestKeywords, 2));
-     }
-     if (keywords.length > 0) {
-       parser.suggestKeywords(keywords);
-     }
-   }
- | '<impala>DELETE' ImpalaDeleteTableRef_EDIT 'FROM'
- | '<impala>DELETE' ImpalaDeleteTableRef_EDIT 'FROM' TableReference OptionalWhereClause
- | '<impala>DELETE' OptionalImpalaDeleteTableRef 'FROM' TableReference_EDIT OptionalWhereClause
- | '<impala>DELETE' OptionalImpalaDeleteTableRef 'FROM' TableReference WhereClause_EDIT
- ;
-
-OptionalImpalaDeleteTableRef
- :
- | TableReference
- ;
-
-ImpalaDeleteTableRef_EDIT
- : TableReference_EDIT
- ;
-
-HiveAbortStatement
- : '<hive>ABORT' '<hive>TRANSACTIONS' TransactionIdList
+AbortStatement
+ : 'ABORT' 'TRANSACTIONS' TransactionIdList
  ;
 
-HiveAbortStatement_EDIT
- : '<hive>ABORT' 'CURSOR'
+AbortStatement_EDIT
+ : 'ABORT' 'CURSOR'
    {
      parser.suggestKeywords(['TRANSACTIONS']);
    }

+ 11 - 27
desktop/core/src/desktop/js/parse/jison/hive/sql_error.jison

@@ -22,13 +22,7 @@ SqlStatements
 SqlStatement_EDIT
  : AnyCursor error
    {
-     if (parser.isHive()) {
-       parser.suggestDdlAndDmlKeywords(['EXPLAIN', 'FROM']);
-     } else if (parser.isImpala()) {
-       parser.suggestDdlAndDmlKeywords(['EXPLAIN']);
-     } else {
-       parser.suggestDdlAndDmlKeywords();
-     }
+     parser.suggestDdlAndDmlKeywords(['EXPLAIN', 'FROM']);
    }
  ;
 
@@ -81,10 +75,10 @@ ErrorList
  ;
 
 LateralView
- : '<hive>LATERAL' '<hive>VIEW' OptionalOuter ArbitraryFunction RegularOrBacktickedIdentifier '<hive>AS' error  -> { }
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter ArbitraryFunction error                                           -> { }
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter error                                                               -> { }
- | '<hive>LATERAL' error                                                                                          -> { }
+ : 'LATERAL' 'VIEW' OptionalOuter ArbitraryFunction RegularOrBacktickedIdentifier 'AS' error  -> { }
+ | 'LATERAL' 'VIEW' OptionalOuter ArbitraryFunction error                                           -> { }
+ | 'LATERAL' 'VIEW' OptionalOuter error                                                               -> { }
+ | 'LATERAL' error                                                                                          -> { }
  ;
 
 JoinType_EDIT
@@ -94,21 +88,11 @@ JoinType_EDIT
    }
  | 'LEFT' 'CURSOR' error
    {
-     if (parser.isHive()) {
-       parser.suggestKeywords(['JOIN', 'OUTER JOIN', 'SEMI JOIN']);
-     } else if (parser.isImpala()) {
-       parser.suggestKeywords(['ANTI JOIN', 'INNER JOIN', 'JOIN', 'OUTER JOIN', 'SEMI JOIN']);
-     } else {
-       parser.suggestKeywords(['JOIN', 'OUTER JOIN']);
-     }
+     parser.suggestKeywords(['JOIN', 'OUTER JOIN', 'SEMI JOIN']);
    }
  | 'RIGHT' 'CURSOR' error
    {
-     if (parser.isImpala()) {
-       parser.suggestKeywords(['ANTI JOIN', 'INNER JOIN', 'JOIN', 'OUTER JOIN', 'SEMI JOIN']);
-     } else {
-       parser.suggestKeywords(['JOIN', 'OUTER JOIN']);
-     }
+     parser.suggestKeywords(['ANTI JOIN', 'INNER JOIN', 'JOIN', 'OUTER JOIN', 'SEMI JOIN']);
    }
  ;
 
@@ -116,28 +100,28 @@ OptionalSelectConditions_EDIT
  : WhereClause error 'CURSOR' OptionalGroupByClause OptionalHavingClause OptionalWindowClause OptionalOrderByClause OptionalClusterOrDistributeBy OptionalLimitClause OptionalOffsetClause
    {
      $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$4, $5, $6, $7, $8, $9, $10], [{ value: 'GROUP BY', weight: 8 }, { value: 'HAVING', weight: 7 }, { value: 'WINDOW', weight: 6 }, { value: 'ORDER BY', weight: 5 }, [{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [true, true, parser.isHive(), true, parser.isHive(), true, parser.isImpala()]),
+       suggestKeywords: parser.getKeywordsForOptionalsLR([$4, $5, $6, $7, $8, $9, $10], [{ value: 'GROUP BY', weight: 8 }, { value: 'HAVING', weight: 7 }, { value: 'WINDOW', weight: 6 }, { value: 'ORDER BY', weight: 5 }, [{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [true, true, true, true, true, true, parser.isImpala()]),
        cursorAtEnd: !$4 && !$5 && !$6 && !$7 && !$8 && !$9 && !$10
      };
    }
  | OptionalWhereClause OptionalGroupByClause HavingClause error 'CURSOR' OptionalWindowClause OptionalOrderByClause OptionalClusterOrDistributeBy OptionalLimitClause OptionalOffsetClause
    {
      $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$6, $7, $8, $9, $10], [{ value: 'WINDOW', weight: 6 }, { value: 'ORDER BY', weight: 5 }, [{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [parser.isHive(), true, parser.isHive(), true, parser.isImpala()]),
+       suggestKeywords: parser.getKeywordsForOptionalsLR([$6, $7, $8, $9, $10], [{ value: 'WINDOW', weight: 6 }, { value: 'ORDER BY', weight: 5 }, [{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [true, true, true, true, parser.isImpala()]),
        cursorAtEnd: !$6 && !$7 && !$8 && !$9 && !$10
      }
    }
  | OptionalWhereClause OptionalGroupByClause OptionalHavingClause WindowClause error 'CURSOR' OptionalOrderByClause OptionalClusterOrDistributeBy OptionalLimitClause OptionalOffsetClause
    {
      $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$7, $8, $9, $10], [{ value: 'ORDER BY', weight: 5 }, [{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [true, parser.isHive(), true, parser.isImpala()]),
+       suggestKeywords: parser.getKeywordsForOptionalsLR([$7, $8, $9, $10], [{ value: 'ORDER BY', weight: 5 }, [{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [true, true, true, parser.isImpala()]),
        cursorAtEnd: !$7 && !$8 && !$9 && !$10
      }
    }
  | OptionalWhereClause OptionalGroupByClause OptionalHavingClause OptionalWindowClause OrderByClause error 'CURSOR' OptionalClusterOrDistributeBy OptionalLimitClause OptionalOffsetClause
    {
      $$ = {
-       suggestKeywords: parser.getKeywordsForOptionalsLR([$8, $9, $10], [[{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [parser.isHive(), true, parser.isImpala()]),
+       suggestKeywords: parser.getKeywordsForOptionalsLR([$8, $9, $10], [[{ value: 'CLUSTER BY', weight: 4 }, { value: 'DISTRIBUTE BY', weight: 4 }, { value: 'SORT BY', weight: 4 }], { value: 'LIMIT', weight: 3 }, { value: 'OFFSET', weight: 2 }], [true, true, parser.isImpala()]),
        cursorAtEnd: !$8 && !$9 && !$10
      }
    }

+ 100 - 241
desktop/core/src/desktop/js/parse/jison/hive/sql_grant.jison

@@ -25,22 +25,19 @@ DataDefinition_EDIT
  ;
 
 GrantStatement
- : '<hive>GRANT' HivePrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList OptionalWithGrantOption
- | '<hive>GRANT' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption
- | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption
- | '<impala>GRANT' '<impala>ROLE' RegularOrBacktickedIdentifier 'TO' '<impala>GROUP' RegularOrBacktickedIdentifier
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' RegularOrBacktickedIdentifier OptionalWithGrantOption
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' '<impala>ROLE' RegularOrBacktickedIdentifier OptionalWithGrantOption
+ : 'GRANT' PrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList OptionalWithGrantOption
+ | 'GRANT' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption
+ | 'GRANT' 'ROLE' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption
  ;
 
 GrantStatement_EDIT
- : '<hive>GRANT' 'CURSOR'
+ : 'GRANT' 'CURSOR'
    {
      parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DELETE', 'DROP', 'INDEX', 'INSERT', 'LOCK', 'ROLE', 'SELECT', 'UPDATE']);
    }
- | '<hive>GRANT' HivePrivilegeTypeList_EDIT OptionalOnSpecification
- | '<hive>GRANT' HivePrivilegeTypeList OnSpecification_EDIT
- | '<hive>GRANT' HivePrivilegeTypeList OptionalOnSpecification 'CURSOR'
+ | 'GRANT' PrivilegeTypeList_EDIT OptionalOnSpecification
+ | 'GRANT' PrivilegeTypeList OnSpecification_EDIT
+ | 'GRANT' PrivilegeTypeList OptionalOnSpecification 'CURSOR'
    {
      if (!$3) {
        parser.suggestKeywords(['ON', 'TO']);
@@ -48,103 +45,51 @@ GrantStatement_EDIT
        parser.suggestKeywords(['TO']);
      }
    }
- | '<hive>GRANT' HivePrivilegeTypeList OptionalOnSpecification 'TO' 'CURSOR'
+ | 'GRANT' PrivilegeTypeList OptionalOnSpecification 'TO' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>GRANT' HivePrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList_EDIT
- | '<hive>GRANT' HivePrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList OptionalWithGrantOption 'CURSOR'
+ | 'GRANT' PrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList_EDIT
+ | 'GRANT' PrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList OptionalWithGrantOption 'CURSOR'
    {
      if (!$6) {
        parser.suggestKeywords(['WITH GRANT OPTION']);
      }
    }
- | '<hive>GRANT' HivePrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList WithGrantOption_EDIT
- | '<hive>GRANT' UserOrRoleList 'CURSOR'
+ | 'GRANT' PrivilegeTypeList OptionalOnSpecification 'TO' PrincipalSpecificationList WithGrantOption_EDIT
+ | 'GRANT' UserOrRoleList 'CURSOR'
    {
      parser.suggestKeywords(['TO']);
    }
- | '<hive>GRANT' UserOrRoleList 'TO' 'CURSOR'
+ | 'GRANT' UserOrRoleList 'TO' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>GRANT' UserOrRoleList 'TO' PrincipalSpecificationList_EDIT
- | '<hive>GRANT' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption 'CURSOR'
+ | 'GRANT' UserOrRoleList 'TO' PrincipalSpecificationList_EDIT
+ | 'GRANT' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption 'CURSOR'
    {
      if (!$5) {
        parser.suggestKeywords(['WITH ADMIN OPTION']);
      }
    }
- | '<hive>GRANT' UserOrRoleList 'TO' PrincipalSpecificationList WithAdminOption_EDIT
- | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' 'CURSOR'
+ | 'GRANT' UserOrRoleList 'TO' PrincipalSpecificationList WithAdminOption_EDIT
+ | 'GRANT' 'ROLE' UserOrRoleList 'TO' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' PrincipalSpecificationList_EDIT
- | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption 'CURSOR'
+ | 'GRANT' 'ROLE' UserOrRoleList 'TO' PrincipalSpecificationList_EDIT
+ | 'GRANT' 'ROLE' UserOrRoleList 'TO' PrincipalSpecificationList OptionalWithAdminOption 'CURSOR'
    {
      if (!$6) {
        parser.suggestKeywords(['WITH ADMIN OPTION']);
      }
    }
- | '<hive>GRANT' '<hive>ROLE' UserOrRoleList 'TO' PrincipalSpecificationList WithAdminOption_EDIT
- | '<impala>GRANT' 'CURSOR'
-   {
-     parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT']);
-   }
- | '<impala>GRANT' '<impala>ROLE' RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['TO GROUP']);
-   }
- | '<impala>GRANT' '<impala>ROLE' RegularOrBacktickedIdentifier 'TO' 'CURSOR'
-   {
-     parser.suggestKeywords(['GROUP']);
-   }
- | '<impala>GRANT' ImpalaPrivilegeType_EDIT
- | '<impala>GRANT' ImpalaPrivilegeType 'CURSOR'
-   {
-     if ($2.isCreate) {
-       parser.suggestKeywords(['ON DATABASE', 'ON SERVER']);
-     } else {
-       parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
-     }
-   }
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' 'CURSOR'
-   {
-     if ($2.isCreate) {
-        parser.suggestKeywords(['DATABASE', 'SERVER']);
-     } else {
-        parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
-     }
-   }
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification_EDIT
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'CURSOR'
-   {
-     parser.suggestKeywords(['TO']);
-   }
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' 'CURSOR'
-   {
-     parser.suggestKeywords(['ROLE']);
-   }
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' RegularOrBacktickedIdentifier OptionalWithGrantOption 'CURSOR'
-   {
-     if (!$7) {
-       parser.suggestKeywords(['WITH GRANT OPTION']);
-     }
-   }
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' RegularOrBacktickedIdentifier WithGrantOption_EDIT
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' '<impala>ROLE' RegularOrBacktickedIdentifier OptionalWithGrantOption 'CURSOR'
-   {
-     if (!$8) {
-       parser.suggestKeywords(['WITH GRANT OPTION']);
-     }
-   }
- | '<impala>GRANT' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'TO' '<impala>ROLE' RegularOrBacktickedIdentifier WithGrantOption_EDIT
+ | 'GRANT' 'ROLE' UserOrRoleList 'TO' PrincipalSpecificationList WithAdminOption_EDIT
  ;
 
 OptionalOnSpecification
  :
- | 'ON' HiveObjectSpecification
+ | 'ON' ObjectSpecification
  ;
 
 OnSpecification_EDIT
@@ -154,12 +99,12 @@ OnSpecification_EDIT
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | 'ON' HiveObjectSpecification_EDIT
+ | 'ON' ObjectSpecification_EDIT
  ;
 
-HiveObjectSpecification
+ObjectSpecification
  : 'DATABASE' RegularOrBacktickedIdentifier
- | '<hive>TABLE' SchemaQualifiedTableIdentifier
+ | 'TABLE' SchemaQualifiedTableIdentifier
    {
      parser.addTablePrimary($2);
    }
@@ -169,109 +114,69 @@ HiveObjectSpecification
    }
  ;
 
-HiveObjectSpecification_EDIT
+ObjectSpecification_EDIT
  : 'DATABASE' 'CURSOR'
    {
      parser.suggestDatabases();
    }
- | '<hive>TABLE' 'CURSOR'
+ | 'TABLE' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT
+ | 'TABLE' SchemaQualifiedTableIdentifier_EDIT
  | SchemaQualifiedTableIdentifier_EDIT
  ;
 
-ImpalaObjectSpecification
- : 'DATABASE' RegularOrBacktickedIdentifier
-   {
-     parser.addDatabaseLocation(@2, [ { name: $2 } ]);
-   }
- | '<impala>TABLE' SchemaQualifiedTableIdentifier
-   {
-     parser.addTablePrimary($2);
-   }
- | '<impala>SERVER' RegularOrBacktickedIdentifier
- | '<impala>URI' RegularOrBacktickedIdentifier
- ;
-
-ImpalaObjectSpecification_EDIT
- : 'DATABASE' 'CURSOR'
-   {
-     parser.suggestDatabases();
-   }
- | '<impala>TABLE' 'CURSOR'
-   {
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | '<impala>TABLE' SchemaQualifiedTableIdentifier_EDIT
- ;
-
-HivePrivilegeTypeList
- : HivePrivilegeTypeWithOptionalColumn
+PrivilegeTypeList
+ : PrivilegeTypeWithOptionalColumn
    {
      if ($1.toUpperCase() === 'ALL') {
        $$ = { singleAll: true };
      }
    }
- | HivePrivilegeTypeList ',' HivePrivilegeTypeWithOptionalColumn
+ | PrivilegeTypeList ',' PrivilegeTypeWithOptionalColumn
  ;
 
-HivePrivilegeTypeList_EDIT
- : HivePrivilegeTypeWithOptionalColumn_EDIT
- | HivePrivilegeTypeList ',' HivePrivilegeTypeWithOptionalColumn_EDIT
- | HivePrivilegeTypeWithOptionalColumn_EDIT ',' HivePrivilegeTypeList
- | HivePrivilegeTypeList ',' HivePrivilegeTypeWithOptionalColumn_EDIT ',' HivePrivilegeTypeList
- | 'CURSOR' ',' HivePrivilegeTypeList
+PrivilegeTypeList_EDIT
+ : PrivilegeTypeWithOptionalColumn_EDIT
+ | PrivilegeTypeList ',' PrivilegeTypeWithOptionalColumn_EDIT
+ | PrivilegeTypeWithOptionalColumn_EDIT ',' PrivilegeTypeList
+ | PrivilegeTypeList ',' PrivilegeTypeWithOptionalColumn_EDIT ',' PrivilegeTypeList
+ | 'CURSOR' ',' PrivilegeTypeList
    {
      parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DELETE', 'DROP', 'INDEX', 'INSERT', 'LOCK', 'SELECT', 'SHOW_DATABASE', 'UPDATE']);
    }
- | HivePrivilegeTypeList ',' 'CURSOR'
+ | PrivilegeTypeList ',' 'CURSOR'
    {
      parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DELETE', 'DROP', 'INDEX', 'INSERT', 'LOCK', 'SELECT', 'SHOW_DATABASE', 'UPDATE']);
    }
- | HivePrivilegeTypeList ',' 'CURSOR' ',' HivePrivilegeTypeList
+ | PrivilegeTypeList ',' 'CURSOR' ',' PrivilegeTypeList
    {
      parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DELETE', 'DROP', 'INDEX', 'INSERT', 'LOCK', 'SELECT', 'SHOW_DATABASE', 'UPDATE']);
    }
  ;
 
-HivePrivilegeTypeWithOptionalColumn
- : HivePrivilegeType OptionalParenthesizedColumnList
- ;
-
-HivePrivilegeTypeWithOptionalColumn_EDIT
- : HivePrivilegeType ParenthesizedColumnList_EDIT
+PrivilegeTypeWithOptionalColumn
+ : PrivilegeType OptionalParenthesizedColumnList
  ;
 
-HivePrivilegeType
- : '<hive>INSERT'
- | 'SELECT'
- | 'UPDATE'
- | '<hive>DELETE'
- | 'ALTER'
- | '<hive>CREATE'
- | 'DROP'
- | '<hive>INDEX'
- | '<hive>LOCK'
- | '<hive>SHOW_DATABASE'
- | '<hive>ALL'
+PrivilegeTypeWithOptionalColumn_EDIT
+ : PrivilegeType ParenthesizedColumnList_EDIT
  ;
 
-ImpalaPrivilegeType
+PrivilegeType
  : 'ALL'
  | 'ALTER'
- | '<impala>CREATE'  --> { isCreate: true }
+ | 'CREATE'
+ | 'DELETE'
  | 'DROP'
- | '<impala>INSERT'
- | '<impala>REFRESH'
- | 'SELECT' OptionalParenthesizedColumnList
- ;
-
-ImpalaPrivilegeType_EDIT
- : 'SELECT' ParenthesizedColumnList_EDIT
+ | 'INDEX'
+ | 'INSERT'
+ | 'LOCK'
+ | 'SELECT'
+ | 'SHOW_DATABASE'
+ | 'UPDATE'
  ;
 
 PrincipalSpecificationList
@@ -295,15 +200,15 @@ PrincipalSpecificationList_EDIT
  ;
 
 PrincipalSpecification
- : '<hive>USER' RegularOrBacktickedIdentifier
+ : 'USER' RegularOrBacktickedIdentifier
  | 'GROUP' RegularOrBacktickedIdentifier
- | '<hive>ROLE' RegularOrBacktickedIdentifier
+ | 'ROLE' RegularOrBacktickedIdentifier
  ;
 
 PrincipalSpecification_EDIT
- : '<hive>USER' 'CURSOR'
+ : 'USER' 'CURSOR'
  | 'GROUP' 'CURSOR'
- | '<hive>ROLE' 'CURSOR'
+ | 'ROLE' 'CURSOR'
  ;
 
 UserOrRoleList
@@ -313,8 +218,7 @@ UserOrRoleList
 
 OptionalWithGrantOption
  :
- | '<hive>WITH' '<hive>GRANT' 'OPTION'
- | '<impala>WITH' '<impala>GRANT' 'OPTION'
+ | 'WITH' 'GRANT' 'OPTION'
  ;
 
 WithGrantOption_EDIT
@@ -322,11 +226,7 @@ WithGrantOption_EDIT
    {
      parser.suggestKeywords(['GRANT OPTION']);
    }
- | '<hive>WITH' '<hive>GRANT' 'CURSOR'
-   {
-     parser.suggestKeywords(['OPTION']);
-   }
- | '<impala>WITH' '<impala>GRANT' 'CURSOR'
+ | 'WITH' 'GRANT' 'CURSOR'
    {
      parser.suggestKeywords(['OPTION']);
    }
@@ -334,41 +234,38 @@ WithGrantOption_EDIT
 
 OptionalWithAdminOption
  :
- | '<hive>WITH' '<hive>ADMIN' 'OPTION'
+ | 'WITH' 'ADMIN' 'OPTION'
  ;
 
 WithAdminOption_EDIT
- : '<hive>WITH' 'CURSOR'
+ : 'WITH' 'CURSOR'
    {
      parser.suggestKeywords(['ADMIN OPTION']);
    }
- | '<hive>WITH' '<hive>ADMIN' 'CURSOR'
+ | 'WITH' 'ADMIN' 'CURSOR'
    {
      parser.suggestKeywords(['OPTION']);
    }
  ;
 
 RevokeStatement
- : '<hive>REVOKE' HivePrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' HivePrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList
- | '<hive>REVOKE' UserOrRoleList 'FROM' PrincipalSpecificationList
- | '<hive>REVOKE' '<hive>ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' UserOrRoleList 'FROM' PrincipalSpecificationList
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' '<hive>ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList
- | '<hive>REVOKE' '<hive>ALL' PrivilegesOrGrantOption 'FROM' UserOrRoleList
- | '<impala>REVOKE' '<impala>ROLE' RegularOrBacktickedIdentifier 'FROM' '<impala>GROUP' RegularOrBacktickedIdentifier
- | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'FROM' RegularOrBacktickedIdentifier
- | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'FROM' '<impala>ROLE' RegularOrBacktickedIdentifier
+ : 'REVOKE' PrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' PrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList
+ | 'REVOKE' UserOrRoleList 'FROM' PrincipalSpecificationList
+ | 'REVOKE' 'ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' UserOrRoleList 'FROM' PrincipalSpecificationList
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' 'ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList
+ | 'REVOKE' 'ALL' PrivilegesOrGrantOption 'FROM' UserOrRoleList
  ;
 
 RevokeStatement_EDIT
- : '<hive>REVOKE' 'CURSOR'
+ : 'REVOKE' 'CURSOR'
    {
      parser.suggestKeywords(['ADMIN OPTION FOR', 'ALL', 'ALL GRANT OPTION FROM', 'ALL PRIVILEGES FROM', 'ALTER', 'CREATE', 'DELETE', 'DROP', 'GRANT OPTION FOR', 'INDEX', 'INSERT', 'LOCK', 'ROLE', 'SELECT', 'UPDATE']);
    }
- | '<hive>REVOKE' HivePrivilegeTypeList_EDIT
- | '<hive>REVOKE' HivePrivilegeTypeList OnSpecification_EDIT
- | '<hive>REVOKE' HivePrivilegeTypeList OptionalOnSpecification 'CURSOR'
+ | 'REVOKE' PrivilegeTypeList_EDIT
+ | 'REVOKE' PrivilegeTypeList OnSpecification_EDIT
+ | 'REVOKE' PrivilegeTypeList OptionalOnSpecification 'CURSOR'
    {
      if (!$3) {
        if ($2.singleAll) {
@@ -380,26 +277,26 @@ RevokeStatement_EDIT
        parser.suggestKeywords(['FROM']);
      }
    }
- | '<hive>REVOKE' HivePrivilegeTypeList OptionalOnSpecification 'FROM' 'CURSOR'
+ | 'REVOKE' PrivilegeTypeList OptionalOnSpecification 'FROM' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>REVOKE' HivePrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList_EDIT
- | '<hive>REVOKE' '<hive>GRANT' 'CURSOR'
+ | 'REVOKE' PrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList_EDIT
+ | 'REVOKE' 'GRANT' 'CURSOR'
    {
      parser.suggestKeywords(['OPTION FOR']);
    }
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' 'CURSOR'
+ | 'REVOKE' 'GRANT' 'OPTION' 'CURSOR'
    {
      parser.suggestKeywords(['FOR']);
    }
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' 'CURSOR'
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' 'CURSOR'
    {
      parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DELETE', 'DROP', 'INDEX', 'INSERT', 'LOCK', 'SELECT', 'SHOW_DATABASE', 'UPDATE']);
    }
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' HivePrivilegeTypeList_EDIT
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' HivePrivilegeTypeList OnSpecification_EDIT
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' HivePrivilegeTypeList OptionalOnSpecification 'CURSOR'
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' PrivilegeTypeList_EDIT
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' PrivilegeTypeList OnSpecification_EDIT
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' PrivilegeTypeList OptionalOnSpecification 'CURSOR'
    {
      if (!$6) {
        parser.suggestKeywords(['FROM', 'ON']);
@@ -407,12 +304,12 @@ RevokeStatement_EDIT
        parser.suggestKeywords(['FROM']);
      }
    }
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' HivePrivilegeTypeList OptionalOnSpecification 'FROM' 'CURSOR'
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' PrivilegeTypeList OptionalOnSpecification 'FROM' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>REVOKE' '<hive>GRANT' 'OPTION' '<hive>FOR' HivePrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList_EDIT
- | '<hive>REVOKE' UserOrRoleList 'CURSOR'
+ | 'REVOKE' 'GRANT' 'OPTION' 'FOR' PrivilegeTypeList OptionalOnSpecification 'FROM' PrincipalSpecificationList_EDIT
+ | 'REVOKE' UserOrRoleList 'CURSOR'
    {
      if ($2.toUpperCase() === 'ADMIN') {
        parser.suggestKeywords(['FROM', 'OPTION FOR']);
@@ -420,99 +317,61 @@ RevokeStatement_EDIT
        parser.suggestKeywords(['FROM']);
      }
    }
- | '<hive>REVOKE' UserOrRoleList 'FROM' 'CURSOR'
+ | 'REVOKE' UserOrRoleList 'FROM' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>REVOKE' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
- | '<hive>REVOKE' '<hive>ROLE' UserOrRoleList 'CURSOR'
+ | 'REVOKE' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
+ | 'REVOKE' 'ROLE' UserOrRoleList 'CURSOR'
    {
      parser.suggestKeywords(['FROM']);
    }
- | '<hive>REVOKE' '<hive>ROLE' UserOrRoleList 'FROM' 'CURSOR'
+ | 'REVOKE' 'ROLE' UserOrRoleList 'FROM' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>REVOKE' '<hive>ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
+ | 'REVOKE' 'ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
 
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'CURSOR'
    {
      parser.suggestKeywords(['FOR']);
    }
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' 'CURSOR'
    {
      parser.suggestKeywords(['ROLE']);
    }
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' UserOrRoleList 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' UserOrRoleList 'CURSOR'
    {
      parser.suggestKeywords(['FROM']);
    }
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' UserOrRoleList 'FROM' 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' UserOrRoleList 'FROM' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' '<hive>ROLE' UserOrRoleList 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' 'ROLE' UserOrRoleList 'CURSOR'
    {
      parser.suggestKeywords(['FROM']);
    }
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' '<hive>ROLE' UserOrRoleList 'FROM' 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' 'ROLE' UserOrRoleList 'FROM' 'CURSOR'
    {
      parser.suggestKeywords(['GROUP', 'ROLE', 'USER']);
    }
- | '<hive>REVOKE' '<hive>ADMIN' 'OPTION' '<hive>FOR' '<hive>ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
- | '<hive>REVOKE' '<hive>ALL' PrivilegesOrGrantOption_EDIT
- | '<hive>REVOKE' '<hive>ALL' PrivilegesOrGrantOption 'CURSOR'
+ | 'REVOKE' 'ADMIN' 'OPTION' 'FOR' 'ROLE' UserOrRoleList 'FROM' PrincipalSpecificationList_EDIT
+ | 'REVOKE' 'ALL' PrivilegesOrGrantOption_EDIT
+ | 'REVOKE' 'ALL' PrivilegesOrGrantOption 'CURSOR'
    {
      parser.suggestKeywords(['FROM']);
    }
- | '<impala>REVOKE' 'CURSOR'
-   {
-     parser.suggestKeywords(['ALL', 'ALTER', 'CREATE', 'DROP', 'INSERT', 'REFRESH', 'ROLE', 'SELECT']);
-   }
- | '<impala>REVOKE' '<impala>ROLE' RegularOrBacktickedIdentifier 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM GROUP']);
-   }
- | '<impala>REVOKE' '<impala>ROLE' RegularOrBacktickedIdentifier 'FROM' 'CURSOR'
-   {
-     parser.suggestKeywords(['GROUP']);
-   }
- | '<impala>REVOKE' ImpalaPrivilegeType_EDIT
- | '<impala>REVOKE' ImpalaPrivilegeType 'CURSOR'
-   {
-     if ($2.isCreate) {
-       parser.suggestKeywords(['ON DATABASE', 'ON SERVER']);
-     } else {
-       parser.suggestKeywords(['ON DATABASE', 'ON SERVER', 'ON TABLE', 'ON URI']);
-     }
-   }
- | '<impala>REVOKE' ImpalaPrivilegeType 'ON' 'CURSOR'
-   {
-     if ($2.isCreate) {
-       parser.suggestKeywords(['DATABASE', 'SERVER']);
-     } else {
-       parser.suggestKeywords(['DATABASE', 'SERVER', 'TABLE', 'URI']);
-     }
-   }
- | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification_EDIT
- | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'CURSOR'
-   {
-     parser.suggestKeywords(['FROM']);
-   }
- | '<impala>REVOKE' ImpalaPrivilegeType 'ON' ImpalaObjectSpecification 'FROM' 'CURSOR'
-   {
-     parser.suggestKeywords(['ROLE']);
-   }
  ;
 
 PrivilegesOrGrantOption
- : '<hive>PRIVILEGES'
- | '<hive>GRANT' 'OPTION'
+ : 'PRIVILEGES'
+ | 'GRANT' 'OPTION'
  ;
 
 PrivilegesOrGrantOption_EDIT
- : '<hive>GRANT' 'CURSOR'
+ : 'GRANT' 'CURSOR'
    {
      parser.suggestKeywords(['OPTION']);
    }

+ 90 - 280
desktop/core/src/desktop/js/parse/jison/hive/sql_insert.jison

@@ -19,40 +19,32 @@ DataManipulation
  ;
 
 InsertStatement
- : HiveInsertStatement
+ : InsertStatement
  | InsertValuesStatement
- | ImpalaInsertOrUpsertStatement
- | CommonTableExpression HiveInsertStatement
- | CommonTableExpression ImpalaInsertOrUpsertStatement
- | HiveMergeStatement
+ | CommonTableExpression InsertStatement
+ | MergeStatement
  ;
 
 DataManipulation_EDIT
- : HiveInsertStatement_EDIT
+ : InsertStatement_EDIT
  | InsertValuesStatement_EDIT
- | ImpalaInsertOrUpsertStatement_EDIT
- | CommonTableExpression HiveInsertStatement_EDIT
-   {
-     parser.addCommonTableExpressions($1);
-   }
- | CommonTableExpression_EDIT HiveInsertStatement
- | CommonTableExpression ImpalaInsertOrUpsertStatement_EDIT
+ | CommonTableExpression InsertStatement_EDIT
    {
      parser.addCommonTableExpressions($1);
    }
- | CommonTableExpression_EDIT ImpalaInsertOrUpsertStatement
- | HiveMergeStatement_EDIT
+ | CommonTableExpression_EDIT InsertStatement
+ | MergeStatement_EDIT
  ;
 
-HiveInsertStatement
- : HiveInsertWithoutQuery QuerySpecification
- | FromClause HiveInserts
+InsertStatement
+ : InsertWithoutQuery QuerySpecification
+ | FromClause Inserts
  | FromClause SelectWithoutTableExpression OptionalSelectConditions
  ;
 
-HiveInsertStatement_EDIT
- : HiveInsertWithoutQuery_EDIT
- | HiveInsertWithoutQuery 'CURSOR'
+InsertStatement_EDIT
+ : InsertWithoutQuery_EDIT
+ | InsertWithoutQuery 'CURSOR'
    {
      var keywords = [];
      if ($1.suggestKeywords) {
@@ -67,9 +59,9 @@ HiveInsertStatement_EDIT
        parser.suggestKeywords(keywords);
      }
    }
- | HiveInsertWithoutQuery_EDIT QuerySpecification
- | HiveInsertWithoutQuery QuerySpecification_EDIT
- | FromClause HiveInserts_EDIT
+ | InsertWithoutQuery_EDIT QuerySpecification
+ | InsertWithoutQuery QuerySpecification_EDIT
+ | FromClause Inserts_EDIT
    {
      if (!$2.keepTables) {
        delete parser.yy.result.suggestTables;
@@ -77,7 +69,7 @@ HiveInsertStatement_EDIT
      }
    }
  | FromClause_EDIT
- | FromClause_EDIT HiveInserts
+ | FromClause_EDIT Inserts
  | FromClause_EDIT SelectWithoutTableExpression OptionalSelectConditions
  | FromClause 'CURSOR'
    {
@@ -106,8 +98,8 @@ HiveInsertStatement_EDIT
    }
  ;
 
-HiveInsertWithoutQuery
- : '<hive>INSERT' '<hive>OVERWRITE' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalIfNotExists
+InsertWithoutQuery
+ : 'INSERT' 'OVERWRITE' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalIfNotExists
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
@@ -117,7 +109,7 @@ HiveInsertWithoutQuery
        $$ = { suggestKeywords: ['IF NOT EXISTS'] }
      }
    }
- | '<hive>INSERT' '<hive>OVERWRITE' '<hive>LOCAL' '<hive>DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs
+ | 'INSERT' 'OVERWRITE' 'LOCAL' 'DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs
    {
      if (!$6 && !$7) {
        $$ = { suggestKeywords: [{ value: 'ROW FORMAT', weight: 2 }, { value: 'STORED AS', weight: 1}] };
@@ -125,7 +117,7 @@ HiveInsertWithoutQuery
        $$ = { suggestKeywords: ['STORED AS'] };
      }
    }
- | '<hive>INSERT' '<hive>OVERWRITE_DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs
+ | 'INSERT' 'OVERWRITE_DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs
     {
       if (!$4 && !$5) {
         $$ = { suggestKeywords: [{ value: 'ROW FORMAT', weight: 2 }, { value: 'STORED AS', weight: 1}] };
@@ -133,7 +125,7 @@ HiveInsertWithoutQuery
         $$ = { suggestKeywords: ['STORED AS'] };
       }
     }
-  | '<hive>INSERT' 'INTO' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalParenthesizedColumnList
+  | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalParenthesizedColumnList
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
@@ -145,12 +137,12 @@ HiveInsertWithoutQuery
    }
  ;
 
-HiveInsertWithoutQuery_EDIT
- : '<hive>INSERT' 'CURSOR'
+InsertWithoutQuery_EDIT
+ : 'INSERT' 'CURSOR'
    {
      parser.suggestKeywords(['OVERWRITE', 'INTO']);
    }
- | '<hive>INSERT' '<hive>OVERWRITE' OptionalHiveTable 'CURSOR'
+ | 'INSERT' 'OVERWRITE' OptionalTable 'CURSOR'
    {
      if (!$3) {
        parser.suggestKeywords(['DIRECTORY', 'LOCAL DIRECTORY', 'TABLE']);
@@ -159,11 +151,11 @@ HiveInsertWithoutQuery_EDIT
      parser.suggestDatabases({ appendDot: true });
      $$ = { keepTables: true }
    }
- | '<hive>INSERT' '<hive>OVERWRITE' OptionalHiveTable SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec OptionalParenthesizedColumnList
+ | 'INSERT' 'OVERWRITE' OptionalTable SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec OptionalParenthesizedColumnList
    {
      $$ = { keepTables: true }
    }
- | '<hive>INSERT' '<hive>OVERWRITE' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT OptionalIfNotExists
+ | 'INSERT' 'OVERWRITE' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT OptionalIfNotExists
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
@@ -171,22 +163,22 @@ HiveInsertWithoutQuery_EDIT
        parser.yy.result.suggestColumns.owner = 'insert';
      }
    }
- | '<hive>INSERT' '<hive>OVERWRITE' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalIfNotExists_EDIT
+ | 'INSERT' 'OVERWRITE' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalIfNotExists_EDIT
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
    }
- | '<hive>INSERT' '<hive>OVERWRITE' '<hive>LOCAL' 'CURSOR'
+ | 'INSERT' 'OVERWRITE' 'LOCAL' 'CURSOR'
    {
      parser.suggestKeywords(['DIRECTORY']);
    }
- | '<hive>INSERT' '<hive>OVERWRITE' '<hive>LOCAL' '<hive>DIRECTORY' HdfsPath_EDIT OptionalInsertRowFormat OptionalStoredAs
- | '<hive>INSERT' '<hive>OVERWRITE' '<hive>LOCAL' '<hive>DIRECTORY' HdfsPath OptionalInsertRowFormat_EDIT OptionalStoredAs
- | '<hive>INSERT' '<hive>OVERWRITE' '<hive>LOCAL' '<hive>DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs_EDIT
- | '<hive>INSERT' '<hive>OVERWRITE_DIRECTORY' HdfsPath_EDIT OptionalInsertRowFormat OptionalStoredAs  // DIRECTORY is a non-reserved keyword
- | '<hive>INSERT' '<hive>OVERWRITE_DIRECTORY' HdfsPath OptionalInsertRowFormat_EDIT OptionalStoredAs
- | '<hive>INSERT' '<hive>OVERWRITE_DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs_EDIT
- | '<hive>INSERT' 'INTO' OptionalHiveTable 'CURSOR'
+ | 'INSERT' 'OVERWRITE' 'LOCAL' 'DIRECTORY' HdfsPath_EDIT OptionalInsertRowFormat OptionalStoredAs
+ | 'INSERT' 'OVERWRITE' 'LOCAL' 'DIRECTORY' HdfsPath OptionalInsertRowFormat_EDIT OptionalStoredAs
+ | 'INSERT' 'OVERWRITE' 'LOCAL' 'DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs_EDIT
+ | 'INSERT' 'OVERWRITE_DIRECTORY' HdfsPath_EDIT OptionalInsertRowFormat OptionalStoredAs  // DIRECTORY is a non-reserved keyword
+ | 'INSERT' 'OVERWRITE_DIRECTORY' HdfsPath OptionalInsertRowFormat_EDIT OptionalStoredAs
+ | 'INSERT' 'OVERWRITE_DIRECTORY' HdfsPath OptionalInsertRowFormat OptionalStoredAs_EDIT
+ | 'INSERT' 'INTO' OptionalTable 'CURSOR'
    {
      if (!$3) {
        parser.suggestKeywords(['TABLE']);
@@ -195,11 +187,11 @@ HiveInsertWithoutQuery_EDIT
      parser.suggestDatabases({ appendDot: true });
      $$ = { keepTables: true }
    }
- | '<hive>INSERT' 'INTO' OptionalHiveTable SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec OptionalParenthesizedColumnList
+ | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec OptionalParenthesizedColumnList
    {
      $$ = { keepTables: true }
    }
- | '<hive>INSERT' 'INTO' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT OptionalParenthesizedColumnList
+ | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT OptionalParenthesizedColumnList
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
@@ -207,7 +199,7 @@ HiveInsertWithoutQuery_EDIT
        parser.yy.result.suggestColumns.owner = 'insert';
      }
    }
- | '<hive>INSERT' 'INTO' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalParenthesizedColumnList_EDIT
+ | 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec OptionalParenthesizedColumnList_EDIT
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
@@ -217,27 +209,27 @@ HiveInsertWithoutQuery_EDIT
    }
  ;
 
-HiveInserts
- : HiveInsert
- | HiveInserts HiveInsert
+Inserts
+ : GenericInsert
+ | Inserts GenericInsert
  ;
 
-HiveInserts_EDIT
- : HiveInsert_EDIT
- | HiveInserts HiveInsert_EDIT
- | HiveInsert_EDIT HiveInserts
- | HiveInserts HiveInsert_EDIT HiveInserts
+Inserts_EDIT
+ : GenericInsert_EDIT
+ | Inserts GenericInsert_EDIT
+ | GenericInsert_EDIT Inserts
+ | Inserts GenericInsert_EDIT Inserts
  ;
 
-// TODO: Verify Hive unions in insert
-HiveInsert
- : HiveInsertWithoutQuery SelectWithoutTableExpression OptionalSelectConditions
+// TODO: Verify unions in insert
+GenericInsert
+ : InsertWithoutQuery SelectWithoutTableExpression OptionalSelectConditions
  ;
 
-HiveInsert_EDIT
- : HiveInsertWithoutQuery_EDIT
- | HiveInsertWithoutQuery_EDIT SelectWithoutTableExpression OptionalSelectConditions
- | HiveInsertWithoutQuery 'CURSOR'
+GenericInsert_EDIT
+ : InsertWithoutQuery_EDIT
+ | InsertWithoutQuery_EDIT SelectWithoutTableExpression OptionalSelectConditions
+ | InsertWithoutQuery 'CURSOR'
    {
      if ($1.suggestKeywords) {
        parser.suggestKeywords(parser.createWeightedKeywords($1.suggestKeywords, 2).concat([{ value: 'SELECT', weight: 1}]));
@@ -245,7 +237,7 @@ HiveInsert_EDIT
        parser.suggestKeywords(['SELECT']);
      }
    }
- | HiveInsertWithoutQuery SelectWithoutTableExpression_EDIT OptionalSelectConditions
+ | InsertWithoutQuery SelectWithoutTableExpression_EDIT OptionalSelectConditions
    {
      if ($2.cursorAtEnd) {
        parser.checkForSelectListKeywords($2);
@@ -258,11 +250,11 @@ HiveInsert_EDIT
        }
      }
    }
- | HiveInsertWithoutQuery SelectWithoutTableExpression OptionalSelectConditions_EDIT
+ | InsertWithoutQuery SelectWithoutTableExpression OptionalSelectConditions_EDIT
  ;
 
 InsertValuesStatement
- : '<hive>INSERT' 'INTO' OptionalHiveTable SchemaQualifiedTableIdentifier OptionalPartitionSpec 'VALUES' InsertValuesList
+ : 'INSERT' 'INTO' OptionalTable SchemaQualifiedTableIdentifier OptionalPartitionSpec 'VALUES' InsertValuesList
    {
      $4.owner = 'insert';
      parser.addTablePrimary($4);
@@ -313,7 +305,7 @@ OptionalTable
 
 OptionalInsertRowFormat
  :
- | 'ROW' '<hive>FORMAT' DelimitedRowFormat
+ | 'ROW' 'FORMAT' DelimitedRowFormat
  ;
 
 OptionalInsertRowFormat_EDIT
@@ -321,11 +313,11 @@ OptionalInsertRowFormat_EDIT
    {
      parser.suggestKeywords(['FORMAT DELIMITED']);
    }
- | 'ROW' '<hive>FORMAT' 'CURSOR'
+ | 'ROW' 'FORMAT' 'CURSOR'
    {
      parser.suggestKeywords(['DELIMITED']);
    }
- | 'ROW' '<hive>FORMAT' DelimitedRowFormat_EDIT
+ | 'ROW' 'FORMAT' DelimitedRowFormat_EDIT
  ;
 
 SelectWithoutTableExpression
@@ -353,218 +345,36 @@ SelectWithoutTableExpression_EDIT
        keywords.push({ value: 'ALL', weight: 2 });
        keywords.push({ value: 'DISTINCT', weight: 2 });
      }
-     if (parser.isImpala() && !$3) {
-       keywords.push({ value: 'STRAIGHT_JOIN', weight: 1 });
-     }
      parser.suggestKeywords(keywords);
      parser.suggestFunctions();
      parser.suggestColumns();
    }
  ;
 
-OptionalHiveTable
- :
- | '<hive>TABLE'
- ;
-
-ImpalaInsertOrUpsertStatement
- : ImpalaInsertOrUpsertStatementWithoutCTE
- ;
-
-ImpalaInsertOrUpsertStatement_EDIT
- : ImpalaInsertOrUpsertStatementWithoutCTE_EDIT
- ;
-
-ImpalaInsertOrUpsertStatementWithoutCTE
- : ImpalaInsertOrUpsertLeftPart OptionalImpalaShuffleOrNoShuffle SelectStatement OptionalUnions
- | ImpalaInsertOrUpsertLeftPart 'VALUES' ImpalaRowValuesLists
- ;
-
-ImpalaInsertOrUpsertStatementWithoutCTE_EDIT
- : ImpalaInsertOrUpsertLeftPart_EDIT
- | ImpalaInsertOrUpsertLeftPart OptionalImpalaShuffleOrNoShuffle 'CURSOR'
-   {
-     var keywords = $1.suggestKeywords && !$2 ? parser.createWeightedKeywords($1.suggestKeywords, 2) : [];
-     if (!$2) {
-       keywords = keywords.concat(['[NOSHUFFLE]', '[SHUFFLE]', 'SELECT', 'VALUES'])
-     } else {
-       keywords = keywords.concat(['SELECT'])
-     }
-     parser.suggestKeywords(keywords);
-   }
- | ImpalaInsertOrUpsertLeftPart_EDIT OptionalImpalaShuffleOrNoShuffle SelectStatement OptionalUnions
- | ImpalaInsertOrUpsertLeftPart OptionalImpalaShuffleOrNoShuffle SelectStatement_EDIT OptionalUnions
- | ImpalaInsertOrUpsertLeftPart OptionalImpalaShuffleOrNoShuffle SelectStatement OptionalUnions_EDIT
- | ImpalaInsertOrUpsertLeftPart_EDIT 'VALUES' ImpalaRowValuesLists
- | ImpalaInsertOrUpsertLeftPart 'VALUES' ImpalaRowValuesLists_EDIT
- ;
-
-ImpalaInsertOrUpsertLeftPart
- : ImpalaUpsertStatementLeftPart
- | ImpalaInsertLeftPart
- ;
-
-ImpalaInsertOrUpsertLeftPart_EDIT
- : ImpalaUpsertStatementLeftPart_EDIT
- | ImpalaInsertLeftPart_EDIT
- ;
-
-ImpalaUpsertStatementLeftPart
- : '<impala>UPSERT' 'INTO' OptionalImpalaTable SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList
-   {
-     $4.owner = 'upsert';
-     parser.addTablePrimary($4);
-   }
- ;
-
-ImpalaUpsertStatementLeftPart_EDIT
- : '<impala>UPSERT' 'CURSOR'
-   {
-     parser.suggestKeywords(['INTO']);
-   }
- | '<impala>UPSERT' 'INTO' OptionalImpalaTable 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['TABLE']);
-     }
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | '<impala>UPSERT' 'INTO' OptionalImpalaTable 'CURSOR' SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList
-   {
-     if (!$3) {
-       parser.suggestKeywords(['TABLE']);
-     }
-     $5.owner = 'upsert';
-     parser.addTablePrimary($5);
-   }
- | '<impala>UPSERT' 'INTO' OptionalImpalaTable SchemaQualifiedTableIdentifier_EDIT OptionalParenthesizedColumnList
- | '<impala>UPSERT' 'INTO' OptionalImpalaTable SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList_EDIT
-   {
-     $4.owner = 'upsert';
-     parser.addTablePrimary($4);
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.owner = 'upsert';
-     }
-   }
- ;
-
-
-ImpalaInsertLeftPart
- : '<impala>INSERT' IntoOrOverwrite OptionalImpalaTable SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalPartitionSpec
-   {
-     $4.owner = 'insert';
-     parser.addTablePrimary($4);
-     if (!$6) {
-       $$ = { suggestKeywords: ['PARTITION'] };
-     }
-   }
- ;
-
-ImpalaInsertLeftPart_EDIT
- : '<impala>INSERT' 'CURSOR'
-   {
-     parser.suggestKeywords(['INTO', 'OVERWRITE']);
-   }
- | '<impala>INSERT' IntoOrOverwrite OptionalImpalaTable 'CURSOR'
-   {
-     if (!$3) {
-       parser.suggestKeywords(['TABLE']);
-     }
-     parser.suggestTables();
-     parser.suggestDatabases({ appendDot: true });
-   }
- | '<impala>INSERT' IntoOrOverwrite OptionalImpalaTable 'CURSOR' SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalPartitionSpec
-   {
-     if (!$3) {
-       parser.suggestKeywords(['TABLE']);
-     }
-     $5.owner = 'insert';
-     parser.addTablePrimary($5);
-   }
- | '<impala>INSERT' IntoOrOverwrite OptionalImpalaTable SchemaQualifiedTableIdentifier_EDIT OptionalParenthesizedColumnList OptionalPartitionSpec
- | '<impala>INSERT' IntoOrOverwrite OptionalImpalaTable SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList_EDIT OptionalPartitionSpec
-   {
-     $4.owner = 'insert';
-     parser.addTablePrimary($4);
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.owner = 'insert';
-     }
-   }
- | '<impala>INSERT' IntoOrOverwrite OptionalImpalaTable SchemaQualifiedTableIdentifier OptionalParenthesizedColumnList OptionalPartitionSpec_EDIT
-   {
-     $4.owner = 'insert';
-     parser.addTablePrimary($4);
-     if (parser.yy.result.suggestColumns) {
-       parser.yy.result.suggestColumns.owner = 'insert';
-     }
-   }
- ;
-
-IntoOrOverwrite
- : 'INTO'
- | '<impala>OVERWRITE'
- ;
-
-OptionalImpalaTable
- :
- | '<impala>TABLE'
- ;
-
-OptionalImpalaShuffleOrNoShuffle
- :
- | '<impala>SHUFFLE'
- | '<impala>NOSHUFFLE'
- ;
-
-ImpalaRowValuesLists
- : ParenthesizedImpalaRowValuesList
- | ImpalaRowValuesLists ',' ParenthesizedImpalaRowValuesList
- ;
-
-ImpalaRowValuesLists_EDIT
- : ParenthesizedImpalaRowValuesList_EDIT
- | ImpalaRowValuesLists ',' ParenthesizedImpalaRowValuesList_EDIT
- | ImpalaRowValuesLists ',' ParenthesizedImpalaRowValuesList_EDIT ',' ImpalaRowValuesLists
- | ParenthesizedImpalaRowValuesList_EDIT ',' ImpalaRowValuesLists
- ;
-
-ParenthesizedImpalaRowValuesList
- : '(' ValueExpressionList ')'
- ;
-
-ParenthesizedImpalaRowValuesList_EDIT
- : '(' AnyCursor RightParenthesisOrError
-   {
-     parser.suggestFunctions();
-   }
- | '(' ValueExpressionList_EDIT RightParenthesisOrError
- ;
-
-HiveMergeStatement
- : HiveMergeStatementLeftPart 'ON' ValueExpression WhenList
+MergeStatement
+ : MergeStatementLeftPart 'ON' ValueExpression WhenList
  ;
 
-HiveMergeStatement_EDIT
- : HiveMergeStatementLeftPart_EDIT
- | HiveMergeStatementLeftPart 'CURSOR'
+MergeStatement_EDIT
+ : MergeStatementLeftPart_EDIT
+ | MergeStatementLeftPart 'CURSOR'
    {
      parser.suggestKeywords(['ON']);
    }
- | HiveMergeStatementLeftPart 'ON' 'CURSOR'
+ | MergeStatementLeftPart 'ON' 'CURSOR'
    {
      parser.valueExpressionSuggest();
    }
- | HiveMergeStatementLeftPart 'ON' ValueExpression_EDIT
- | HiveMergeStatementLeftPart 'ON' ValueExpression 'CURSOR'
+ | MergeStatementLeftPart 'ON' ValueExpression_EDIT
+ | MergeStatementLeftPart 'ON' ValueExpression 'CURSOR'
    {
      parser.suggestValueExpressionKeywords($3, [{ value: 'WHEN', weight: 2 }]);
    }
- | HiveMergeStatementLeftPart 'ON' ValueExpression WhenList_EDIT
+ | MergeStatementLeftPart 'ON' ValueExpression WhenList_EDIT
  ;
 
-HiveMergeStatementLeftPart
- : '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' RegularIdentifier '<hive>USING' MergeSource '<hive>AS' RegularIdentifier
+MergeStatementLeftPart
+ : 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' RegularIdentifier 'USING' MergeSource 'AS' RegularIdentifier
    {
      $3.alias = $5;
      parser.addTablePrimary($3);
@@ -576,52 +386,52 @@ HiveMergeStatementLeftPart
    }
  ;
 
-HiveMergeStatementLeftPart_EDIT
- : '<hive>MERGE' 'CURSOR'
+MergeStatementLeftPart_EDIT
+ : 'MERGE' 'CURSOR'
    {
      parser.suggestKeywords(['INTO']);
    }
- | '<hive>MERGE' 'INTO' 'CURSOR'
+ | 'MERGE' 'INTO' 'CURSOR'
    {
      parser.suggestDatabases({ appendDot: true });
      parser.suggestTables();
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier_EDIT
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier 'CURSOR'
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier_EDIT
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'CURSOR'
    {
      parser.addTablePrimary($3);
      parser.suggestKeywords(['AS T USING']);
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' 'CURSOR'
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' 'CURSOR'
    {
      parser.addTablePrimary($3);
      parser.suggestKeywords(['T USING']);
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' RegularIdentifier 'CURSOR'
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' RegularIdentifier 'CURSOR'
    {
      $3.alias = $5;
      parser.addTablePrimary($3);
      parser.suggestKeywords(['USING']);
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' RegularIdentifier '<hive>USING' 'CURSOR'
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' RegularIdentifier 'USING' 'CURSOR'
    {
      $3.alias = $5;
      parser.addTablePrimary($3);
      parser.suggestDatabases({ appendDot: true });
      parser.suggestTables();
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' RegularIdentifier '<hive>USING' MergeSource_EDIT
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' RegularIdentifier 'USING' MergeSource_EDIT
    {
      $3.alias = $5;
      parser.addTablePrimary($3);
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' RegularIdentifier '<hive>USING' MergeSource 'CURSOR'
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' RegularIdentifier 'USING' MergeSource 'CURSOR'
    {
      $3.alias = $5;
      parser.addTablePrimary($3);
      parser.suggestKeywords(['AS S ON']);
    }
- | '<hive>MERGE' 'INTO' SchemaQualifiedTableIdentifier '<hive>AS' RegularIdentifier '<hive>USING' MergeSource '<hive>AS' 'CURSOR'
+ | 'MERGE' 'INTO' SchemaQualifiedTableIdentifier 'AS' RegularIdentifier 'USING' MergeSource 'AS' 'CURSOR'
    {
      $3.alias = $5;
      parser.addTablePrimary($3);
@@ -706,7 +516,7 @@ WhenList_EDIT
  ;
 
 WhenClause
- : 'WHEN' OptionalNot '<hive>MATCHED' OptionalMatchCondition 'THEN' UpdateDeleteOrInsert  --> { notPresent: !!$2, isDelete: $6.isDelete, isInsert: $6.isInsert, isUpdate: $6.isUpdate }
+ : 'WHEN' OptionalNot 'MATCHED' OptionalMatchCondition 'THEN' UpdateDeleteOrInsert  --> { notPresent: !!$2, isDelete: $6.isDelete, isInsert: $6.isInsert, isUpdate: $6.isUpdate }
  ;
 
 WhenClause_EDIT
@@ -718,7 +528,7 @@ WhenClause_EDIT
        parser.suggestKeywords(['MATCHED']);
      }
    }
- | 'WHEN' OptionalNot '<hive>MATCHED' OptionalMatchCondition 'CURSOR'
+ | 'WHEN' OptionalNot 'MATCHED' OptionalMatchCondition 'CURSOR'
    {
      if (!$4) {
        parser.suggestKeywords(['AND', 'THEN']);
@@ -726,9 +536,9 @@ WhenClause_EDIT
        parser.suggestValueExpressionKeywords($4, [{ value: 'THEN', weight: 2 }]);
      }
    }
- | 'WHEN' OptionalNot '<hive>MATCHED' MatchCondition_EDIT
- | 'WHEN' OptionalNot '<hive>MATCHED' OptionalMatchCondition 'THEN' 'CURSOR' --> { suggestThenKeywords: true }
- | 'WHEN' OptionalNot '<hive>MATCHED' OptionalMatchCondition 'THEN' UpdateDeleteOrInsert_EDIT
+ | 'WHEN' OptionalNot 'MATCHED' MatchCondition_EDIT
+ | 'WHEN' OptionalNot 'MATCHED' OptionalMatchCondition 'THEN' 'CURSOR' --> { suggestThenKeywords: true }
+ | 'WHEN' OptionalNot 'MATCHED' OptionalMatchCondition 'THEN' UpdateDeleteOrInsert_EDIT
  ;
 
 OptionalMatchCondition
@@ -745,8 +555,8 @@ MatchCondition_EDIT
 
 UpdateDeleteOrInsert
  : 'UPDATE' 'SET' SetClauseList              --> { isUpdate: true }
- | '<hive>DELETE'                            --> { isDelete: true }
- | '<hive>INSERT' 'VALUES' InsertValuesList  --> { isInsert: true }
+ | 'DELETE'                            --> { isDelete: true }
+ | 'INSERT' 'VALUES' InsertValuesList  --> { isInsert: true }
  ;
 
 UpdateDeleteOrInsert_EDIT
@@ -755,7 +565,7 @@ UpdateDeleteOrInsert_EDIT
      parser.suggestKeywords(['SET']);
    }
  | 'UPDATE' 'SET' SetClauseList_EDIT
- | '<hive>INSERT' 'CURSOR'
+ | 'INSERT' 'CURSOR'
    {
      parser.suggestKeywords(['VALUES']);
    }

+ 53 - 73
desktop/core/src/desktop/js/parse/jison/hive/sql_load.jison

@@ -27,31 +27,27 @@ DataManipulation_EDIT
  ;
 
 LoadStatement
- : AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'INTO' AnyTable SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ : 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'INTO' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
      parser.addTablePrimary($9);
    }
  ;
 
 LoadStatement_EDIT
- : AnyLoad 'CURSOR'
+ : 'LOAD' 'CURSOR'
    {
-     if (parser.isHive()) {
-       parser.suggestKeywords(['DATA LOCAL INPATH', 'DATA INPATH']);
-     } else if (parser.isImpala()) {
-       parser.suggestKeywords(['DATA INPATH']);
-     }
+     parser.suggestKeywords(['DATA LOCAL INPATH', 'DATA INPATH']);
    }
- | AnyLoad AnyData OptionalHiveLocal 'CURSOR'
+ | 'LOAD' 'DATA' OptionalLocal 'CURSOR'
    {
-     if (parser.isHive() && !$3) {
+     if (!$3) {
        parser.suggestKeywords(['INPATH', 'LOCAL INPATH']);
      } else {
        parser.suggestKeywords(['INPATH']);
      }
    }
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath_EDIT OptionalOverwrite
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'CURSOR'
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath_EDIT OptionalOverwrite
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'CURSOR'
    {
      if (!$6) {
        parser.suggestKeywords(['OVERWRITE INTO TABLE', 'INTO TABLE']);
@@ -59,28 +55,28 @@ LoadStatement_EDIT
        parser.suggestKeywords(['INTO TABLE']);
      }
    }
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'INTO' 'CURSOR'
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'INTO' 'CURSOR'
    {
      parser.suggestKeywords([ 'TABLE' ]);
    }
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'INTO' AnyTable 'CURSOR'
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'INTO' 'TABLE' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'INTO' AnyTable SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'INTO' AnyTable SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'INTO' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'INTO' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
    {
      parser.addTablePrimary($9);
      if (!$10) {
        parser.suggestKeywords(['PARTITION']);
      }
    }
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath OptionalOverwrite 'INTO' AnyTable SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath OptionalOverwrite 'INTO' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec_EDIT
    {
      parser.addTablePrimary($9);
    }
- | AnyLoad AnyData OptionalHiveLocal AnyInpath HdfsPath_EDIT OptionalOverwrite 'INTO' AnyTable SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ | 'LOAD' 'DATA' OptionalLocal 'INPATH' HdfsPath_EDIT OptionalOverwrite 'INTO' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
      parser.addTablePrimary($9);
    }
@@ -88,36 +84,20 @@ LoadStatement_EDIT
 
 OptionalOverwrite
  :
- | '<hive>OVERWRITE'
- | '<impala>OVERWRITE'
+ | 'OVERWRITE'
  ;
 
-OptionalHiveLocal
+OptionalLocal
  :
- | '<hive>LOCAL'
- ;
-
-AnyLoad
- : '<hive>LOAD'
- | '<impala>LOAD'
- ;
-
-AnyData
- : '<hive>DATA'
- | '<impala>DATA'
- ;
-
-AnyInpath
- : '<hive>INPATH'
- | '<impala>INPATH'
+ | 'LOCAL'
  ;
 
 ImportStatement
- : '<hive>IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+ : 'IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
  ;
 
 ImportStatement_EDIT
- : '<hive>IMPORT' 'CURSOR' OptionalTableWithPartition
+ : 'IMPORT' 'CURSOR' OptionalTableWithPartition
    {
      if (!$3) {
        parser.suggestKeywords(['EXTERNAL TABLE', 'FROM', 'TABLE']);
@@ -125,7 +105,7 @@ ImportStatement_EDIT
        parser.suggestKeywords(['EXTERNAL']);
      }
    }
- | '<hive>IMPORT' TableWithPartition 'CURSOR'
+ | 'IMPORT' TableWithPartition 'CURSOR'
    {
      if ($2.suggestKeywords) {
         parser.suggestKeywords(parser.createWeightedKeywords($2.suggestKeywords, 2).concat(['FROM']));
@@ -133,16 +113,16 @@ ImportStatement_EDIT
         parser.suggestKeywords(['FROM']);
       }
    }
- | '<hive>IMPORT' TableWithPartition_EDIT
- | '<hive>IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath_EDIT OptionalHdfsLocation
- | '<hive>IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath HdfsLocation_EDIT
- | '<hive>IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation 'CURSOR'
+ | 'IMPORT' TableWithPartition_EDIT
+ | 'IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath_EDIT OptionalHdfsLocation
+ | 'IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath HdfsLocation_EDIT
+ | 'IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation 'CURSOR'
    {
      if (!$6) {
        parser.suggestKeywords(['LOCATION']);
      }
    }
- | '<hive>IMPORT' 'CURSOR' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+ | 'IMPORT' 'CURSOR' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
    {
      if (!$3) {
        parser.suggestKeywords(['EXTERNAL TABLE', 'TABLE']);
@@ -150,8 +130,8 @@ ImportStatement_EDIT
        parser.suggestKeywords(['EXTERNAL']);
      }
    }
-| '<hive>IMPORT' TableWithPartition_EDIT PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
- | '<hive>IMPORT' TableWithPartition 'CURSOR' PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+| 'IMPORT' TableWithPartition_EDIT PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+ | 'IMPORT' TableWithPartition 'CURSOR' PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
     {
       if ($2.suggestKeywords) {
         parser.suggestKeywords(parser.createWeightedKeywords($2.suggestKeywords, 2).concat(['FROM']));
@@ -165,7 +145,7 @@ OptionalTableWithPartition
  ;
 
 TableWithPartition
- : '<hive>EXTERNAL' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ : 'EXTERNAL' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
      parser.addTablePrimary($3);
      if (!$4) {
@@ -174,7 +154,7 @@ TableWithPartition
        $$ = { hasExternal: true }
      }
    }
- | '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+ | 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
    {
      parser.addTablePrimary($2);
      if (!$3) {
@@ -184,56 +164,56 @@ TableWithPartition
  ;
 
 TableWithPartition_EDIT
- : '<hive>EXTERNAL' 'CURSOR'
+ : 'EXTERNAL' 'CURSOR'
    {
      parser.suggestKeywords(['TABLE']);
    }
- | '<hive>EXTERNAL' '<hive>TABLE' 'CURSOR'
+ | 'EXTERNAL' 'TABLE' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | '<hive>EXTERNAL' '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
- | '<hive>EXTERNAL' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
+ | 'EXTERNAL' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | 'EXTERNAL' 'TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
    {
      parser.addTablePrimary($3);
    }
- | '<hive>TABLE' 'CURSOR'
+ | 'TABLE' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
 
- | '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
- | '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
+ | 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | 'TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
    {
      parser.addTablePrimary($3);
    }
  ;
 
 ExportStatement
- : '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath
+ : 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath
    {
      parser.addTablePrimary($3);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath 'FOR' 'REPLICATION' '(' QuotedValue ')'
    {
      parser.addTablePrimary($3);
    }
  ;
 
 ExportStatement_EDIT
- : '<hive>EXPORT' 'CURSOR'
+ : 'EXPORT' 'CURSOR'
    {
      parser.suggestKeywords(['TABLE']);
    }
- | '<hive>EXPORT' '<hive>TABLE' 'CURSOR'
+ | 'EXPORT' 'TABLE' 'CURSOR'
    {
      parser.suggestTables();
      parser.suggestDatabases({ appendDot: true });
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier_EDIT
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
    {
      parser.addTablePrimary($3);
      if (!$4) {
@@ -242,50 +222,50 @@ ExportStatement_EDIT
        parser.suggestKeywords([ 'TO' ]);
      }
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
    {
      parser.addTablePrimary($3);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath_EDIT
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath_EDIT
    {
      parser.addTablePrimary($3);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath 'CURSOR'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath 'CURSOR'
    {
      parser.addTablePrimary($3);
      parser.suggestKeywords(['FOR replication()']);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' 'CURSOR'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath 'FOR' 'CURSOR'
    {
      parser.addTablePrimary($3);
      parser.suggestKeywords(['replication()']);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR' PushHdfsLexerState 'TO' HdfsPath
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath 'FOR' 'REPLICATION' '(' QuotedValue ')'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR' PushHdfsLexerState 'TO' HdfsPath
    {
      parser.addTablePrimary($3);
      if (!$4) {
        parser.suggestKeywords(['PARTITION']);
      }
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR' PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR' PushHdfsLexerState 'TO' HdfsPath 'FOR' 'REPLICATION' '(' QuotedValue ')'
    {
      parser.addTablePrimary($3);
      if (!$4) {
        parser.suggestKeywords(['PARTITION']);
      }
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT PushHdfsLexerState 'TO' HdfsPath
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT PushHdfsLexerState 'TO' HdfsPath
    {
      parser.addTablePrimary($3);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT PushHdfsLexerState 'TO' HdfsPath 'FOR' 'REPLICATION' '(' QuotedValue ')'
    {
      parser.addTablePrimary($3);
    }
- | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath_EDIT '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+ | 'EXPORT' 'TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath_EDIT 'FOR' 'REPLICATION' '(' QuotedValue ')'
    {
      parser.addTablePrimary($3);
    }
- ;
+ ;

+ 0 - 6
desktop/core/src/desktop/js/parse/jison/hive/sql_main.jison

@@ -876,12 +876,6 @@ AnyPartition
  | '<hive>PARTITION'
  ;
 
-AnyTable
- : 'TABLE'
- | '<hive>TABLE'
- | '<impala>TABLE'
- ;
-
 AnyWith
  : 'WITH'
  | '<hive>WITH'

+ 4 - 4
desktop/core/src/desktop/js/parse/jison/hive/sql_show.jison

@@ -215,7 +215,7 @@ ShowCreateTableStatement_EDIT
  ;
 
 AnyTableOrView
- : AnyTable
+ : 'TABLE'
  | 'VIEW'   --> { isView: true }
  ;
 
@@ -332,7 +332,7 @@ ShowGrantStatement
  : AnyShow '<hive>GRANT' OptionalPrincipalName
  | AnyShow '<hive>GRANT' OptionalPrincipalName 'ON' '<hive>ALL'
  | AnyShow '<hive>GRANT' OptionalPrincipalName 'ON' SchemaQualifiedTableIdentifier
- | AnyShow '<hive>GRANT' OptionalPrincipalName 'ON' AnyTable SchemaQualifiedTableIdentifier
+ | AnyShow '<hive>GRANT' OptionalPrincipalName 'ON' 'TABLE' SchemaQualifiedTableIdentifier
  | AnyShow '<impala>GRANT' ImpalaRoleOrUser RegularOrBacktickedIdentifier
  | AnyShow '<impala>GRANT' ImpalaRoleOrUser RegularOrBacktickedIdentifier 'ON' 'DATABASE' RegularOrBacktickedIdentifier
    {
@@ -355,7 +355,7 @@ ShowGrantStatement_EDIT
      parser.suggestTables();
    }
  | AnyShow '<hive>GRANT' OptionalPrincipalName 'ON' SchemaQualifiedTableIdentifier_EDIT
- | AnyShow  '<hive>GRANT' OptionalPrincipalName 'ON' AnyTable 'CURSOR'
+ | AnyShow  '<hive>GRANT' OptionalPrincipalName 'ON' 'TABLE' 'CURSOR'
    {
      parser.suggestTables();
    }
@@ -738,4 +738,4 @@ OptionalLike
 
 Like_EDIT
  : 'LIKE' 'CURSOR'
- ;
+ ;