|
@@ -0,0 +1,383 @@
|
|
|
|
|
+// Licensed to Cloudera, Inc. under one
|
|
|
|
|
+// or more contributor license agreements. See the NOTICE file
|
|
|
|
|
+// distributed with this work for additional information
|
|
|
|
|
+// regarding copyright ownership. Cloudera, Inc. licenses this file
|
|
|
|
|
+// to you under the Apache License, Version 2.0 (the
|
|
|
|
|
+// "License"); you may not use this file except in compliance
|
|
|
|
|
+// with the License. You may obtain a copy of the License at
|
|
|
|
|
+//
|
|
|
|
|
+// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
+//
|
|
|
|
|
+// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
+// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
+// See the License for the specific language governing permissions and
|
|
|
|
|
+// limitations under the License.
|
|
|
|
|
+
|
|
|
|
|
+QuerySpecification
|
|
|
|
|
+ : SelectStatement OptionalUnions -> $1
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+QuerySpecification_EDIT
|
|
|
|
|
+ : SelectStatement_EDIT OptionalUnions
|
|
|
|
|
+ | SelectStatement OptionalUnions_EDIT
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+SelectStatement
|
|
|
|
|
+ : 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ $$ = { selectList: $4 };
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList TableExpression
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ $$ = { selectList: $4, tableExpression: $5 }
|
|
|
|
|
+ }
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+SelectStatement_EDIT
|
|
|
|
|
+ : 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList_EDIT
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ if ($4.cursorAtStart) {
|
|
|
|
|
+ var keywords = parser.getSelectListKeywords();
|
|
|
|
|
+ if (!$3 && !$2) {
|
|
|
|
|
+ keywords.push({ value: 'ALL', weight: 2 });
|
|
|
|
|
+ keywords.push({ value: 'DISTINCT', weight: 2 });
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$3) {
|
|
|
|
|
+ keywords.push({ value: 'STRAIGHT_JOIN', weight: 1 });
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ parser.checkForSelectListKeywords($4);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($4.suggestFunctions) {
|
|
|
|
|
+ parser.suggestFunctions();
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($4.suggestColumns) {
|
|
|
|
|
+ parser.suggestColumns({ identifierChain: [], source: 'select' });
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($4.suggestTables) {
|
|
|
|
|
+ parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($4.suggestDatabases) {
|
|
|
|
|
+ parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($4.suggestAggregateFunctions && (!$2 || $2 === 'ALL')) {
|
|
|
|
|
+ parser.suggestAggregateFunctions();
|
|
|
|
|
+ parser.suggestAnalyticFunctions();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin 'CURSOR'
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4, true);
|
|
|
|
|
+ var keywords = parser.getSelectListKeywords();
|
|
|
|
|
+ if (!$2 || $2 === 'ALL') {
|
|
|
|
|
+ parser.suggestAggregateFunctions();
|
|
|
|
|
+ parser.suggestAnalyticFunctions();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$3 && !$2) {
|
|
|
|
|
+ keywords.push({ value: 'ALL', weight: 2 });
|
|
|
|
|
+ keywords.push({ value: 'DISTINCT', weight: 2 });
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$3) {
|
|
|
|
|
+ keywords.push({ value: 'STRAIGHT_JOIN', weight: 1 });
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ parser.suggestFunctions();
|
|
|
|
|
+ parser.suggestColumns({ identifierChain: [], source: 'select' });
|
|
|
|
|
+ parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
|
|
|
|
|
+ parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList TableExpression_EDIT
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList_EDIT TableExpression
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ parser.selectListNoTableSuggest($4, $2);
|
|
|
|
|
+ if (parser.yy.result.suggestColumns) {
|
|
|
|
|
+ parser.yy.result.suggestColumns.source = 'select';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin 'CURSOR' TableExpression
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4, true);
|
|
|
|
|
+ var keywords = parser.getSelectListKeywords();
|
|
|
|
|
+ if (!$2 || $2 === 'ALL') {
|
|
|
|
|
+ parser.suggestAggregateFunctions();
|
|
|
|
|
+ parser.suggestAnalyticFunctions();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$3 && !$2) {
|
|
|
|
|
+ keywords.push({ value: 'ALL', weight: 2 });
|
|
|
|
|
+ keywords.push({ value: 'DISTINCT', weight: 2 });
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!$3) {
|
|
|
|
|
+ keywords.push({ value: 'STRAIGHT_JOIN', weight: 1 });
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ parser.suggestFunctions();
|
|
|
|
|
+ parser.suggestColumns({ identifierChain: [], source: 'select' });
|
|
|
|
|
+ parser.suggestTables({ prependQuestionMark: true, prependFrom: true });
|
|
|
|
|
+ parser.suggestDatabases({ prependQuestionMark: true, prependFrom: true, appendDot: true });
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList 'CURSOR' TableExpression
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ parser.checkForSelectListKeywords($4);
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList 'CURSOR' ',' TableExpression
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ parser.checkForSelectListKeywords($4);
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'SELECT' OptionalAllOrDistinct OptionalStraightJoin SelectList 'CURSOR'
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('selectList', parser.firstDefined($3, @3, $2, @2, $1, @1), @4);
|
|
|
|
|
+ parser.checkForSelectListKeywords($4);
|
|
|
|
|
+ var keywords = ['FROM'];
|
|
|
|
|
+ if (parser.yy.result.suggestKeywords) {
|
|
|
|
|
+ keywords = parser.yy.result.suggestKeywords.concat(keywords);
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ parser.suggestTables({ prependFrom: true });
|
|
|
|
|
+ parser.suggestDatabases({ prependFrom: true, appendDot: true });
|
|
|
|
|
+ }
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+OptionalAllOrDistinct
|
|
|
|
|
+ :
|
|
|
|
|
+ | 'ALL'
|
|
|
|
|
+ | 'DISTINCT'
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+TableExpression
|
|
|
|
|
+ : FromClause OptionalSelectConditions
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('whereClause', @1, $2.whereClauseLocation);
|
|
|
|
|
+ parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
|
|
|
|
|
+ }
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+TableExpression_EDIT
|
|
|
|
|
+ : FromClause_EDIT OptionalSelectConditions
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addClauseLocation('whereClause', @1, $2.whereClauseLocation);
|
|
|
|
|
+ parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
|
|
|
|
|
+ }
|
|
|
|
|
+ | FromClause 'CURSOR' OptionalSelectConditions OptionalJoins
|
|
|
|
|
+ {
|
|
|
|
|
+ var keywords = [];
|
|
|
|
|
+
|
|
|
|
|
+ parser.addClauseLocation('whereClause', @1, $3.whereClauseLocation);
|
|
|
|
|
+ parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
|
|
|
|
|
+
|
|
|
|
|
+ if ($1) {
|
|
|
|
|
+ if (typeof $1.tableReferenceList.hasJoinCondition !== 'undefined' && !$1.tableReferenceList.hasJoinCondition) {
|
|
|
|
|
+ keywords.push({ value: 'ON', weight: 3 });
|
|
|
|
|
+ keywords.push({ value: 'USING', weight: 3 });
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($1.suggestKeywords) {
|
|
|
|
|
+ keywords = parser.createWeightedKeywords($1.suggestKeywords, 3);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($1.tableReferenceList.suggestJoinConditions) {
|
|
|
|
|
+ parser.suggestJoinConditions($1.tableReferenceList.suggestJoinConditions);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($1.tableReferenceList.suggestJoins) {
|
|
|
|
|
+ parser.suggestJoins($1.tableReferenceList.suggestJoins);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($1.tableReferenceList.suggestKeywords) {
|
|
|
|
|
+ keywords = keywords.concat(parser.createWeightedKeywords($1.tableReferenceList.suggestKeywords, 3));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Lower the weights for 'TABLESAMPLE' and 'LATERAL VIEW'
|
|
|
|
|
+ keywords.forEach(function (keyword) {
|
|
|
|
|
+ if (keyword.value === 'TABLESAMPLE' || keyword.value === 'LATERAL VIEW') {
|
|
|
|
|
+ keyword.weight = 1.1;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if ($1.tableReferenceList.types) {
|
|
|
|
|
+ var veKeywords = parser.getValueExpressionKeywords($1.tableReferenceList);
|
|
|
|
|
+ keywords = keywords.concat(veKeywords.suggestKeywords);
|
|
|
|
|
+ if (veKeywords.suggestColRefKeywords) {
|
|
|
|
|
+ parser.suggestColRefKeywords(veKeywords.suggestColRefKeywords);
|
|
|
|
|
+ parser.addColRefIfExists($1.tableReferenceList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($3.empty && $4 && $4.joinType.toUpperCase() === 'JOIN') {
|
|
|
|
|
+ keywords = keywords.concat(['FULL', 'FULL OUTER', 'LEFT', 'LEFT OUTER', 'RIGHT', 'RIGHT OUTER']);
|
|
|
|
|
+ keywords = keywords.concat(['ANTI', 'CROSS', 'INNER', 'LEFT ANTI', 'LEFT INNER', 'LEFT SEMI', 'OUTER', 'RIGHT ANTI', 'RIGHT INNER', 'RIGHT SEMI', 'SEMI']);
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($3.suggestKeywords) {
|
|
|
|
|
+ keywords = keywords.concat(parser.createWeightedKeywords($3.suggestKeywords, 2));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($3.suggestFilters) {
|
|
|
|
|
+ parser.suggestFilters($3.suggestFilters);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($3.suggestGroupBys) {
|
|
|
|
|
+ parser.suggestGroupBys($3.suggestGroupBys);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($3.suggestOrderBys) {
|
|
|
|
|
+ parser.suggestOrderBys($3.suggestOrderBys);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($3.empty) {
|
|
|
|
|
+ keywords.push({ value: 'UNION', weight: 2.11 });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ keywords = keywords.concat([
|
|
|
|
|
+ { value: 'ANTI JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'FULL JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'FULL OUTER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'INNER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'LEFT ANTI JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'LEFT INNER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'LEFT JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'LEFT OUTER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'LEFT SEMI JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'OUTER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'RIGHT ANTI JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'RIGHT INNER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'RIGHT JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'RIGHT OUTER JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'RIGHT SEMI JOIN', weight: 1 },
|
|
|
|
|
+ { value: 'SEMI JOIN', weight: 1 }
|
|
|
|
|
+ ]);
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ }
|
|
|
|
|
+ | FromClause OptionalSelectConditions_EDIT OptionalJoins
|
|
|
|
|
+ {
|
|
|
|
|
+ // A couple of things are going on here:
|
|
|
|
|
+ // - If there are no SelectConditions (WHERE, GROUP BY, etc.) we should suggest complete join options
|
|
|
|
|
+ // - If there's an OptionalJoin at the end, i.e. 'SELECT * FROM foo | JOIN ...' we should suggest
|
|
|
|
|
+ // different join types
|
|
|
|
|
+ // - The FromClause could end with a valueExpression, in which case we should suggest keywords like '='
|
|
|
|
|
+ // or 'AND' based on type
|
|
|
|
|
+
|
|
|
|
|
+ if (!$2) {
|
|
|
|
|
+ parser.addClauseLocation('whereClause', @1);
|
|
|
|
|
+ parser.addClauseLocation('limitClause', @1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.addClauseLocation('whereClause', @1, $2.whereClauseLocation);
|
|
|
|
|
+ parser.addClauseLocation('limitClause', $2.limitClausePreceding || @1, $2.limitClauseLocation);
|
|
|
|
|
+ var keywords = [];
|
|
|
|
|
+
|
|
|
|
|
+ if ($2.suggestColRefKeywords) {
|
|
|
|
|
+ parser.suggestColRefKeywords($2.suggestColRefKeywords);
|
|
|
|
|
+ parser.addColRefIfExists($2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($2.suggestKeywords && $2.suggestKeywords.length) {
|
|
|
|
|
+ keywords = keywords.concat(parser.createWeightedKeywords($2.suggestKeywords, 2));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($2.cursorAtEnd) {
|
|
|
|
|
+ keywords.push({ value: 'UNION', weight: 2.11 });
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.suggestKeywords(keywords);
|
|
|
|
|
+ }
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+SelectList
|
|
|
|
|
+ : SelectSpecification -> [ $1 ]
|
|
|
|
|
+ | SelectList ',' SelectSpecification
|
|
|
|
|
+ {
|
|
|
|
|
+ $1.push($3);
|
|
|
|
|
+ }
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+SelectList_EDIT
|
|
|
|
|
+ : SelectSpecification_EDIT
|
|
|
|
|
+ | 'CURSOR' SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ $$ = { cursorAtStart : true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ | 'CURSOR' ',' SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ $$ = { cursorAtStart : true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectSpecification_EDIT ',' SelectList
|
|
|
|
|
+ | SelectList 'CURSOR' SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.checkForSelectListKeywords($1);
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectList 'CURSOR' ',' SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.checkForSelectListKeywords($1);
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectList ',' AnyCursor
|
|
|
|
|
+ {
|
|
|
|
|
+ $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestTables: true, suggestDatabases: true, suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectList ',' SelectSpecification_EDIT -> $3
|
|
|
|
|
+ | SelectList ',' AnyCursor SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true, };
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectList ',' AnyCursor ','
|
|
|
|
|
+ {
|
|
|
|
|
+ $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true, };
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectList ',' SelectSpecification_EDIT ',' -> $3
|
|
|
|
|
+ | SelectList ',' AnyCursor ',' SelectList
|
|
|
|
|
+ {
|
|
|
|
|
+ $$ = { suggestKeywords: parser.getSelectListKeywords(), suggestFunctions: true, suggestColumns: true, suggestAggregateFunctions: true, };
|
|
|
|
|
+ }
|
|
|
|
|
+ | SelectList ',' SelectSpecification_EDIT ',' SelectList -> $3
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+SelectSpecification
|
|
|
|
|
+ : ValueExpression OptionalCorrelationName
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($2) {
|
|
|
|
|
+ parser.addColumnAliasLocation($2.location, $2.alias, @1);
|
|
|
|
|
+ $$ = { valueExpression: $1, alias: $2.alias };
|
|
|
|
|
+ if (!parser.yy.selectListAliases) {
|
|
|
|
|
+ parser.yy.selectListAliases = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ parser.yy.selectListAliases.push($1.function && $1.types && $1.types.length && $1.types[0] === 'UDFREF' ? { name: $2.alias, udfRef: $1.function, types: $1.types } : { name: $2.alias, types: $1.types || ['T'] });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $$ = { valueExpression: $1 }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ | '*'
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.addAsteriskLocation(@1, [{ asterisk: true }]);
|
|
|
|
|
+ $$ = { asterisk: true }
|
|
|
|
|
+ }
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+SelectSpecification_EDIT
|
|
|
|
|
+ : ValueExpression_EDIT OptionalCorrelationName
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($2) {
|
|
|
|
|
+ parser.addColumnAliasLocation($2.location, $2.alias, @1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ | AnyCursor 'AS' RegularOrBacktickedIdentifier
|
|
|
|
|
+ {
|
|
|
|
|
+ parser.suggestFunctions();
|
|
|
|
|
+ parser.suggestColumns();
|
|
|
|
|
+ parser.addColumnAliasLocation(@3, $3, @1);
|
|
|
|
|
+ $$ = { suggestAggregateFunctions: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ | ValueExpression OptionalCorrelationName_EDIT -> $2
|
|
|
|
|
+ ;
|
|
|
|
|
+
|
|
|
|
|
+OptionalStraightJoin
|
|
|
|
|
+ :
|
|
|
|
|
+ | 'STRAIGHT_JOIN'
|
|
|
|
|
+ ;
|