Browse Source

HUE-6835 [autocomplete] Add CASCADE and RESTRICT to Impala DROP DATABASE statements

Johan Ahlen 8 years ago
parent
commit
4245f21

+ 2 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql.jisonlex

@@ -195,6 +195,7 @@
 <impala>'AGGREGATE'                        { return '<impala>AGGREGATE'; }
 <impala>'AVRO'                             { return '<impala>AVRO'; }
 <impala>'CACHED'                           { return '<impala>CACHED'; }
+<impala>'CASCADE'                          { return '<impala>CASCADE'; }
 <impala>'CHANGE'                           { return '<impala>CHANGE'; }
 <impala>'CLOSE_FN'                         { return '<impala>CLOSE_FN'; }
 <impala>'COLUMN'                           { return '<impala>COLUMN'; }
@@ -252,6 +253,7 @@
 <impala>'RENAME'                           { return '<impala>RENAME'; }
 <impala>'REPLACE'                          { return '<impala>REPLACE'; }
 <impala>'REPLICATION'                      { return '<impala>REPLICATION'; }
+<impala>'RESTRICT'                         { return '<impala>RESTRICT'; }
 <impala>'RETURNS'                          { return '<impala>RETURNS'; }
 <impala>'REVOKE'                           { return '<impala>REVOKE'; }
 <impala>'SEQUENCEFILE'                     { return '<impala>SEQUENCEFILE'; }

+ 0 - 6
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_alter.jison

@@ -681,12 +681,6 @@ OptionalStoredAsDirectories_EDIT
    }
  ;
 
-OptionalCascadeOrRestrict
- :
- | '<hive>CASCADE'
- | '<hive>RESTRICT'
- ;
-
 AlterView
  : AlterViewLeftSide 'SET' '<hive>TBLPROPERTIES' ParenthesizedPropertyAssignmentList
  | AlterViewLeftSide AnyAs QuerySpecification

+ 4 - 4
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_drop.jison

@@ -66,7 +66,7 @@ DropStatement_EDIT
  ;
 
 DropDatabaseStatement
- : 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier OptionalHiveCascadeOrRestrict
+ : 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
  ;
 
 DropDatabaseStatement_EDIT
@@ -81,12 +81,12 @@ DropDatabaseStatement_EDIT
    }
  | 'DROP' DatabaseOrSchema OptionalIfExists RegularOrBacktickedIdentifier 'CURSOR'
    {
-     if (parser.isHive()) {
+     if (parser.isHive() || parser.isImpala()) {
        parser.suggestKeywords(['CASCADE', 'RESTRICT']);
      }
    }
- | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT RegularOrBacktickedIdentifier OptionalHiveCascadeOrRestrict
- | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR' RegularOrBacktickedIdentifier OptionalHiveCascadeOrRestrict
+ | 'DROP' DatabaseOrSchema OptionalIfExists_EDIT RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
+ | 'DROP' DatabaseOrSchema OptionalIfExists 'CURSOR' RegularOrBacktickedIdentifier OptionalCascadeOrRestrict
    {
      if (!$3) {
        parser.suggestKeywords(['IF EXISTS']);

File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_main.jison


+ 14 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecDrop.js

@@ -421,6 +421,20 @@
           });
         });
       });
+
+      describe('Impala specific', function () {
+        it('should suggest keywords for "DROP DATABASE foo |"', function() {
+          assertAutoComplete({
+            beforeCursor: 'DROP DATABASE foo ',
+            afterCursor: '',
+            dialect: 'impala',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['CASCADE', 'RESTRICT']
+            }
+          });
+        });
+      });
     });
 
     describe('DROP FUNCTION', function () {

File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlAutocompleteParser.js


File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sqlSyntaxParser.js


Some files were not shown because too many files changed in this diff