Browse Source

HUE-4583 [editor] Add autocompletion of IMPORT and EXPORT statements

Johan Ahlen 9 years ago
parent
commit
b33c337883

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

@@ -47,6 +47,7 @@
 <hive>'FUNCTION'                           { return '<hive>FUNCTION'; }
 <hive>'FUNCTION'                           { return '<hive>FUNCTION'; }
 <hive>'GRANT'                              { return '<hive>GRANT'; }
 <hive>'GRANT'                              { return '<hive>GRANT'; }
 <hive>'GROUPING'                           { return '<hive>GROUPING'; }
 <hive>'GROUPING'                           { return '<hive>GROUPING'; }
+<hive>'IMPORT'                             { determineCase(yytext); return '<hive>IMPORT'; }
 <hive>'INSERT'                             { determineCase(yytext); return '<hive>INSERT'; }
 <hive>'INSERT'                             { determineCase(yytext); return '<hive>INSERT'; }
 <hive>'LATERAL'                            { return '<hive>LATERAL'; }
 <hive>'LATERAL'                            { return '<hive>LATERAL'; }
 <hive>'LOCAL'                              { return '<hive>LOCAL'; }
 <hive>'LOCAL'                              { return '<hive>LOCAL'; }
@@ -97,6 +98,7 @@
 <hive>'ENABLE'                             { return '<hive>ENABLE'; }
 <hive>'ENABLE'                             { return '<hive>ENABLE'; }
 <hive>'EXCHANGE'                           { return '<hive>EXCHANGE'; }
 <hive>'EXCHANGE'                           { return '<hive>EXCHANGE'; }
 <hive>'EXPLAIN'                            { determineCase(yytext); return '<hive>EXPLAIN'; }
 <hive>'EXPLAIN'                            { determineCase(yytext); return '<hive>EXPLAIN'; }
+<hive>'EXPORT'                             { determineCase(yytext); return '<hive>EXPORT'; }
 <hive>'FIELDS'                             { return '<hive>FIELDS'; }
 <hive>'FIELDS'                             { return '<hive>FIELDS'; }
 <hive>'FILE'                               { return '<hive>FILE'; }
 <hive>'FILE'                               { return '<hive>FILE'; }
 <hive>'FILEFORMAT'                         { return '<hive>FILEFORMAT'; }
 <hive>'FILEFORMAT'                         { return '<hive>FILEFORMAT'; }
@@ -136,6 +138,7 @@
 <hive>'REBUILD'                            { return '<hive>REBUILD'; }
 <hive>'REBUILD'                            { return '<hive>REBUILD'; }
 <hive>'RELOAD'                             { determineCase(yytext); return '<hive>RELOAD'; }
 <hive>'RELOAD'                             { determineCase(yytext); return '<hive>RELOAD'; }
 <hive>'REPAIR'                             { return '<hive>REPAIR'; }
 <hive>'REPAIR'                             { return '<hive>REPAIR'; }
+<hive>'REPLICATION'                        { return '<hive>REPLICATION'; }
 <hive>'RECOVER'                            { return '<hive>RECOVER'; }
 <hive>'RECOVER'                            { return '<hive>RECOVER'; }
 <hive>'RENAME'                             { return '<hive>RENAME'; }
 <hive>'RENAME'                             { return '<hive>RENAME'; }
 <hive>'REPLACE'                            { return '<hive>REPLACE'; }
 <hive>'REPLACE'                            { return '<hive>REPLACE'; }

+ 0 - 27
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_create.jison

@@ -137,33 +137,6 @@ HdfsLocation_EDIT
  : HiveOrImpalaLocation HdfsPath_EDIT
  : HiveOrImpalaLocation HdfsPath_EDIT
  ;
  ;
 
 
-HdfsPath
- : 'HDFS_START_QUOTE' 'HDFS_PATH' 'HDFS_END_QUOTE'
- ;
-
-HdfsPath_EDIT
- : 'HDFS_START_QUOTE' 'HDFS_PATH' 'PARTIAL_CURSOR' 'HDFS_PATH' 'HDFS_END_QUOTE'
-    {
-      suggestHdfs({ path: $2 });
-    }
- | 'HDFS_START_QUOTE' 'HDFS_PATH' 'PARTIAL_CURSOR' 'HDFS_END_QUOTE'
-   {
-     suggestHdfs({ path: $2 });
-   }
- | 'HDFS_START_QUOTE' 'HDFS_PATH' 'PARTIAL_CURSOR'
-    {
-      suggestHdfs({ path: $2 });
-    }
- | 'HDFS_START_QUOTE' 'PARTIAL_CURSOR' 'HDFS_END_QUOTE'
-   {
-     suggestHdfs({ path: '' });
-   }
- | 'HDFS_START_QUOTE' 'PARTIAL_CURSOR'
-    {
-      suggestHdfs({ path: '' });
-    }
- ;
-
 OptionalHiveDbProperties
 OptionalHiveDbProperties
  :
  :
  | HiveDbProperties
  | HiveDbProperties

+ 182 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_load.jison

@@ -16,10 +16,14 @@
 
 
 DataManipulation
 DataManipulation
  : LoadStatement
  : LoadStatement
+ | ImportStatement
+ | ExportStatement
  ;
  ;
 
 
 DataManipulation_EDIT
 DataManipulation_EDIT
  : LoadStatement_EDIT
  : LoadStatement_EDIT
+ | ImportStatement_EDIT
+ | ExportStatement_EDIT
  ;
  ;
 
 
 LoadStatement
 LoadStatement
@@ -107,3 +111,181 @@ AnyInpath
  : '<hive>INPATH'
  : '<hive>INPATH'
  | '<impala>INPATH'
  | '<impala>INPATH'
  ;
  ;
+
+ImportStatement
+ : '<hive>IMPORT' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+ ;
+
+ImportStatement_EDIT
+ : '<hive>IMPORT' 'CURSOR' OptionalTableWithPartition
+   {
+     if (!$3) {
+       suggestKeywords(['EXTERNAL TABLE', 'FROM', 'TABLE']);
+     } else if (!$3.hasExternal) {
+       suggestKeywords(['EXTERNAL']);
+     }
+   }
+ | '<hive>IMPORT' TableWithPartition 'CURSOR'
+   {
+     if ($2.suggestKeywords) {
+        suggestKeywords(createWeightedKeywords($2.suggestKeywords, 2).concat(['FROM']));
+      } else {
+        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'
+   {
+     if (!$6) {
+       suggestKeywords(['LOCATION']);
+     }
+   }
+ | '<hive>IMPORT' 'CURSOR' OptionalTableWithPartition PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+   {
+     if (!$3) {
+       suggestKeywords(['EXTERNAL TABLE', 'TABLE']);
+     } else if (!$3.hasExternal) {
+       suggestKeywords(['EXTERNAL']);
+     }
+   }
+| '<hive>IMPORT' TableWithPartition_EDIT PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+ | '<hive>IMPORT' TableWithPartition 'CURSOR' PushHdfsLexerState 'FROM' HdfsPath OptionalHdfsLocation
+    {
+      if ($2.suggestKeywords) {
+        suggestKeywords(createWeightedKeywords($2.suggestKeywords, 2).concat(['FROM']));
+      }
+    }
+ ;
+
+OptionalTableWithPartition
+ :
+ | TableWithPartition
+ ;
+
+TableWithPartition
+ : '<hive>EXTERNAL' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+   {
+     addTablePrimary($3);
+     if (!$4) {
+       $$ = { hasExternal: true, suggestKeywords: ['PARTITION'] };
+     } else {
+       $$ = { hasExternal: true }
+     }
+   }
+ | '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec
+   {
+     addTablePrimary($2);
+     if (!$3) {
+       $$ = { suggestKeywords: ['PARTITION'] };
+     }
+   }
+ ;
+
+TableWithPartition_EDIT
+ : '<hive>EXTERNAL' 'CURSOR'
+   {
+     suggestKeywords(['TABLE']);
+   }
+ | '<hive>EXTERNAL' '<hive>TABLE' 'CURSOR'
+   {
+     suggestTables();
+     suggestDatabases({ appendDot: true });
+   }
+ | '<hive>EXTERNAL' '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | '<hive>EXTERNAL' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
+   {
+     addTablePrimary($3);
+   }
+ | '<hive>TABLE' 'CURSOR'
+   {
+     suggestTables();
+     suggestDatabases({ appendDot: true });
+   }
+
+ | '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT OptionalPartitionSpec
+ | '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
+   {
+     addTablePrimary($3);
+   }
+ ;
+
+ExportStatement
+ : '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath
+   {
+     addTablePrimary($3);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+   {
+     addTablePrimary($3);
+   }
+ ;
+
+ExportStatement_EDIT
+ : '<hive>EXPORT' 'CURSOR'
+   {
+     suggestKeywords(['TABLE']);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' 'CURSOR'
+   {
+     suggestTables();
+     suggestDatabases({ appendDot: true });
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier_EDIT
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR'
+   {
+     addTablePrimary($3);
+     if (!$4) {
+       suggestKeywords([{ weight: 2, value: 'PARTITION' }, { weight: 1, value: 'TO' }]);
+     } else {
+       suggestKeywords([ 'TO' ]);
+     }
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT
+   {
+     addTablePrimary($3);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath_EDIT
+   {
+     addTablePrimary($3);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath 'CURSOR'
+   {
+     addTablePrimary($3);
+     suggestKeywords(['FOR replication()']);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' 'CURSOR'
+   {
+     addTablePrimary($3);
+     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
+   {
+     addTablePrimary($3);
+     if (!$4) {
+       suggestKeywords(['PARTITION']);
+     }
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec 'CURSOR' PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+   {
+     addTablePrimary($3);
+     if (!$4) {
+       suggestKeywords(['PARTITION']);
+     }
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT PushHdfsLexerState 'TO' HdfsPath
+   {
+     addTablePrimary($3);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier PartitionSpec_EDIT PushHdfsLexerState 'TO' HdfsPath '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+   {
+     addTablePrimary($3);
+   }
+ | '<hive>EXPORT' '<hive>TABLE' SchemaQualifiedTableIdentifier OptionalPartitionSpec PushHdfsLexerState 'TO' HdfsPath_EDIT '<hive>FOR' '<hive>REPLICATION' '(' QuotedValue ')'
+   {
+     addTablePrimary($3);
+   }
+ ;

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


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


+ 343 - 0
desktop/core/src/desktop/static/desktop/spec/autocomplete/sqlSpecLoad.js

@@ -324,4 +324,347 @@
       });
       });
     });
     });
   });
   });
+
+  describe('sql.js IMPORT and EXPORT statements', function() {
+
+    beforeAll(function () {
+      sql.yy.parseError = function (msg) {
+        throw Error(msg);
+      };
+      jasmine.addMatchers(SqlTestUtils.testDefinitionMatcher);
+    });
+
+    var assertAutoComplete = SqlTestUtils.assertAutocomplete;
+
+    describe('Hive specific', function () {
+      it('should handle "IMPORT EXTERNAL TABLE foo PARTITION (bar=1, boo=2) FROM \'/bla/bla\' LOCATION \'/ble/ble\';|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT EXTERNAL TABLE foo PARTITION (bar=1, boo=2) FROM \'/bla/bla\' LOCATION \'/ble/ble\';',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should handle "IMPORT TABLE foo PARTITION (bar=1, boo=2) FROM \'/bla/bla\' LOCATION \'/ble/ble\';|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT TABLE foo PARTITION (bar=1, boo=2) FROM \'/bla/bla\' LOCATION \'/ble/ble\';',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should handle "IMPORT TABLE foo FROM \'/bla/bla\' LOCATION \'/ble/ble\';|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT TABLE foo FROM \'/bla/bla\' LOCATION \'/ble/ble\';',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should handle "IMPORT FROM \'/bla/bla\' LOCATION \'/ble/ble\';|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT FROM \'/bla/bla\' LOCATION \'/ble/ble\';',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should handle "IMPORT FROM \'/bla/bla\';|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT FROM \'/bla/bla\';',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should suggest keywords for "|"', function () {
+        assertAutoComplete({
+          beforeCursor: '',
+          afterCursor: '',
+          dialect: 'hive',
+          containsKeywords: ['EXPORT', 'IMPORT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should suggest keywords for "IMPORT |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT ',
+          afterCursor: '',
+          dialect: 'hive',
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['EXTERNAL TABLE', 'FROM', 'TABLE']
+          }
+        });
+      });
+
+      it('should suggest keywords for "IMPORT EXTERNAL |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT EXTERNAL ',
+          afterCursor: '',
+          dialect: 'hive',
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['TABLE']
+          }
+        });
+      });
+
+      it('should suggest tables for "IMPORT TABLE |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT TABLE ',
+          afterCursor: '',
+          dialect: 'hive',
+          expectedResult: {
+            lowerCase: false,
+            suggestTables: {},
+            suggestDatabases: { appendDot: true }
+          }
+        });
+      });
+
+      it('should suggest tables for "IMPORT EXTERNAL TABLE |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT EXTERNAL TABLE ',
+          afterCursor: '',
+          dialect: 'hive',
+          expectedResult: {
+            lowerCase: false,
+            suggestTables: {},
+            suggestDatabases: { appendDot: true }
+          }
+        });
+      });
+
+      it('should suggest keywords for "IMPORT TABLE bla |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT TABLE bla ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['PARTITION', 'FROM']
+          }
+        });
+      });
+
+      it('should suggest keywords for "IMPORT EXTERNAL TABLE bla PARTITION (bla=1) |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT EXTERNAL TABLE bla PARTITION (bla=1) ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['FROM']
+          }
+        });
+      });
+
+      it('should suggest hdfs for "IMPORT EXTERNAL TABLE bla PARTITION (bla=1) FROM \'|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT EXTERNAL TABLE bla PARTITION (bla=1) FROM \'',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestHdfs: { path: '' }
+          }
+        });
+      });
+
+      it('should suggest keywords for "IMPORT FROM \'/bla/bla\' |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT FROM \'/bla/bla\' ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['LOCATION']
+          }
+        });
+      });
+
+      it('should suggest hdfs for "IMPORT EXTERNAL TABLE bla PARTITION (bla=1) FROM \'/bla/bla\' LOCATION \'|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'IMPORT EXTERNAL TABLE bla PARTITION (bla=1) FROM \'/bla/bla\' LOCATION \'/bla/',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestHdfs: { path: '/bla/' }
+          }
+        });
+      });
+
+      it('should handle "EXPORT TABLE db.tbl PARTITION (foo=1, bar=2) TO \'/bla/bla\' FOR REPLICATION(\'blaaa\');|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl PARTITION (foo=1, bar=2) TO \'/bla/bla\' FOR REPLICATION(\'blaaa\');',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should handle "EXPORT TABLE db.tbl TO \'/bla/bla\' FOR REPLICATION(\'blaaa\');|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl TO \'/bla/bla\' FOR REPLICATION(\'blaaa\');',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should handle "EXPORT TABLE db.tbl TO \'/bla/bla\';|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl TO \'/bla/bla\';',
+          afterCursor: '',
+          dialect: 'hive',
+          noErrors: true,
+          hasLocations: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
+      it('should suggest keywords for "EXPORT |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT ',
+          afterCursor: '',
+          dialect: 'hive',
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['TABLE']
+          }
+        });
+      });
+
+      it('should suggest tables for "EXPORT TABLE |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE ',
+          afterCursor: '',
+          dialect: 'hive',
+          expectedResult: {
+            lowerCase: false,
+            suggestTables: {},
+            suggestDatabases: { appendDot: true }
+          }
+        });
+      });
+
+      it('should suggest keywords for "EXPORT TABLE db.tbl |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['PARTITION', 'TO']
+          }
+        });
+      });
+
+      it('should suggest keywords for "EXPORT TABLE db.tbl PARTITION (bla=1) |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl PARTITION (bla=1) ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['TO']
+          }
+        });
+      });
+
+      it('should suggest hdfs for "EXPORT TABLE db.tbl PARTITION (bla=1) TO \'|"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl PARTITION (bla=1) TO \'',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestHdfs: { path: '' }
+          }
+        });
+      });
+
+      it('should suggest keywords for "EXPORT TABLE db.tbl TO \'/bla/bla\' |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl TO \'/bla/bla\' ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['FOR replication()']
+          }
+        });
+      });
+
+      it('should suggest keywords for "EXPORT TABLE db.tbl TO \'/bla/bla\' FOR |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'EXPORT TABLE db.tbl TO \'/bla/bla\' FOR ',
+          afterCursor: '',
+          dialect: 'hive',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['replication()']
+          }
+        });
+      });
+    });
+  });
 })();
 })();

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