Browse Source

HUE-4665 [editor] Autocompletion of lateral views should not have parenthesis around the column aliases

This also moves the lateral view definitions to the end of the table list instead of inside which was invalid.
Johan Ahlen 9 years ago
parent
commit
b60ffd2418

+ 4 - 4
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_error.jison

@@ -70,10 +70,10 @@ ErrorList
  ;
  ;
 
 
 LateralView
 LateralView
- : '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction RegularIdentifier error  -> []
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction error                    -> []
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter error                                        -> []
- | '<hive>LATERAL' error                                                                   -> []
+ : '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction RegularOrBacktickedIdentifier '<hive>AS' error  -> { }
+ | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction error                                           -> { }
+ | '<hive>LATERAL' '<hive>VIEW' OptionalOuter error                                                               -> { }
+ | '<hive>LATERAL' error                                                                                          -> { }
  ;
  ;
 
 
 JoinTypes_EDIT
 JoinTypes_EDIT

+ 81 - 58
desktop/core/src/desktop/static/desktop/js/autocomplete/jison/sql_main.jison

@@ -1302,19 +1302,27 @@ TableExpression_EDIT
    {
    {
      var keywords = [];
      var keywords = [];
 
 
-     if ($1 && typeof $1.hasJoinCondition !== 'undefined' && !$1.hasJoinCondition) {
-       keywords.push({ value: 'ON', weight: 3 });
-       if (isImpala()) {
-         keywords.push({ value: 'USING', weight: 3 });
+     if ($1) {
+       if (!$1.hasLateralViews && typeof $1.tableReferenceList.hasJoinCondition !== 'undefined' && !$1.tableReferenceList.hasJoinCondition) {
+         keywords.push({ value: 'ON', weight: 3 });
+         if (isImpala()) {
+           keywords.push({ value: 'USING', weight: 3 });
+         }
        }
        }
-     } else if ($1 && $1.suggestKeywords) {
-       keywords = createWeightedKeywords($1.suggestKeywords, 3);
-     } else if ($1 && $1.types) {
-       var veKeywords = getValueExpressionKeywords($1);
-       keywords = veKeywords.suggestKeywords;
-       if (veKeywords.suggestColRefKeywords) {
-         suggestColRefKeywords(veKeywords.suggestColRefKeywords);
-         addColRefIfExists($1);
+       if ($1.suggestKeywords) {
+         keywords = createWeightedKeywords($1.suggestKeywords, 3);
+       }
+       if (!$1.hasLateralViews && $1.tableReferenceList.suggestKeywords) {
+         keywords = keywords.concat(createWeightedKeywords($1.tableReferenceList.suggestKeywords, 3));
+       }
+
+       if (!$1.hasLateralViews && $1.tableReferenceList.types) {
+         var veKeywords = getValueExpressionKeywords($1.tableReferenceList);
+         keywords = keywords.concat(veKeywords.suggestKeywords);
+         if (veKeywords.suggestColRefKeywords) {
+           suggestColRefKeywords(veKeywords.suggestColRefKeywords);
+           addColRefIfExists($1.tableReferenceList);
+         }
        }
        }
      }
      }
 
 
@@ -1389,16 +1397,36 @@ OptionalJoins
  ;
  ;
 
 
 FromClause
 FromClause
- : 'FROM' TableReferenceList  -> $2
+ : 'FROM' TableReferenceList OptionalLateralViews
+   {
+     if (isHive()) {
+       $$ = { tableReferenceList : $2, suggestKeywords: ['LATERAL VIEW'] }
+     } else {
+       $$ = { tableReferenceList : $2 }
+     }
+     if (isHive() && $3) {
+       parser.yy.lateralViews = $3.lateralViews;
+       $$.hasLateralViews = true;
+       if ($3.suggestKeywords) {
+         $$.suggestKeywords = $$.suggestKeywords.concat($3.suggestKeywords);
+       }
+     }
+   }
  ;
  ;
 
 
 FromClause_EDIT
 FromClause_EDIT
- : 'FROM' TableReferenceList_EDIT
- | 'FROM' 'CURSOR'
+ : 'FROM' 'CURSOR'
    {
    {
        suggestTables();
        suggestTables();
        suggestDatabases({ appendDot: true });
        suggestDatabases({ appendDot: true });
    }
    }
+ | 'FROM' TableReferenceList_EDIT OptionalLateralViews
+   {
+     if ($3) {
+       parser.yy.lateralViews = $3.lateralViews;
+     }
+   }
+ | 'FROM' TableReferenceList OptionalLateralViews_EDIT
  ;
  ;
 
 
 OptionalSelectConditions
 OptionalSelectConditions
@@ -2322,56 +2350,44 @@ JoinCondition_EDIT
  ;
  ;
 
 
 TablePrimary
 TablePrimary
- : TableOrQueryName OptionalTableSample OptionalCorrelationName OptionalLateralViews
+ : TableOrQueryName OptionalTableSample OptionalCorrelationName
    {
    {
      if ($1.identifierChain) {
      if ($1.identifierChain) {
        if ($3) {
        if ($3) {
          $1.alias = $3
          $1.alias = $3
        }
        }
-       if ($4 && $4.length > 0) {
-         $1.lateralViews = $4;
-       }
        addTablePrimary($1);
        addTablePrimary($1);
      }
      }
      // Right-to-left for cursor after TablePrimary
      // Right-to-left for cursor after TablePrimary
-     $$.suggestKeywords = getKeywordsForOptionalsLR([$4, $3, $2], [{ value: 'LATERAL VIEW', weight: 1 }, { value: 'AS', weight: 2 }, { value: 'TABLESAMPLE', weight: 3 }], [isHive(), true, isHive()]);
+     $$.suggestKeywords = getKeywordsForOptionalsLR([$3, $2], [{ value: 'AS', weight: 1 }, { value: 'TABLESAMPLE', weight: 2 }], [true, isHive()]);
    }
    }
- | DerivedTable OptionalCorrelationName OptionalLateralViews
+ | DerivedTable OptionalCorrelationName
    {
    {
-      if ($2) {
+     if ($2) {
        $1.alias = $2;
        $1.alias = $2;
        addTablePrimary({ subQueryAlias: $2 });
        addTablePrimary({ subQueryAlias: $2 });
+     } else {
+       $$.suggestKeywords = [{ value: 'AS', weight: 1 }];
      }
      }
    }
    }
  ;
  ;
 
 
 TablePrimary_EDIT
 TablePrimary_EDIT
- : TableOrQueryName_EDIT OptionalTableSample OptionalCorrelationName OptionalLateralViews
- | TableOrQueryName OptionalTableSample_EDIT OptionalCorrelationName OptionalLateralViews
+ : TableOrQueryName_EDIT OptionalTableSample OptionalCorrelationName
+ | TableOrQueryName OptionalTableSample_EDIT OptionalCorrelationName
    {
    {
      if ($3) {
      if ($3) {
        $1.alias = $3;
        $1.alias = $3;
      }
      }
      addTablePrimary($1);
      addTablePrimary($1);
    }
    }
- | TableOrQueryName OptionalTableSample OptionalCorrelationName OptionalLateralViews_EDIT
-   {
-     if ($3) {
-       $1.alias = $3;
-     }
-     addTablePrimary($1);
-   }
- | DerivedTable_EDIT OptionalCorrelationName OptionalLateralViews
+ | DerivedTable_EDIT OptionalCorrelationName
    {
    {
      if ($2) {
      if ($2) {
        addTablePrimary({ subQueryAlias: $2 });
        addTablePrimary({ subQueryAlias: $2 });
      }
      }
    }
    }
- | DerivedTable OptionalCorrelationName_EDIT OptionalLateralViews
- | DerivedTable OptionalCorrelationName OptionalLateralViews_EDIT
-   if ($2) {
-     addTablePrimary({ subQueryAlias: $2 });
-   }
+ | DerivedTable OptionalCorrelationName_EDIT
  ;
  ;
 
 
 TableOrQueryName
 TableOrQueryName
@@ -2439,6 +2455,9 @@ PushQueryState
      if (typeof parser.yy.primariesStack === 'undefined') {
      if (typeof parser.yy.primariesStack === 'undefined') {
        parser.yy.primariesStack = [];
        parser.yy.primariesStack = [];
      }
      }
+     if (typeof parser.yy.lateralViewsStack === 'undefined') {
+       parser.yy.lateralViewsStack = [];
+     }
      if (typeof parser.yy.subQueriesStack === 'undefined') {
      if (typeof parser.yy.subQueriesStack === 'undefined') {
        parser.yy.subQueriesStack = [];
        parser.yy.subQueriesStack = [];
      }
      }
@@ -2447,6 +2466,7 @@ PushQueryState
        parser.yy.resultStack = [];
        parser.yy.resultStack = [];
      }
      }
      parser.yy.primariesStack.push(parser.yy.latestTablePrimaries);
      parser.yy.primariesStack.push(parser.yy.latestTablePrimaries);
+     parser.yy.lateralViewsStack.push(parser.yy.lateralViews);
      parser.yy.resultStack.push(parser.yy.result);
      parser.yy.resultStack.push(parser.yy.result);
      parser.yy.locationsStack.push(parser.yy.locations);
      parser.yy.locationsStack.push(parser.yy.locations);
      parser.yy.subQueriesStack.push(parser.yy.subQueries);
      parser.yy.subQueriesStack.push(parser.yy.subQueries);
@@ -2579,10 +2599,14 @@ OptionalLateralViews
  :
  :
  | OptionalLateralViews LateralView
  | OptionalLateralViews LateralView
    {
    {
-     if ($1) {
-       $$ = $1.concat($2);
-     } else {
-       $$ = $2;
+     if ($1 && $2.lateralView) {
+       $1.lateralViews.push($2.lateralView);
+       $$ = $1;
+     } else if ($2.lateralView) {
+       $$ = { lateralViews: [ $2.lateralView ] };
+     }
+     if ($2.suggestKeywords) {
+       $$.suggestKeywords = $2.suggestKeywords
      }
      }
    }
    }
  ;
  ;
@@ -3186,23 +3210,24 @@ SumFunction_EDIT
  ;
  ;
 
 
 LateralView
 LateralView
- : '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction RegularIdentifier LateralViewColumnAliases  -> [{ udtf: $4, tableAlias: $5, columnAliases: $6 }]
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction LateralViewColumnAliases                    -> [{ udtf: $4, columnAliases: $5 }]
+ : '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction RegularOrBacktickedIdentifier LateralViewColumnAliases  -> { lateralView: { udtf: $4, tableAlias: $5, columnAliases: $6 }}
+ | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction RegularOrBacktickedIdentifier
+   {
+     if ($4.function.toLowerCase() === 'explode') {
+       $$ = { lateralView: { udtf: $4, tableAlias: $5, columnAliases: ['key', 'value'] }, suggestKeywords: ['AS'] };
+     } else if ($4.function.toLowerCase() === 'posexplode') {
+       $$ = { lateralView: { udtf: $4, tableAlias: $5, columnAliases: ['pos', 'val'] }, suggestKeywords: ['AS'] };
+     } else {
+       $$ = { lateralView: { udtf: $4, tableAlias: $5, columnAliases: [] }, suggestKeywords: ['AS'] };
+     }
+   }
+ | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction LateralViewColumnAliases                                -> { lateralView: { udtf: $4, columnAliases: $5 }}
  ;
  ;
 
 
 LateralView_EDIT
 LateralView_EDIT
  : '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction_EDIT
  : '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction_EDIT
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction_EDIT LateralViewColumnAliases
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction RegularIdentifier 'CURSOR'
-   {
-     suggestKeywords(['AS']);
-     $$ = [];
-   }
- | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction 'CURSOR'
-   {
-     suggestKeywords(['AS']);
-     $$ = [];
-   }
+ | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction_EDIT RegularOrBacktickedIdentifier
+ | '<hive>LATERAL' '<hive>VIEW' OptionalOuter UserDefinedFunction_EDIT RegularOrBacktickedIdentifier LateralViewColumnAliases
  | '<hive>LATERAL' '<hive>VIEW' OptionalOuter 'CURSOR'
  | '<hive>LATERAL' '<hive>VIEW' OptionalOuter 'CURSOR'
    {
    {
      if (!$3) {
      if (!$3) {
@@ -3210,12 +3235,10 @@ LateralView_EDIT
      } else {
      } else {
        suggestKeywords(['explode', 'posexplode']);
        suggestKeywords(['explode', 'posexplode']);
      }
      }
-     $$ = [];
    }
    }
  | '<hive>LATERAL' 'CURSOR'
  | '<hive>LATERAL' 'CURSOR'
    {
    {
      suggestKeywords(['VIEW']);
      suggestKeywords(['VIEW']);
-     $$ = [];
    }
    }
  ;
  ;
 
 
@@ -3225,6 +3248,6 @@ OptionalOuter
  ;
  ;
 
 
 LateralViewColumnAliases
 LateralViewColumnAliases
- : '<hive>AS' RegularIdentifier                                -> [ $2 ]
- | '<hive>AS' '(' RegularIdentifier ',' RegularIdentifier ')'  -> [ $3, $5 ]
+ : '<hive>AS' RegularOrBacktickedIdentifier                                    -> [ $2 ]
+ | '<hive>AS' RegularOrBacktickedIdentifier ',' RegularOrBacktickedIdentifier  -> [ $2, $4 ]
  ;
  ;

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


+ 45 - 43
desktop/core/src/desktop/static/desktop/js/autocomplete/sql_support.js

@@ -18,6 +18,7 @@ var prepareNewStatement = function () {
   linkTablePrimaries();
   linkTablePrimaries();
   commitLocations();
   commitLocations();
 
 
+  delete parser.yy.lateralViews;
   delete parser.yy.latestTablePrimaries;
   delete parser.yy.latestTablePrimaries;
   delete parser.yy.latestCommonTableExpressions;
   delete parser.yy.latestCommonTableExpressions;
   delete parser.yy.correlatedSubQuery;
   delete parser.yy.correlatedSubQuery;
@@ -51,6 +52,7 @@ var popQueryState = function (subQuery) {
     parser.yy.subQueries.push(subQuery);
     parser.yy.subQueries.push(subQuery);
   }
   }
 
 
+  parser.yy.lateralViews = parser.yy.lateralViewsStack.pop();
   parser.yy.latestTablePrimaries = parser.yy.primariesStack.pop();
   parser.yy.latestTablePrimaries = parser.yy.primariesStack.pop();
   parser.yy.locations = parser.yy.locationsStack.pop();
   parser.yy.locations = parser.yy.locationsStack.pop();
 };
 };
@@ -360,42 +362,43 @@ parser.identifyPartials = function (beforeCursor, afterCursor) {
   return {left: beforeMatch ? beforeMatch[0].length : 0, right: afterMatch ? afterMatch[0].length : 0};
   return {left: beforeMatch ? beforeMatch[0].length : 0, right: afterMatch ? afterMatch[0].length : 0};
 };
 };
 
 
-parser.expandLateralViews = function (tablePrimaries, originalIdentifierChain) {
+parser.expandLateralViews = function (lateralViews, originalIdentifierChain) {
   var identifierChain = originalIdentifierChain.concat(); // Clone in case it's re-used
   var identifierChain = originalIdentifierChain.concat(); // Clone in case it's re-used
   var firstIdentifier = identifierChain[0];
   var firstIdentifier = identifierChain[0];
-  tablePrimaries.forEach(function (tablePrimary) {
-    if (typeof tablePrimary.lateralViews !== 'undefined') {
-      tablePrimary.lateralViews.concat().reverse().forEach(function (lateralView) {
-        if (!lateralView.udtf.expression.columnReference) {
-          return;
-        }
-        if (firstIdentifier.name === lateralView.tableAlias && identifierChain.length > 1) {
-          identifierChain.shift();
-          firstIdentifier = identifierChain[0];
-        } else if (firstIdentifier.name === lateralView.tableAlias && identifierChain.length === 1 && typeof parser.yy.result.suggestColumns !== 'undefined') {
-          if (typeof parser.yy.result.suggestIdentifiers === 'undefined') {
-            parser.yy.result.suggestIdentifiers = [];
-          }
-          lateralView.columnAliases.forEach(function (columnAlias) {
-            parser.yy.result.suggestIdentifiers.push({name: columnAlias, type: 'alias'});
-          });
-          delete parser.yy.result.suggestColumns;
-          return identifierChain;
+  if (typeof lateralViews !== 'undefined') {
+    lateralViews.concat().reverse().forEach(function (lateralView) {
+      if (!lateralView.udtf.expression.columnReference) {
+        return;
+      }
+      if (firstIdentifier.name === lateralView.tableAlias && identifierChain.length > 1) {
+        identifierChain.shift();
+        firstIdentifier = identifierChain[0];
+        delete parser.yy.result.suggestKeywords;
+      } else if (firstIdentifier.name === lateralView.tableAlias && identifierChain.length === 1 && typeof parser.yy.result.suggestColumns !== 'undefined') {
+        if (typeof parser.yy.result.suggestIdentifiers === 'undefined') {
+          parser.yy.result.suggestIdentifiers = [];
         }
         }
-        if (lateralView.columnAliases.indexOf(firstIdentifier.name) !== -1) {
-          if (lateralView.columnAliases.length === 2 && lateralView.udtf.function.toLowerCase() === 'explode' && firstIdentifier.name === lateralView.columnAliases[0]) {
-            identifierChain[0] = {name: 'key'};
-          } else if (lateralView.columnAliases.length === 2 && lateralView.udtf.function.toLowerCase() === 'explode' && firstIdentifier.name === lateralView.columnAliases[1]) {
-            identifierChain[0] = {name: 'value'};
-          } else {
-            identifierChain[0] = {name: 'item'};
-          }
-          identifierChain = lateralView.udtf.expression.columnReference.concat(identifierChain);
-          firstIdentifier = identifierChain[0];
+        lateralView.columnAliases.forEach(function (columnAlias) {
+          parser.yy.result.suggestIdentifiers.push({name: columnAlias, type: 'alias'});
+        });
+        delete parser.yy.result.suggestColumns;
+        delete parser.yy.result.suggestKeywords;
+        return identifierChain;
+      }
+      if (lateralView.columnAliases.indexOf(firstIdentifier.name) !== -1) {
+        if (lateralView.columnAliases.length === 2 && lateralView.udtf.function.toLowerCase() === 'explode' && firstIdentifier.name === lateralView.columnAliases[0]) {
+          identifierChain[0] = {name: 'key'};
+        } else if (lateralView.columnAliases.length === 2 && lateralView.udtf.function.toLowerCase() === 'explode' && firstIdentifier.name === lateralView.columnAliases[1]) {
+          identifierChain[0] = {name: 'value'};
+        } else {
+          identifierChain[0] = {name: 'item'};
         }
         }
-      });
-    }
-  });
+        identifierChain = lateralView.udtf.expression.columnReference.concat(identifierChain);
+        delete parser.yy.result.suggestKeywords;
+        firstIdentifier = identifierChain[0];
+      }
+    });
+  }
   return identifierChain;
   return identifierChain;
 };
 };
 
 
@@ -447,7 +450,7 @@ var expandIdentifierChain = function (wrapper, anyOwner) {
   }
   }
   // Expand exploded views in the identifier chain
   // Expand exploded views in the identifier chain
   if (isHive() && identifierChain.length > 0) {
   if (isHive() && identifierChain.length > 0) {
-    identifierChain = parser.expandLateralViews(tablePrimaries, identifierChain);
+    identifierChain = parser.expandLateralViews(parser.yy.lateralViews, identifierChain);
     wrapper.identifierChain = identifierChain;
     wrapper.identifierChain = identifierChain;
   }
   }
 
 
@@ -540,20 +543,19 @@ var suggestTablePrimariesAsIdentifiers = function () {
 };
 };
 
 
 var suggestLateralViewAliasesAsIdentifiers = function () {
 var suggestLateralViewAliasesAsIdentifiers = function () {
+  if (typeof parser.yy.lateralViews === 'undefined' || parser.yy.lateralViews.length === 0) {
+    return;
+  }
   if (typeof parser.yy.result.suggestIdentifiers === 'undefined') {
   if (typeof parser.yy.result.suggestIdentifiers === 'undefined') {
     parser.yy.result.suggestIdentifiers = [];
     parser.yy.result.suggestIdentifiers = [];
   }
   }
-  parser.yy.latestTablePrimaries.forEach(function (tablePrimary) {
-    if (typeof tablePrimary.lateralViews !== 'undefined') {
-      tablePrimary.lateralViews.forEach(function (lateralView) {
-        if (typeof lateralView.tableAlias !== 'undefined') {
-          parser.yy.result.suggestIdentifiers.push({name: lateralView.tableAlias + '.', type: 'alias'});
-        }
-        lateralView.columnAliases.forEach(function (columnAlias) {
-          parser.yy.result.suggestIdentifiers.push({name: columnAlias, type: 'alias'});
-        });
-      });
+  parser.yy.lateralViews.forEach(function (lateralView) {
+    if (typeof lateralView.tableAlias !== 'undefined') {
+      parser.yy.result.suggestIdentifiers.push({name: lateralView.tableAlias + '.', type: 'alias'});
     }
     }
+    lateralView.columnAliases.forEach(function (columnAlias) {
+      parser.yy.result.suggestIdentifiers.push({name: columnAlias, type: 'alias'});
+    });
   });
   });
   if (parser.yy.result.suggestIdentifiers.length === 0) {
   if (parser.yy.result.suggestIdentifiers.length === 0) {
     delete parser.yy.result.suggestIdentifiers;
     delete parser.yy.result.suggestIdentifiers;

+ 10 - 2
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter2.js

@@ -56,11 +56,17 @@
     var self = this;
     var self = this;
     var parseResult = sqlParser.parseSql(beforeCursor, afterCursor, self.snippet.type(), sqlFunctions, false);
     var parseResult = sqlParser.parseSql(beforeCursor, afterCursor, self.snippet.type(), sqlFunctions, false);
 
 
+    if (typeof hueDebug !== 'undefined' && hueDebug.showParseResult) {
+      console.log(parseResult);
+    }
+
     var deferrals = [];
     var deferrals = [];
     var completions = [];
     var completions = [];
     var columnSuggestions = [];
     var columnSuggestions = [];
 
 
-    editor.showSpinner();
+    if (typeof editor !== 'undefined' && editor !== null) {
+      editor.showSpinner();
+    }
     if (parseResult.suggestKeywords) {
     if (parseResult.suggestKeywords) {
       parseResult.suggestKeywords.forEach(function (keyword) {
       parseResult.suggestKeywords.forEach(function (keyword) {
         completions.push({
         completions.push({
@@ -492,7 +498,9 @@
       currentScore--;
       currentScore--;
     });
     });
 
 
-    editor.hideSpinner();
+    if (typeof editor !== 'undefined' && editor !== null) {
+      editor.hideSpinner();
+    }
     callback(completions);
     callback(completions);
   };
   };
 
 

+ 106 - 159
desktop/core/src/desktop/static/desktop/spec/autocomplete/sqlSpec.js

@@ -401,219 +401,166 @@ define([
     });
     });
 
 
     describe('identifierChain expansion', function () {
     describe('identifierChain expansion', function () {
-      it('should expand 1', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testItem' ],
-            tableAlias: 'explodedTable',
-            udtf: {
-              expression: { columnReference: [{ name: 'testArray' }] },
-              function: 'explode'
-            }
-          }]
+      it('should expand 01', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testItem' ],
+          tableAlias: 'explodedTable',
+          udtf: {
+            expression: { columnReference: [{ name: 'testArray' }] },
+            function: 'explode'
+          }
         }];
         }];
 
 
-        var identifierChain = [{ name: 'explodedTable' }, { name: 'testItem' }];
-
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var identifierChain = [{ name: 'testItem' }];
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
       });
       });
 
 
-      it('should expand 2', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testMapKey', 'testMapValue' ],
-            tableAlias: 'explodedMap',
-            udtf: {
-              expression: { columnReference: [{ name: 'testMap' }] },
-              function: 'explode'
-            }
-          }]
+      it('should expand 02', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testMapKey', 'testMapValue' ],
+          tableAlias: 'explodedMap',
+          udtf: {
+            expression: { columnReference: [{ name: 'testMap' }] },
+            function: 'explode'
+          }
         }];
         }];
 
 
         var identifierChain = [{ name: 'explodedMap' }, { name: 'testMapValue' }];
         var identifierChain = [{ name: 'explodedMap' }, { name: 'testMapValue' }];
 
 
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testMap' }, { name: 'value' }]);
         expect(result).toEqual([{ name: 'testMap' }, { name: 'value' }]);
       });
       });
 
 
-      it('should expand 3', function () {
-        var tablePrimaries = [{ identifierChain: [{ name: 'testTable' }] }];
+      it('should expand 03', function () {
         var identifierChain = [{ name: 'testMap', keySet: true }];
         var identifierChain = [{ name: 'testMap', keySet: true }];
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews([], identifierChain);
         expect(result).toEqual([{ name: 'testMap', keySet: true }]);
         expect(result).toEqual([{ name: 'testMap', keySet: true }]);
       });
       });
 
 
-      it('should expand 4', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testItem' ],
-            tableAlias: 'explodedTable',
-            udtf: {
-              function: 'explode',
-              expression: { columnReference: [{ name: 'testArray' }] }
-            }
-          }]
+      it('should expand 04', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testItem' ],
+          tableAlias: 'explodedTable',
+          udtf: {
+            function: 'explode',
+            expression: { columnReference: [{ name: 'testArray' }] }
+          }
         }];
         }];
+
         var identifierChain = [{ name: 'testItem' }];
         var identifierChain = [{ name: 'testItem' }];
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
       });
       });
 
 
-      it('should expand 5', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testItemB' ],
-            tableAlias: 'explodedTableB',
-            udtf: {
-              function: 'explode',
-              expression: { columnReference: [{ name: 'testArrayB' }] }
-            }
-          }, {
-            columnAliases: [ 'testItemA' ],
-            tableAlias: 'explodedTableA',
-            udtf: {
-              function: 'explode',
-              expression: { columnReference: [{ name: 'testArrayA' }] }
-            }
-          }]
+      it('should expand 05', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testItemB' ],
+          tableAlias: 'explodedTableB',
+          udtf: {
+            function: 'explode',
+            expression: { columnReference: [{ name: 'testArrayB' }] }
+          }
+        }, {
+          columnAliases: [ 'testItemA' ],
+          tableAlias: 'explodedTableA',
+          udtf: {
+            function: 'explode',
+            expression: { columnReference: [{ name: 'testArrayA' }] }
+          }
         }];
         }];
+
         var identifierChain = [{ name: 'testItemA' }];
         var identifierChain = [{ name: 'testItemA' }];
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testArrayA' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'testArrayA' }, { name: 'item' }]);
       });
       });
 
 
-      it('should expand 6', function () {
-        var tablePrimaries = [{
-          alias: 'tt2',
-          identifierChain: [{ name: 'testTable2' }],
-          lateralViews: [{
-            columnAliases: [ 'testItemB' ],
-            tableAlias: 'explodedTableB',
-            udtf: {
-              function: 'explode',
-              expression: { columnReference: [{ name: 'tt2' }, { name: 'testArrayB' }] }
-            }
-          }, {
-            columnAliases: [ 'testItemA' ],
-            tableAlias: 'explodedTableA',
-            udtf: {
-              function: 'explode',
-              expression: { columnReference: [{ name: 'tt2' }, { name: 'testArrayA' }] }
-            }
-          }]
+      it('should expand 06', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testItemB' ],
+          tableAlias: 'explodedTableB',
+          udtf: {
+            function: 'explode',
+            expression: { columnReference: [{ name: 'tt2' }, { name: 'testArrayB' }] }
+          }
+        }, {
+          columnAliases: [ 'testItemA' ],
+          tableAlias: 'explodedTableA',
+          udtf: {
+            function: 'explode',
+            expression: { columnReference: [{ name: 'tt2' }, { name: 'testArrayA' }] }
+          }
         }];
         }];
         var identifierChain = [{ name: 'testItemB' }];
         var identifierChain = [{ name: 'testItemB' }];
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'tt2' }, { name: 'testArrayB' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'tt2' }, { name: 'testArrayB' }, { name: 'item' }]);
       });
       });
 
 
-      it('should expand 7', function () {
-        var tablePrimaries = [{
-          alias: 'tt',
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'ta1_exp' ],
-            tableAlias: 'ta1',
-            udtf: {
-              expression: { columnReference: [{ name: 'tt' }, { name: 'testArray1' }] },
-              function: 'explode'
-            }
-          }, {
-            columnAliases: [ 'ta2_exp' ],
-            tableAlias: 'ta2',
-            udtf: {
-              expression: { columnReference: [{ name: 'ta1_exp' },{ name: 'testArray2' }] },
-              function: 'explode'
-            }
-          }]
+      it('should expand 07', function () {
+        var lateralViews = [{
+          columnAliases: [ 'ta1_exp' ],
+          tableAlias: 'ta1',
+          udtf: {
+            expression: { columnReference: [{ name: 'tt' }, { name: 'testArray1' }] },
+            function: 'explode'
+          }
+        }, {
+          columnAliases: [ 'ta2_exp' ],
+          tableAlias: 'ta2',
+          udtf: {
+            expression: { columnReference: [{ name: 'ta1_exp' },{ name: 'testArray2' }] },
+            function: 'explode'
+          }
         }];
         }];
 
 
         var identifierChain = [{ name: 'ta2_exp' }];
         var identifierChain = [{ name: 'ta2_exp' }];
-
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'tt' }, { name: 'testArray1' }, { name: 'item' }, { name: 'testArray2' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'tt' }, { name: 'testArray1' }, { name: 'item' }, { name: 'testArray2' }, { name: 'item' }]);
       });
       });
 
 
-      it('should expand 8', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testIndex', 'testValue' ],
-            tableAlias: 'explodedTable',
-            udtf: {
-              expression: { columnReference: [{ name: 'testArray' }] },
-              function: 'posexplode'
-            }
-          }]
+      it('should expand 08', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testIndex', 'testValue' ],
+          tableAlias: 'explodedTable',
+          udtf: {
+            expression: { columnReference: [{ name: 'testArray' }] },
+            function: 'posexplode'
+          }
         }];
         }];
 
 
         var identifierChain = [{ name: 'testValue' }];
         var identifierChain = [{ name: 'testValue' }];
-
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
       });
       });
 
 
-      it('should expand 9', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testMapKey', 'testMapValue' ],
-            tableAlias: 'explodedTable',
-            udtf: {
-              expression: { columnReference: [{ name: 'testMap' }] },
-              function: 'explode'
-            }
-          }]
+      it('should expand 09', function () {
+        var lateralViews = [{
+          columnAliases: [ 'testMapKey', 'testMapValue' ],
+          tableAlias: 'explodedTable',
+          udtf: {
+            expression: { columnReference: [{ name: 'testMap' }] },
+            function: 'explode'
+          }
         }];
         }];
 
 
         var identifierChain = [{ name: 'testMapValue' }];
         var identifierChain = [{ name: 'testMapValue' }];
-
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testMap' }, { name: 'value' }]);
         expect(result).toEqual([{ name: 'testMap' }, { name: 'value' }]);
       });
       });
 
 
 
 
       it('should expand 10', function () {
       it('should expand 10', function () {
-        var tablePrimaries = [{
-          identifierChain: [{ name: 'testTable' }],
-          lateralViews: [{
-            columnAliases: [ 'testItem' ],
-            tableAlias: 'explodedTable',
-            udtf: {
-              expression: { columnReference: [{ name: 'testArray' }] },
-              function: 'explode'
-            }
-          }]
+        var lateralViews = [{
+          columnAliases: [ 'testItem' ],
+          tableAlias: 'explodedTable',
+          udtf: {
+            expression: { columnReference: [{ name: 'testArray' }] },
+            function: 'explode'
+          }
         }];
         }];
 
 
         var identifierChain = [{ name: 'testItem' }];
         var identifierChain = [{ name: 'testItem' }];
-
-        var tablePrimariesBefore = tablePrimaries.concat();
-        var result = sql.expandLateralViews(tablePrimaries, identifierChain);
-        expect(tablePrimariesBefore).toEqual(tablePrimaries);
+        var result = sql.expandLateralViews(lateralViews, identifierChain);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
         expect(result).toEqual([{ name: 'testArray' }, { name: 'item' }]);
       });
       });
 
 

+ 44 - 40
desktop/core/src/desktop/static/desktop/spec/autocomplete/sqlSpecSelect.js

@@ -2677,28 +2677,15 @@ define([
         });
         });
       });
       });
 
 
-      it('should suggest keywords for "SELECT bar FROM foo LATERAL VIEW OUTER explode(bar) |"', function () {
-        assertAutoComplete({
-          beforeCursor: 'SELECT bar FROM foo LATERAL VIEW OUTER explode(bar) ',
-          afterCursor: '',
-          dialect: 'hive',
-          hasLocations: true,
-          expectedResult: {
-            lowerCase: false,
-            suggestKeywords: ['AS']
-          }
-        });
-      });
-
       it('should suggest keywords for "SELECT bar FROM foo LATERAL VIEW explode(bar) b |"', function () {
       it('should suggest keywords for "SELECT bar FROM foo LATERAL VIEW explode(bar) b |"', function () {
         assertAutoComplete({
         assertAutoComplete({
           beforeCursor: 'SELECT bar FROM foo LATERAL VIEW explode(bar) b ',
           beforeCursor: 'SELECT bar FROM foo LATERAL VIEW explode(bar) b ',
           afterCursor: '',
           afterCursor: '',
           dialect: 'hive',
           dialect: 'hive',
           hasLocations: true,
           hasLocations: true,
+          containsKeywords: ['AS', 'WHERE'],
           expectedResult: {
           expectedResult: {
-            lowerCase: false,
-            suggestKeywords: ['AS']
+            lowerCase: false
           }
           }
         });
         });
       });
       });
@@ -2902,10 +2889,10 @@ define([
           });
           });
         });
         });
 
 
-        it('should suggest aliases for "SELECT |  FROM testTable LATERAL VIEW explode(testMap) explodedTable AS (testKey, testValue)"', function () {
+        it('should suggest aliases for "SELECT |  FROM testTable LATERAL VIEW explode(testMap) explodedTable AS testKey, testValue"', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT ',
             beforeCursor: 'SELECT ',
-            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedTable AS (testKey, testValue)',
+            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedTable AS testKey, testValue',
             dialect: 'hive',
             dialect: 'hive',
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
@@ -2928,7 +2915,6 @@ define([
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['*'], // TODO: Verify that this is true
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray' }, { name: 'item' }] }] }
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray' }, { name: 'item' }] }] }
             }
             }
           });
           });
@@ -2944,7 +2930,6 @@ define([
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['*'], // TODO: Verify that this is true
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArrayA' }, { name: 'item' }] }] }
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArrayA' }, { name: 'item' }] }] }
             }
             }
           });
           });
@@ -2959,7 +2944,6 @@ define([
             dialect: 'hive',
             dialect: 'hive',
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['*'], // TODO: Verify that this is true
               suggestColumns: { tables: [{ table: 'testTable2', identifierChain: [{ name: 'testArrayB' }, { name: 'item' }] }] },
               suggestColumns: { tables: [{ table: 'testTable2', identifierChain: [{ name: 'testArrayB' }, { name: 'item' }] }] },
               locations: [
               locations: [
                 { type: 'column', location: { first_line: 2, last_line: 2, first_column: 2, last_column: 11 }, identifierChain: [{ name: 'testArrayA'}, {name: 'item'}], table: 'testTable2'},
                 { type: 'column', location: { first_line: 2, last_line: 2, first_column: 2, last_column: 11 }, identifierChain: [{ name: 'testArrayA'}, {name: 'item'}], table: 'testTable2'},
@@ -2984,7 +2968,6 @@ define([
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['*'], // TODO: Verify that this is true
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray1' }, { name: 'item' }, { name: 'testArray2' }, { name: 'item' }] }] }
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray1' }, { name: 'item' }, { name: 'testArray2' }, { name: 'item' }] }] }
             }
             }
           });
           });
@@ -2998,72 +2981,93 @@ define([
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray' }, { name: 'item' }] }] },
-              suggestKeywords: ['*']
+              suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray' }, { name: 'item' }] }] }
             }
             }
           });
           });
         });
         });
 
 
-        it('should suggest identifiers for "SELECT testValue.| FROM testTable LATERAL VIEW posexplode(testArray) explodedTable AS (testIndex, testValue)"', function () {
+        it('should suggest identifiers for "SELECT testValue.| FROM testTable LATERAL VIEW posexplode(testArray) explodedTable AS testIndex, testValue"', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT testValue.',
             beforeCursor: 'SELECT testValue.',
-            afterCursor: ' FROM testTable LATERAL VIEW posexplode(testArray) explodedTable AS (testIndex, testValue)',
+            afterCursor: ' FROM testTable LATERAL VIEW posexplode(testArray) explodedTable AS testIndex, testValue',
             dialect: 'hive',
             dialect: 'hive',
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestKeywords: ['*'], // TODO: Verify that this is true
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray' }, { name: 'item' }] }] }
               suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testArray' }, { name: 'item' }] }] }
             }
             }
           });
           });
         });
         });
 
 
-        it('should suggest columns for "SELECT testMapValue.| FROM testTable LATERAL VIEW explode(testMap) AS (testMapKey, testMapValue)"', function () {
+        it('should suggest columns for "SELECT boo.| FROM customers LATERAL VIEW explode(baa) boo;"', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT boo.',
+            afterCursor: ' FROM customers LATERAL VIEW explode(baa) boo;',
+            dialect: 'hive',
+            hasLocations: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestIdentifiers: [{ name: 'key', type: 'alias' }, { name: 'value', type: 'alias' }]
+            }
+          });
+        });
+
+        it('should suggest columns for "SELECT boo.| FROM customers LATERAL VIEW posexplode(baa) boo;"', function () {
+          assertAutoComplete({
+            beforeCursor: 'SELECT boo.',
+            afterCursor: ' FROM customers LATERAL VIEW posexplode(baa) boo;',
+            dialect: 'hive',
+            hasLocations: true,
+            expectedResult: {
+              lowerCase: false,
+              suggestIdentifiers: [{ name: 'pos', type: 'alias' }, { name: 'val', type: 'alias' }]
+            }
+          });
+        });
+
+        it('should suggest columns for "SELECT testMapValue.| FROM testTable LATERAL VIEW explode(testMap) bla AS testMapKey, testMapValue"', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT testMapValue.',
             beforeCursor: 'SELECT testMapValue.',
-            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) AS (testMapKey, testMapValue)',
+            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) AS testMapKey, testMapValue',
             dialect: 'hive',
             dialect: 'hive',
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testMap' }, { name: 'value' }] }] },
-              suggestKeywords: ['*'] // TODO: Verify that this is true
+              suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testMap' }, { name: 'value' }] }] }
             }
             }
           });
           });
         });
         });
 
 
-        it('should suggest columns for "SELECT explodedMap.testMapValue.| FROM testTable LATERAL VIEW explode(testMap) explodedMap AS (testMapKey, testMapValue)"', function () {
+        it('should suggest columns for "SELECT explodedMap.testMapValue.| FROM testTable LATERAL VIEW explode(testMap) explodedMap AS testMapKey, testMapValue"', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT explodedMap.testMapValue.',
             beforeCursor: 'SELECT explodedMap.testMapValue.',
-            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedMap AS (testMapKey, testMapValue)',
+            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedMap AS testMapKey, testMapValue',
             dialect: 'hive',
             dialect: 'hive',
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testMap' }, { name: 'value' }] }] },
-              suggestKeywords: ['*'] // TODO: Verify that this is true
+              suggestColumns: { tables: [{ table: 'testTable', identifierChain: [{ name: 'testMap' }, { name: 'value' }] }] }
             }
             }
           });
           });
         });
         });
 
 
-        it('should suggest identifier for "SELECT explodedMap.| FROM testTable LATERAL VIEW explode(testMap) explodedMap AS (testMapKey, testMapValue)"', function () {
+        it('should suggest identifier for "SELECT explodedMap.| FROM testTable LATERAL VIEW explode(testMap) explodedMap AS testMapKey, testMapValue"', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT explodedMap.',
             beforeCursor: 'SELECT explodedMap.',
-            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedMap AS (testMapKey, testMapValue)',
+            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedMap AS testMapKey, testMapValue',
             dialect: 'hive',
             dialect: 'hive',
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {
               lowerCase: false,
               lowerCase: false,
-              suggestIdentifiers: [{ name: 'testMapKey', type: 'alias' }, { name: 'testMapValue', type: 'alias' }],
-              suggestKeywords: ['*'] // TODO: Check if really true
+              suggestIdentifiers: [{ name: 'testMapKey', type: 'alias' }, { name: 'testMapValue', type: 'alias' }]
             }
             }
           });
           });
         });
         });
 
 
-        it('should suggest identifiers for "SELECT | FROM testTable LATERAL VIEW explode(testMap) explodedMap AS (testMapKey, testMapValue)"', function () {
+        it('should suggest identifiers for "SELECT | FROM testTable LATERAL VIEW explode(testMap) explodedMap AS testMapKey, testMapValue"', function () {
           assertAutoComplete({
           assertAutoComplete({
             beforeCursor: 'SELECT ',
             beforeCursor: 'SELECT ',
-            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedMap AS (testMapKey, testMapValue)',
+            afterCursor: ' FROM testTable LATERAL VIEW explode(testMap) explodedMap AS testMapKey, testMapValue',
             dialect: 'hive',
             dialect: 'hive',
             hasLocations: true,
             hasLocations: true,
             expectedResult: {
             expectedResult: {

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