Browse Source

HUE-7987 [autocomplete] Update the autocompleter and UDF library for Hive

- Suggest aggregate functions in the OVER clause
- Fix JS error when virtual columns are suggested
Johan Ahlen 7 years ago
parent
commit
78bfffa912

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

@@ -3379,7 +3379,17 @@ WindowExpression
 
 
 WindowExpression_EDIT
 WindowExpression_EDIT
  : '(' PartitionBy_EDIT OptionalOrderByAndWindow RightParenthesisOrError
  : '(' PartitionBy_EDIT OptionalOrderByAndWindow RightParenthesisOrError
+   {
+     if (parser.yy.result.suggestFunctions) {
+       parser.suggestAggregateFunctions();
+     }
+   }
  | '(' OptionalPartitionBy OptionalOrderByAndWindow_EDIT RightParenthesisOrError
  | '(' OptionalPartitionBy OptionalOrderByAndWindow_EDIT RightParenthesisOrError
+   {
+     if (parser.yy.result.suggestFunctions) {
+       parser.suggestAggregateFunctions();
+     }
+   }
  | '(' AnyCursor OptionalPartitionBy OptionalOrderByAndWindow RightParenthesisOrError
  | '(' AnyCursor OptionalPartitionBy OptionalOrderByAndWindow RightParenthesisOrError
    {
    {
      if (!$3 && !$4) {
      if (!$3 && !$4) {

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

@@ -1293,6 +1293,7 @@
           containsKeywords: ['CASE'],
           containsKeywords: ['CASE'],
           expectedResult: {
           expectedResult: {
             lowerCase: false,
             lowerCase: false,
+            suggestAggregateFunctions: { tables: [] },
             suggestFunctions: {},
             suggestFunctions: {},
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] }
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] }
           }
           }
@@ -1306,6 +1307,7 @@
           containsKeywords: ['CASE'],
           containsKeywords: ['CASE'],
           expectedResult: {
           expectedResult: {
             lowerCase: false,
             lowerCase: false,
+            suggestAggregateFunctions: { tables: [] },
             suggestFunctions: {},
             suggestFunctions: {},
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] } // TODO: source: 'order by'
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] } // TODO: source: 'order by'
           }
           }
@@ -1330,6 +1332,7 @@
           containsKeywords: ['CASE'],
           containsKeywords: ['CASE'],
           expectedResult: {
           expectedResult: {
             lowerCase: false,
             lowerCase: false,
+            suggestAggregateFunctions: { tables: [] },
             suggestFunctions: {},
             suggestFunctions: {},
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] }
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] }
           }
           }
@@ -1343,6 +1346,7 @@
           containsKeywords: ['CASE'],
           containsKeywords: ['CASE'],
           expectedResult: {
           expectedResult: {
             lowerCase: false,
             lowerCase: false,
+            suggestAggregateFunctions: { tables: [] },
             suggestFunctions: {},
             suggestFunctions: {},
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] }
             suggestColumns: { source: 'select',  tables: [{ identifierChain: [{ name: 'testTable' }] }] }
           }
           }

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


+ 2 - 2
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter3.js

@@ -616,14 +616,14 @@ var AutocompleteResults = (function () {
                 meta: HUE_I18n.autocomplete.meta.virtual,
                 meta: HUE_I18n.autocomplete.meta.virtual,
                 category: CATEGORIES.VIRTUAL_COLUMN,
                 category: CATEGORIES.VIRTUAL_COLUMN,
                 popular: ko.observable(false),
                 popular: ko.observable(false),
-                details: null
+                details: { name: 'BLOCK__OFFSET__INSIDE__FILE' }
               });
               });
               columnSuggestions.push({
               columnSuggestions.push({
                 value: 'INPUT__FILE__NAME',
                 value: 'INPUT__FILE__NAME',
                 meta: HUE_I18n.autocomplete.meta.virtual,
                 meta: HUE_I18n.autocomplete.meta.virtual,
                 category: CATEGORIES.VIRTUAL_COLUMN,
                 category: CATEGORIES.VIRTUAL_COLUMN,
                 popular: ko.observable(false),
                 popular: ko.observable(false),
-                details: null
+                details: { name: 'INPUT__FILE__NAME' }
               });
               });
             }
             }
             columnsDeferred.resolve(columnSuggestions);
             columnsDeferred.resolve(columnSuggestions);

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