浏览代码

HUE-4313 [editor] The new autocompleter should accept non-reserved keywords for DBs, tables, columns etc.

Johan Ahlen 9 年之前
父节点
当前提交
1127d73855

文件差异内容过多而无法显示
+ 254 - 186
desktop/core/src/desktop/static/desktop/js/autocomplete/sql.jison


文件差异内容过多而无法显示
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/autocomplete/sql.js


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

@@ -725,6 +725,21 @@ define([
         });
       });
 
+      it('should suggest columns for "SELECT | FROM transactions"', function () {
+        assertAutoComplete({
+          beforeCursor: 'SELECT ',
+          afterCursor: ' FROM transactions',
+          hasLocations: true,
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['*', 'ALL', 'DISTINCT'],
+            suggestAggregateFunctions: true,
+            suggestFunctions: {},
+            suggestColumns: { table: 'transactions' }
+          }
+        });
+      });
+
       it('should suggest aliases for "SELECT | FROM testTableA tta, testTableB"', function() {
         assertAutoComplete({
           beforeCursor: 'SELECT ',

+ 12 - 0
desktop/core/src/desktop/static/desktop/spec/autocomplete/sqlSpecShow.js

@@ -1292,6 +1292,18 @@ define([
         });
       });
 
+      it('should suggest keywords for "SHOW | ROLES"', function() {
+        assertAutoComplete({
+          beforeCursor: 'SHOW ',
+          afterCursor: ' ROLES',
+          dialect: 'impala',
+          expectedResult: {
+            lowerCase: false,
+            suggestKeywords: ['CURRENT']
+          }
+        });
+      });
+
       it('should handle "SHOW CURRENT ROLES;|"', function() {
         assertAutoComplete({
           beforeCursor: 'SHOW CURRENT ROLES;',

部分文件因为文件数量过多而无法显示