Browse Source

HUE-7276 [autocomplete] Support variable references in limit clause for Hive

Johan Ahlen 8 years ago
parent
commit
b054888

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

@@ -2261,6 +2261,7 @@ OptionalLimitClause
 
 LimitClause
  : 'LIMIT' UnsignedNumericLiteral
+ | 'LIMIT' 'VARIABLE_REFERENCE'
  | '<impala>LIMIT' ValueExpression
  ;
 

+ 13 - 1
desktop/core/src/desktop/static/desktop/js/autocomplete/spec/sqlSpecSelect.js

@@ -314,7 +314,7 @@
         });
       });
 
-      it ('should handle "SELECT bla NOT RLIKE \'ble\', ble NOT REGEXP \'b\' FROM tbl; |"', function () {
+      it('should handle "SELECT bla NOT RLIKE \'ble\', ble NOT REGEXP \'b\' FROM tbl; |"', function () {
         assertAutoComplete({
           beforeCursor: 'SELECT bla NOT RLIKE \'ble\', ble NOT REGEXP \'b\' FROM tbl; ',
           afterCursor: '',
@@ -326,6 +326,18 @@
         });
       });
 
+      it('should handle "SELECT * FROM tbl limit ${limit=20}; |"', function () {
+        assertAutoComplete({
+          beforeCursor: 'SELECT * FROM tbl limit ${limit=20}; ',
+          afterCursor: '',
+          noErrors: true,
+          containsKeywords: ['SELECT'],
+          expectedResult: {
+            lowerCase: false
+          }
+        });
+      });
+
       it('should suggest columns "SELECT IF(baa, boo, bee) AS b, | FROM testTable;"', function () {
         assertAutoComplete({
           beforeCursor: 'SELECT IF(baa, boo, bee) AS b, ',

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