Browse Source

HUE-6958 [autocomplete] Update the Hive TABLESAMPLE autocomplete

Johan Ahlen 8 years ago
parent
commit
595fcc3

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

@@ -149,6 +149,7 @@
 <hive>'PARQUET'                            { return '<hive>PARQUET'; }
 <hive>'PARQUET'                            { return '<hive>PARQUET'; }
 <hive>'PARTITIONED'                        { return '<hive>PARTITIONED'; }
 <hive>'PARTITIONED'                        { return '<hive>PARTITIONED'; }
 <hive>'PARTITIONS'                         { return '<hive>PARTITIONS'; }
 <hive>'PARTITIONS'                         { return '<hive>PARTITIONS'; }
+<hive>'PERCENT'                            { return '<hive>PERCENT'; }
 <hive>'PRIVILEGES'                         { return '<hive>PRIVILEGES'; }
 <hive>'PRIVILEGES'                         { return '<hive>PRIVILEGES'; }
 <hive>'PURGE'                              { return '<hive>PURGE'; }
 <hive>'PURGE'                              { return '<hive>PURGE'; }
 <hive>'QUARTER'                            { return '<hive>QUARTER'; }
 <hive>'QUARTER'                            { return '<hive>QUARTER'; }

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


+ 63 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecSelect.js

@@ -5972,6 +5972,45 @@
           });
           });
         });
         });
 
 
+        it('should handle "SELECT * FROM boo TABLESAMPLE (0.1 PERCENT) baa;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT * FROM boo TABLESAMPLE (0.1 PERCENT) baa;',
+            afterCursor: '',
+            dialect: 'hive',
+            noErrors: true,
+            containsKeywords: ['SELECT'],
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "SELECT * FROM boo TABLESAMPLE (5 ROWS) baa;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT * FROM boo TABLESAMPLE (5 ROWS) baa;',
+            afterCursor: '',
+            dialect: 'hive',
+            noErrors: true,
+            containsKeywords: ['SELECT'],
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
+        it('should handle "SELECT * FROM boo TABLESAMPLE (205B) baa;|"', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT * FROM boo TABLESAMPLE (205B) baa;',
+            afterCursor: '',
+            dialect: 'hive',
+            noErrors: true,
+            containsKeywords: ['SELECT'],
+            expectedResult: {
+              lowerCase: false
+            }
+          });
+        });
+
         it('should suggest keywords for "SELECT * FROM boo |', function () {
         it('should suggest keywords for "SELECT * FROM boo |', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT * FROM boo ',
             beforeCursor: 'SELECT * FROM boo ',
@@ -6017,6 +6056,30 @@
           });
           });
         });
         });
 
 
+        it('should suggest keywords for "SELECT * FROM boo TABLESAMPLE (0.1 |', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT * FROM boo TABLESAMPLE (0.1 ',
+            afterCursor: '',
+            dialect: 'hive',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['PERCENT']
+            }
+          });
+        });
+
+        it('should suggest keywords for "SELECT * FROM boo TABLESAMPLE (1 |', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT * FROM boo TABLESAMPLE (1 ',
+            afterCursor: '',
+            dialect: 'hive',
+            expectedResult: {
+              lowerCase: false,
+              suggestKeywords: ['PERCENT', 'ROWS']
+            }
+          });
+        });
+
         it('should suggest keywords for "SELECT * FROM boo TABLESAMPLE (BUCKET 1 |', function () {
         it('should suggest keywords for "SELECT * FROM boo TABLESAMPLE (BUCKET 1 |', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT * FROM boo TABLESAMPLE (BUCKET 1 ',
             beforeCursor: 'SELECT * FROM boo TABLESAMPLE (BUCKET 1 ',

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