Browse Source

HUE-4302 [editor] New autocompleter should suggest DISTINCT or ALL where appropriate in aggregate functions

Johan Ahlen 9 years ago
parent
commit
0c2a890152

+ 115 - 9
desktop/core/src/desktop/static/desktop/js/autocomplete/sql.jison

@@ -176,10 +176,32 @@
 'WITHIN'                            { return 'WITHIN'; }
 
 // --- UDFs ---
-CAST\(                              { return 'CAST('; }
-COUNT\(                             { return 'COUNT('; }
-SUM\(                               { return 'SUM('; }
-<impala>EXTRACT\(                   { return '<impala>EXTRACT('; }
+<impala>'APPX_MEDIAN('              { return '<impala>APPX_MEDIAN('; }
+'AVG('                              { return 'AVG('; }
+'CAST('                             { return 'CAST('; }
+'COUNT('                            { return 'COUNT('; }
+'MAX('                              { return 'MAX('; }
+'MIN('                              { return 'MIN('; }
+'STDDEV_POP('                       { return 'STDDEV_POP('; }
+'STDDEV_SAMP('                      { return 'STDDEV_SAMP('; }
+'SUM('                              { return 'SUM('; }
+'VARIANCE('                         { return 'VARIANCE('; }
+'VAR_POP('                          { return 'VAR_POP('; }
+'VAR_SAMP('                         { return 'VAR_SAMP('; }
+<hive>'COLLECT_SET('                { return '<hive>COLLECT_SET('; }
+<hive>'COLLECT_LIST('               { return '<hive>COLLECT_LIST('; }
+<hive>'CORR('                       { return '<hive>CORR('; }
+<hive>'COVAR_POP('                  { return '<hive>COVAR_POP('; }
+<hive>'COVAR_SAMP('                 { return '<hive>COVAR_SAMP('; }
+<hive>'HISTOGRAM_NUMERIC('          { return '<hive>HISTOGRAM_NUMERIC('; }
+<hive>'NTILE('                      { return '<hive>NTILE('; }
+<hive>'PERCENTILE('                 { return '<hive>PERCENTILE('; }
+<hive>'PERCENTILE_APPROX('          { return '<hive>PERCENTILE_APPROX('; }
+<impala>'EXTRACT('                  { return '<impala>EXTRACT('; }
+<impala>'GROUP_CONCAT('             { return '<impala>GROUP_CONCAT('; }
+<impala>'STDDEV('                   { return '<impala>STDDEV('; }
+<impala>'VARIANCE_POP('             { return '<impala>VARIANCE_POP('; }
+<impala>'VARIANCE_SAMP('            { return '<impala>VARIANCE_SAMP('; }
 
 [A-Za-z][A-Za-z0-9_]*\(             { return 'UDF('; }
 
@@ -1682,10 +1704,12 @@ ValueExpressionList_EDIT
    }
  | AnyCursor ',' ValueExpressionList
    {
+     $$ = { cursorAtStart : true };
      valueExpressionSuggest();
    }
  | AnyCursor ','
    {
+     $$ = { cursorAtStart : true };
      valueExpressionSuggest();
    }
  | ',' AnyCursor
@@ -2373,18 +2397,16 @@ OptionalFilterClause
 
 UserDefinedFunction
  : ArbitraryFunction
+ | AggregateFunction
  | CastFunction
- | CountFunction
  | ExtractFunction
- | SumFunction
  ;
 
 UserDefinedFunction_EDIT
  : ArbitraryFunction_EDIT
+ | AggregateFunction_EDIT
  | CastFunction_EDIT
- | CountFunction_EDIT
  | ExtractFunction_EDIT
- | SumFunction_EDIT
  ;
 
 ArbitraryFunction
@@ -2411,6 +2433,18 @@ ArbitraryFunction_EDIT
  | 'UDF(' ValueExpressionList_EDIT RightParenthesisOrError
  ;
 
+AggregateFunction
+ : CountFunction
+ | SumFunction
+ | OtherAggregateFunction
+ ;
+
+AggregateFunction_EDIT
+ : CountFunction_EDIT
+ | SumFunction_EDIT
+ | OtherAggregateFunction_EDIT
+ ;
+
 CastFunction
  : 'CAST(' ValueExpression AnyAs PrimitiveType ')'
  | 'CAST(' ')'
@@ -2473,6 +2507,78 @@ CountFunction_EDIT
      checkForKeywords($3);
    }
  | 'COUNT(' OptionalAllOrDistinct ValueExpressionList_EDIT RightParenthesisOrError
+   {
+     if ($3.cursorAtStart && !$2) {
+       if (isImpala()) {
+         suggestKeywords(['ALL', 'DISTINCT']);
+       } else {
+         suggestKeywords(['DISTINCT']);
+       }
+     }
+   }
+ ;
+
+OtherAggregateFunction
+ : OtherAggregateFunction_Type OptionalAllOrDistinct ')'
+ | OtherAggregateFunction_Type OptionalAllOrDistinct ValueExpressionList ')'
+ ;
+
+OtherAggregateFunction_EDIT
+ : OtherAggregateFunction_Type OptionalAllOrDistinct AnyCursor RightParenthesisOrError
+   {
+     suggestFunctions();
+     suggestColumns();
+     if (!$2) {
+       if ($1.toLowerCase() === 'group_concat(') {
+         suggestKeywords(['ALL' ]);
+       } else if (isImpala()) {
+         suggestKeywords(['ALL', 'DISTINCT']);
+       } else {
+         suggestKeywords(['DISTINCT']);
+       }
+     }
+   }
+ | OtherAggregateFunction_Type OptionalAllOrDistinct ValueExpressionList 'CURSOR' RightParenthesisOrError
+   {
+     checkForKeywords($3);
+   }
+ | OtherAggregateFunction_Type OptionalAllOrDistinct ValueExpressionList_EDIT RightParenthesisOrError
+   {
+     if ($3.cursorAtStart && !$2) {
+       if ($1.toLowerCase() === 'group_concat(') {
+         suggestKeywords(['ALL' ]);
+       } else if (isImpala()) {
+         suggestKeywords(['ALL', 'DISTINCT']);
+       } else {
+         suggestKeywords(['DISTINCT']);
+       }
+     }
+   }
+ ;
+
+OtherAggregateFunction_Type
+ : '<impala>APPX_MEDIAN('
+ | 'AVG('
+ | '<hive>COLLECT_SET('
+ | '<hive>COLLECT_LIST('
+ | '<hive>CORR('
+ | '<hive>COVAR_POP('
+ | '<hive>COVAR_SAMP('
+ | '<impala>GROUP_CONCAT('
+ | '<hive>HISTOGRAM_NUMERIC'
+ | '<impala>STDDEV('
+ | 'STDDEV_POP('
+ | 'STDDEV_SAMP('
+ | 'MAX('
+ | 'MIN('
+ | '<hive>NTILE('
+ | '<hive>PERCENTILE('
+ | '<hive>PERCENTILE_APPROX('
+ | 'VARIANCE('
+ | '<impala>VARIANCE_POP('
+ | '<impala>VARIANCE_SAMP('
+ | 'VAR_POP('
+ | 'VAR_SAMP('
  ;
 
 ExtractFunction
@@ -3584,7 +3690,7 @@ parser.parseSql = function(beforeCursor, afterCursor, dialect) {
     if (typeof parser.yy.result === 'undefined') {
       throw err;
     }
-    if (parser.yy.result.error) {
+    if (parser.yy.result.error && !parser.yy.result.error.expected) {
       console.log(parser.yy.result.error);
     }
     result = parser.yy.result;

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


+ 31 - 31
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter2.js

@@ -343,37 +343,37 @@
       { name: 'upper()', returnType: 'STRING', signature: 'upper(STRING a)', description: 'Returns the string resulting from converting all characters of A to upper case. For example, upper(\'fOoBaR\') results in \'FOOBAR\'.' }
     ],
     impala: [
-      { name: 'ascii', returnType: 'INT', signature: 'ascii(STRING str)', description: 'Returns the numeric ASCII code of the first character of the argument.' },
-      { name: 'char_length', returnType: 'INT', signature: 'char_length(STRING a)', description: 'Returns the length in characters of the argument string. Aliases for the length() function.' },
-      { name: 'character_length', returnType: 'INT', signature: 'character_length(STRING a)', description: 'Returns the length in characters of the argument string. Aliases for the length() function.' },
-      { name: 'concat', returnType: 'STRING', signature: 'concat(STRING a, STRING b...)', description: 'Returns a single string representing all the argument values joined together.' },
-      { name: 'concat_ws', returnType: 'STRING', signature: 'concat_ws(STRING sep, STRING a, STRING b...)', description: 'Returns a single string representing the second and following argument values joined together, delimited by a specified separator.' },
-      { name: 'find_in_set', returnType: 'INT', signature: 'find_in_set(STRING str, STRING strList)', description: 'Returns the position (starting from 1) of the first occurrence of a specified string within a comma-separated string. Returns NULL if either argument is NULL, 0 if the search string is not found, or 0 if the search string contains a comma.' },
-      { name: 'group_concat', returnType: 'STRING', signature: 'group_concat(STRING s [, STRING sep])', description: 'Returns a single string representing the argument value concatenated together for each row of the result set. If the optional separator string is specified, the separator is added between each pair of concatenated values.' },
-      { name: 'initcap', returnType: 'STRING', signature: 'initcap(STRING str)', description: 'Returns the input string with the first letter capitalized.' },
-      { name: 'instr', returnType: 'INT', signature: 'instr(STRING str, STRING substr)', description: 'Returns the position (starting from 1) of the first occurrence of a substring within a longer string.' },
-      { name: 'length', returnType: 'INT', signature: 'length(STRING a)', description: 'Returns the length in characters of the argument string.' },
-      { name: 'locate', returnType: 'INT', signature: 'locate(STRING substr, string str[, int pos])', description: 'Returns the position (starting from 1) of the first occurrence of a substring within a longer string, optionally after a particular position.' },
-      { name: 'lower', returnType: 'STRING', signature: 'lower(STRING a)', description: 'Returns the argument string converted to all-lowercase.' },
-      { name: 'lcase', returnType: 'STRING', signature: 'lcase(STRING a)', description: 'Returns the argument string converted to all-lowercase.' },
-      { name: 'lpad', returnType: 'STRING', signature: 'lpad(STRING str, int len, string pad)', description: 'Returns a string of a specified length, based on the first argument string. If the specified string is too short, it is padded on the left with a repeating sequence of the characters from the pad string. If the specified string is too long, it is truncated on the right.' },
-      { name: 'ltrim', returnType: 'STRING', signature: 'ltrim(STRING a)', description: 'Returns the argument string with any leading spaces removed from the left side.' },
-      { name: 'parse_url', returnType: 'STRING', signature: 'parse_url(STRING urlString, STRING partToExtract [, STRING keyToExtract])', description: 'Returns the portion of a URL corresponding to a specified part. The part argument can be \'PROTOCOL\', \'HOST\', \'PATH\', \'REF\', \'AUTHORITY\', \'FILE\', \'USERINFO\', or \'QUERY\'. Uppercase is required for these literal values. When requesting the QUERY portion of the URL, you can optionally specify a key to retrieve just the associated value from the key-value pairs in the query string.' },
-      { name: 'regexp_extract', returnType: 'STRING', signature: 'regexp_extract(STRING subject, STRING pattern, INT index)', description: 'Returns the specified () group from a string based on a regular expression pattern. Group 0 refers to the entire extracted string, while group 1, 2, and so on refers to the first, second, and so on (...) portion.' },
-      { name: 'regexp_replace', returnType: 'STRING', signature: 'regexp_replace(STRING initial, STRING pattern, STRING replacement)', description: 'Returns the initial argument with the regular expression pattern replaced by the final argument string.' },
-      { name: 'repeat', returnType: 'STRING', signature: 'repeat(STRING str, INT n)', description: 'Returns the argument string repeated a specified number of times.' },
-      { name: 'reverse', returnType: 'STRING', signature: 'reverse(STRING a)', description: 'Returns the argument string with characters in reversed order.' },
-      { name: 'rpad', returnType: 'STRING', signature: 'rpad(STRING str, INT len, STRING pad)', description: 'Returns a string of a specified length, based on the first argument string. If the specified string is too short, it is padded on the right with a repeating sequence of the characters from the pad string. If the specified string is too long, it is truncated on the right.' },
-      { name: 'rtrim', returnType: 'STRING', signature: 'rtrim(STRING a)', description: 'Returns the argument string with any trailing spaces removed from the right side.' },
-      { name: 'space', returnType: 'STRING', signature: 'space(INT n)', description: 'Returns a concatenated string of the specified number of spaces. Shorthand for repeat(\' \', n).' },
-      { name: 'strleft', returnType: 'STRING', signature: 'strleft(STRING a, INT num_chars)', description: 'Returns the leftmost characters of the string. Shorthand for a call to substr() with 2 arguments.' },
-      { name: 'strright', returnType: 'STRING', signature: 'strright(STRING a, INT num_chars)', description: 'Returns the rightmost characters of the string. Shorthand for a call to substr() with 2 arguments.' },
-      { name: 'substr', returnType: 'STRING', signature: 'substr(STRING a, INT start [, INT len])', description: 'Returns the portion of the string starting at a specified point, optionally with a specified maximum length. The characters in the string are indexed starting at 1.' },
-      { name: 'substring', returnType: 'STRING', signature: 'substring(STRING a, INT start [, INT len])', description: 'Returns the portion of the string starting at a specified point, optionally with a specified maximum length. The characters in the string are indexed starting at 1.' },
-      { name: 'translate', returnType: 'STRING', signature: 'translate(STRING input, STRING from, STRING to)', description: 'Returns the input string with a set of characters replaced by another set of characters.' },
-      { name: 'trim', returnType: 'STRING', signature: 'trim(STRING a)', description: 'Returns the input string with both leading and trailing spaces removed. The same as passing the string through both ltrim() and rtrim().' },
-      { name: 'upper', returnType: 'STRING', signature: 'upper(STRING a)', description: 'Returns the argument string converted to all-uppercase.' },
-      { name: 'ucase', returnType: 'STRING', signature: 'ucase(STRING a)', description: 'Returns the argument string converted to all-uppercase.' }
+      { name: 'ascii()', returnType: 'INT', signature: 'ascii(STRING str)', description: 'Returns the numeric ASCII code of the first character of the argument.' },
+      { name: 'char_length()', returnType: 'INT', signature: 'char_length(STRING a)', description: 'Returns the length in characters of the argument string. Aliases for the length() function.' },
+      { name: 'character_length()', returnType: 'INT', signature: 'character_length(STRING a)', description: 'Returns the length in characters of the argument string. Aliases for the length() function.' },
+      { name: 'concat()', returnType: 'STRING', signature: 'concat(STRING a, STRING b...)', description: 'Returns a single string representing all the argument values joined together.' },
+      { name: 'concat_ws()', returnType: 'STRING', signature: 'concat_ws(STRING sep, STRING a, STRING b...)', description: 'Returns a single string representing the second and following argument values joined together, delimited by a specified separator.' },
+      { name: 'find_in_set()', returnType: 'INT', signature: 'find_in_set(STRING str, STRING strList)', description: 'Returns the position (starting from 1) of the first occurrence of a specified string within a comma-separated string. Returns NULL if either argument is NULL, 0 if the search string is not found, or 0 if the search string contains a comma.' },
+      { name: 'group_concat()', returnType: 'STRING', signature: 'group_concat(STRING s [, STRING sep])', description: 'Returns a single string representing the argument value concatenated together for each row of the result set. If the optional separator string is specified, the separator is added between each pair of concatenated values.' },
+      { name: 'initcap()', returnType: 'STRING', signature: 'initcap(STRING str)', description: 'Returns the input string with the first letter capitalized.' },
+      { name: 'instr()', returnType: 'INT', signature: 'instr(STRING str, STRING substr)', description: 'Returns the position (starting from 1) of the first occurrence of a substring within a longer string.' },
+      { name: 'length()', returnType: 'INT', signature: 'length(STRING a)', description: 'Returns the length in characters of the argument string.' },
+      { name: 'locate()', returnType: 'INT', signature: 'locate(STRING substr, string str[, int pos])', description: 'Returns the position (starting from 1) of the first occurrence of a substring within a longer string, optionally after a particular position.' },
+      { name: 'lower()', returnType: 'STRING', signature: 'lower(STRING a)', description: 'Returns the argument string converted to all-lowercase.' },
+      { name: 'lcase()', returnType: 'STRING', signature: 'lcase(STRING a)', description: 'Returns the argument string converted to all-lowercase.' },
+      { name: 'lpad()', returnType: 'STRING', signature: 'lpad(STRING str, int len, string pad)', description: 'Returns a string of a specified length, based on the first argument string. If the specified string is too short, it is padded on the left with a repeating sequence of the characters from the pad string. If the specified string is too long, it is truncated on the right.' },
+      { name: 'ltrim()', returnType: 'STRING', signature: 'ltrim(STRING a)', description: 'Returns the argument string with any leading spaces removed from the left side.' },
+      { name: 'parse_url()', returnType: 'STRING', signature: 'parse_url(STRING urlString, STRING partToExtract [, STRING keyToExtract])', description: 'Returns the portion of a URL corresponding to a specified part. The part argument can be \'PROTOCOL\', \'HOST\', \'PATH\', \'REF\', \'AUTHORITY\', \'FILE\', \'USERINFO\', or \'QUERY\'. Uppercase is required for these literal values. When requesting the QUERY portion of the URL, you can optionally specify a key to retrieve just the associated value from the key-value pairs in the query string.' },
+      { name: 'regexp_extract()', returnType: 'STRING', signature: 'regexp_extract(STRING subject, STRING pattern, INT index)', description: 'Returns the specified () group from a string based on a regular expression pattern. Group 0 refers to the entire extracted string, while group 1, 2, and so on refers to the first, second, and so on (...) portion.' },
+      { name: 'regexp_replace()', returnType: 'STRING', signature: 'regexp_replace(STRING initial, STRING pattern, STRING replacement)', description: 'Returns the initial argument with the regular expression pattern replaced by the final argument string.' },
+      { name: 'repeat()', returnType: 'STRING', signature: 'repeat(STRING str, INT n)', description: 'Returns the argument string repeated a specified number of times.' },
+      { name: 'reverse()', returnType: 'STRING', signature: 'reverse(STRING a)', description: 'Returns the argument string with characters in reversed order.' },
+      { name: 'rpad()', returnType: 'STRING', signature: 'rpad(STRING str, INT len, STRING pad)', description: 'Returns a string of a specified length, based on the first argument string. If the specified string is too short, it is padded on the right with a repeating sequence of the characters from the pad string. If the specified string is too long, it is truncated on the right.' },
+      { name: 'rtrim()', returnType: 'STRING', signature: 'rtrim(STRING a)', description: 'Returns the argument string with any trailing spaces removed from the right side.' },
+      { name: 'space()', returnType: 'STRING', signature: 'space(INT n)', description: 'Returns a concatenated string of the specified number of spaces. Shorthand for repeat(\' \', n).' },
+      { name: 'strleft()', returnType: 'STRING', signature: 'strleft(STRING a, INT num_chars)', description: 'Returns the leftmost characters of the string. Shorthand for a call to substr() with 2 arguments.' },
+      { name: 'strright()', returnType: 'STRING', signature: 'strright(STRING a, INT num_chars)', description: 'Returns the rightmost characters of the string. Shorthand for a call to substr() with 2 arguments.' },
+      { name: 'substr()', returnType: 'STRING', signature: 'substr(STRING a, INT start [, INT len])', description: 'Returns the portion of the string starting at a specified point, optionally with a specified maximum length. The characters in the string are indexed starting at 1.' },
+      { name: 'substring()', returnType: 'STRING', signature: 'substring(STRING a, INT start [, INT len])', description: 'Returns the portion of the string starting at a specified point, optionally with a specified maximum length. The characters in the string are indexed starting at 1.' },
+      { name: 'translate()', returnType: 'STRING', signature: 'translate(STRING input, STRING from, STRING to)', description: 'Returns the input string with a set of characters replaced by another set of characters.' },
+      { name: 'trim()', returnType: 'STRING', signature: 'trim(STRING a)', description: 'Returns the input string with both leading and trailing spaces removed. The same as passing the string through both ltrim() and rtrim().' },
+      { name: 'upper()', returnType: 'STRING', signature: 'upper(STRING a)', description: 'Returns the argument string converted to all-uppercase.' },
+      { name: 'ucase()', returnType: 'STRING', signature: 'ucase(STRING a)', description: 'Returns the argument string converted to all-uppercase.' }
     ]
   };
 

+ 34 - 17
desktop/core/src/desktop/static/desktop/spec/autocomplete/sqlSpecSelect.js

@@ -882,26 +882,41 @@ define([
 
       it('should suggest columns for "SELECT <GeneralSetFunction>(|) FROM testTable"', function () {
         var aggregateFunctions = [
-          { name: 'AVG'},
+          { name: 'APPX_MEDIAN', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'AVG', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'AVG', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'AVG', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'collect_set', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'COLLECT_LIST', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
           { name: 'COUNT', dialect: 'generic', suggestKeywords: ['*', 'DISTINCT'] },
           { name: 'COUNT', dialect: 'hive', suggestKeywords: ['*', 'DISTINCT'] },
           { name: 'COUNT', dialect: 'impala', suggestKeywords: ['*', 'ALL', 'DISTINCT'] },
-          { name: 'STDDEV_POP' },
-          { name: 'STDDEV_SAMP' },
+          { name: 'GROUP_CONCAT', dialect: 'impala', suggestKeywords: ['ALL'] },
+          { name: 'stddev', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'STDDEV_POP', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'STDDEV_POP', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'STDDEV_POP', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'STDDEV_SAMP', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'STDDEV_SAMP', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'STDDEV_SAMP', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
           { name: 'SUM', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
-          { name: 'SUM', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'sum', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
           { name: 'SUM', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
-          { name: 'MAX' },
-          { name: 'MIN' },
-          { name: 'VAR_POP' },
-          { name: 'VAR_SAMP' },
-          { name: 'COLLECT_SET', dialect: 'hive' },
-          { name: 'COLLECT_LIST', dialect: 'hive' },
-          { name: 'APPX_MEDIAN', dialect: 'impala' },
-          { name: 'STDDEV', dialect: 'impala' },
-          { name: 'VARIANCE', dialect: 'impala' },
-          { name: 'VARIANCE_POP', dialect: 'impala' },
-          { name: 'VARIANCE_SAMP', dialect: 'impala' }
+          { name: 'MAX', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'MAX', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'max', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'MIN', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'MIN', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'MIN', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'VARIANCE', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'variance_pop', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'VARIANCE_SAMP', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'VAR_POP', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'VAR_POP', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'VAR_POP', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] },
+          { name: 'var_samp', dialect: 'generic', suggestKeywords: ['DISTINCT'] },
+          { name: 'VAR_SAMP', dialect: 'hive', suggestKeywords: ['DISTINCT'] },
+          { name: 'VAR_SAMP', dialect: 'impala', suggestKeywords: ['ALL', 'DISTINCT'] }
         ];
         aggregateFunctions.forEach(function (aggregateFunction) {
           if (aggregateFunction.name === 'COUNT') {
@@ -955,7 +970,8 @@ define([
               suggestFunctions: true,
               suggestColumns: {
                 table: 'testTable'
-              }
+              },
+              suggestKeywords: ['DISTINCT']
             }
           });
         })
@@ -1001,7 +1017,8 @@ define([
               suggestFunctions: true,
               suggestColumns: {
                 table: 'testTable'
-              }
+              },
+              suggestKeywords: ['DISTINCT']
             }
           });
         })

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