2018-08-16 18:02:51 +08:00
// 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.
var SqlParseSupport = ( function ( ) {
// endsWith polyfill from hue_utils.js, needed as workers live in their own js environment
if ( ! String . prototype . endsWith ) {
String . prototype . endsWith = function ( searchString , position ) {
var subjectString = this . toString ( ) ;
if ( typeof position !== 'number' || ! isFinite ( position ) || Math . floor ( position ) !== position || position > subjectString . length ) {
position = subjectString . length ;
}
position -= searchString . length ;
var lastIndex = subjectString . lastIndexOf ( searchString , position ) ;
return lastIndex !== - 1 && lastIndex === position ;
} ;
}
/ * *
* Calculates the Optimal String Alignment distance between two strings . Returns 0 when the strings are equal and the
* distance when not , distances is less than or equal to the length of the longest string .
*
* @ param strA
* @ param strB
* @ param [ ignoreCase ]
* @ returns { number } The similarity
* /
var stringDistance = function ( strA , strB , ignoreCase ) {
if ( ignoreCase ) {
strA = strA . toLowerCase ( ) ;
strB = strB . toLowerCase ( ) ;
}
// TODO: Consider other algorithms for performance
var strALength = strA . length ;
var strBLength = strB . length ;
if ( strALength === 0 ) {
return strBLength ;
}
if ( strBLength === 0 ) {
return strALength ;
}
var distances = new Array ( strALength ) ;
var cost , deletion , insertion , substitution , transposition ;
for ( var i = 0 ; i <= strALength ; i ++ ) {
distances [ i ] = new Array ( strBLength ) ;
distances [ i ] [ 0 ] = i ;
for ( var j = 1 ; j <= strBLength ; j ++ ) {
if ( ! i ) {
distances [ 0 ] [ j ] = j ;
} else {
cost = strA [ i - 1 ] === strB [ j - 1 ] ? 0 : 1 ;
deletion = distances [ i - 1 ] [ j ] + 1 ;
insertion = distances [ i ] [ j - 1 ] + 1 ;
substitution = distances [ i - 1 ] [ j - 1 ] + cost ;
if ( deletion <= insertion && deletion <= substitution ) {
distances [ i ] [ j ] = deletion ;
} else if ( insertion <= deletion && insertion <= substitution ) {
distances [ i ] [ j ] = insertion ;
} else {
distances [ i ] [ j ] = substitution ;
}
if ( i > 1 && j > 1 && strA [ i ] === strB [ j - 1 ] && strA [ i - 1 ] === strB [ j ] ) {
transposition = distances [ i - 2 ] [ j - 2 ] + cost ;
if ( transposition < distances [ i ] [ j ] ) {
distances [ i ] [ j ] = transposition ;
}
}
}
}
}
return distances [ strALength ] [ strBLength ] ;
} ;
var equalIgnoreCase = function ( a , b ) {
return a && b && a . toLowerCase ( ) === b . toLowerCase ( ) ;
} ;
var initSqlParser = function ( parser ) {
var SIMPLE _TABLE _REF _SUGGESTIONS = [ 'suggestJoinConditions' , 'suggestAggregateFunctions' , 'suggestFilters' , 'suggestGroupBys' , 'suggestOrderBys' ] ;
parser . prepareNewStatement = function ( ) {
linkTablePrimaries ( ) ;
parser . commitLocations ( ) ;
delete parser . yy . lateralViews ;
delete parser . yy . latestCommonTableExpressions ;
delete parser . yy . correlatedSubQuery ;
parser . yy . subQueries = [ ] ;
parser . yy . selectListAliases = [ ] ;
parser . yy . latestTablePrimaries = [ ] ;
prioritizeSuggestions ( ) ;
} ;
parser . yy . parseError = function ( message , error ) {
parser . yy . errors . push ( error ) ;
return message ;
} ;
parser . addCommonTableExpressions = function ( identifiers ) {
parser . yy . result . commonTableExpressions = identifiers ;
parser . yy . latestCommonTableExpressions = identifiers ;
} ;
parser . isInSubquery = function ( ) {
return ! ! parser . yy . primariesStack . length
} ;
parser . pushQueryState = function ( ) {
parser . yy . resultStack . push ( parser . yy . result ) ;
parser . yy . locationsStack . push ( parser . yy . locations ) ;
parser . yy . lateralViewsStack . push ( parser . yy . lateralViews ) ;
parser . yy . selectListAliasesStack . push ( parser . yy . selectListAliases ) ;
parser . yy . primariesStack . push ( parser . yy . latestTablePrimaries ) ;
parser . yy . subQueriesStack . push ( parser . yy . subQueries ) ;
parser . yy . result = { } ;
parser . yy . locations = [ ] ;
parser . yy . selectListAliases = [ ] ; // Not allowed in correlated sub-queries
parser . yy . lateralViews = [ ] ; // Not allowed in correlated sub-queries
if ( parser . yy . correlatedSubQuery ) {
parser . yy . latestTablePrimaries = parser . yy . latestTablePrimaries . concat ( ) ;
parser . yy . subQueries = parser . yy . subQueries . concat ( ) ;
} else {
parser . yy . latestTablePrimaries = [ ] ;
parser . yy . subQueries = [ ] ;
}
} ;
parser . popQueryState = function ( subQuery ) {
linkTablePrimaries ( ) ;
parser . commitLocations ( ) ;
if ( Object . keys ( parser . yy . result ) . length === 0 ) {
parser . yy . result = parser . yy . resultStack . pop ( ) ;
} else {
parser . yy . resultStack . pop ( ) ;
}
var oldSubQueries = parser . yy . subQueries ;
parser . yy . subQueries = parser . yy . subQueriesStack . pop ( ) ;
if ( subQuery ) {
if ( oldSubQueries . length > 0 ) {
subQuery . subQueries = oldSubQueries ;
}
parser . yy . subQueries . push ( subQuery ) ;
}
parser . yy . lateralViews = parser . yy . lateralViewsStack . pop ( ) ;
parser . yy . latestTablePrimaries = parser . yy . primariesStack . pop ( ) ;
parser . yy . locations = parser . yy . locationsStack . pop ( ) ;
parser . yy . selectListAliases = parser . yy . selectListAliasesStack . pop ( ) ;
} ;
parser . suggestSelectListAliases = function ( ) {
if ( parser . yy . selectListAliases && parser . yy . selectListAliases . length > 0 && parser . yy . result . suggestColumns
&& ( typeof parser . yy . result . suggestColumns . identifierChain === 'undefined' || parser . yy . result . suggestColumns . identifierChain . length === 0 ) ) {
parser . yy . result . suggestColumnAliases = parser . yy . selectListAliases ;
}
} ;
parser . isHive = function ( ) {
return parser . yy . activeDialect === 'hive' ;
} ;
parser . isImpala = function ( ) {
return parser . yy . activeDialect === 'impala' ;
} ;
parser . mergeSuggestKeywords = function ( ) {
var result = [ ] ;
Array . prototype . slice . call ( arguments ) . forEach ( function ( suggestion ) {
if ( typeof suggestion !== 'undefined' && typeof suggestion . suggestKeywords !== 'undefined' ) {
result = result . concat ( suggestion . suggestKeywords ) ;
}
} ) ;
if ( result . length > 0 ) {
return { suggestKeywords : result } ;
}
return { } ;
} ;
parser . suggestValueExpressionKeywords = function ( valueExpression , extras ) {
var expressionKeywords = parser . getValueExpressionKeywords ( valueExpression , extras ) ;
parser . suggestKeywords ( expressionKeywords . suggestKeywords ) ;
if ( expressionKeywords . suggestColRefKeywords ) {
parser . suggestColRefKeywords ( expressionKeywords . suggestColRefKeywords ) ;
}
if ( valueExpression . lastType ) {
parser . addColRefIfExists ( valueExpression . lastType ) ;
} else {
parser . addColRefIfExists ( valueExpression ) ;
}
} ;
parser . getSelectListKeywords = function ( excludeAsterisk ) {
var keywords = [ { value : 'CASE' , weight : 450 } , 'FALSE' , 'TRUE' , 'NULL' ] ;
if ( ! excludeAsterisk ) {
keywords . push ( { value : '*' , weight : 10000 } ) ;
}
if ( parser . isHive ( ) ) {
keywords = keywords . concat ( [ 'EXISTS' , 'NOT' ] ) ;
}
return keywords ;
} ;
parser . getValueExpressionKeywords = function ( valueExpression , extras ) {
var types = valueExpression . lastType ? valueExpression . lastType . types : valueExpression . types ;
// We could have valueExpression.columnReference to suggest based on column type
var keywords = [ '<' , '<=' , '<=>' , '<>' , '=' , '>' , '>=' , 'BETWEEN' , 'IN' , 'IS NOT NULL' , 'IS NULL' , 'IS NOT TRUE' , 'IS TRUE' , 'IS NOT FALSE' , 'IS FALSE' , 'NOT BETWEEN' , 'NOT IN' ] ;
if ( parser . isImpala ( ) ) {
keywords = keywords . concat ( [ 'IS DISTINCT FROM' , 'IS NOT DISTINCT FROM' , 'IS NOT UNKNOWN' , 'IS UNKNOWN' ] ) ;
}
if ( extras ) {
keywords = keywords . concat ( extras ) ;
}
if ( valueExpression . suggestKeywords ) {
keywords = keywords . concat ( valueExpression . suggestKeywords ) ;
}
if ( types . length === 1 && types [ 0 ] === 'COLREF' ) {
return {
suggestKeywords : keywords ,
suggestColRefKeywords : {
BOOLEAN : [ 'AND' , 'OR' ] ,
NUMBER : [ '+' , '-' , '*' , '/' , '%' , 'DIV' ] ,
STRING : parser . isImpala ( ) ? [ 'ILIKE' , 'IREGEXP' , 'LIKE' , 'NOT LIKE' , 'REGEXP' , 'RLIKE' ] : [ 'LIKE' , 'NOT LIKE' , 'REGEXP' , 'RLIKE' ]
}
}
}
if ( typeof SqlFunctions === 'undefined' || SqlFunctions . matchesType ( parser . yy . activeDialect , [ 'BOOLEAN' ] , types ) ) {
keywords = keywords . concat ( [ 'AND' , 'OR' ] ) ;
}
if ( typeof SqlFunctions === 'undefined' || SqlFunctions . matchesType ( parser . yy . activeDialect , [ 'NUMBER' ] , types ) ) {
keywords = keywords . concat ( [ '+' , '-' , '*' , '/' , '%' , 'DIV' ] ) ;
}
if ( typeof SqlFunctions === 'undefined' || SqlFunctions . matchesType ( parser . yy . activeDialect , [ 'STRING' ] , types ) ) {
keywords = keywords . concat ( parser . isImpala ( ) ? [ 'ILIKE' , 'IREGEXP' , 'LIKE' , 'NOT LIKE' , 'REGEXP' , 'RLIKE' ] : [ 'LIKE' , 'NOT LIKE' , 'REGEXP' , 'RLIKE' ] ) ;
}
return { suggestKeywords : keywords } ;
} ;
parser . getTypeKeywords = function ( ) {
if ( parser . isHive ( ) ) {
return [ 'BIGINT' , 'BINARY' , 'BOOLEAN' , 'CHAR' , 'DATE' , 'DECIMAL' , 'DOUBLE' , 'DOUBLE PRECISION' , 'FLOAT' , 'INT' , 'SMALLINT' , 'TIMESTAMP' , 'STRING' , 'TINYINT' , 'VARCHAR' ] ;
}
if ( parser . isImpala ( ) ) {
return [ 'BIGINT' , 'BOOLEAN' , 'CHAR' , 'DECIMAL' , 'DOUBLE' , 'FLOAT' , 'INT' , 'REAL' , 'SMALLINT' , 'TIMESTAMP' , 'STRING' , 'TINYINT' , 'VARCHAR' ] ;
}
return [ 'BIGINT' , 'BOOLEAN' , 'CHAR' , 'DECIMAL' , 'DOUBLE' , 'FLOAT' , 'INT' , 'SMALLINT' , 'TIMESTAMP' , 'STRING' , 'TINYINT' , 'VARCHAR' ] ;
} ;
parser . getColumnDataTypeKeywords = function ( ) {
if ( parser . isHive ( ) ) {
return parser . getTypeKeywords ( ) . concat ( [ 'ARRAY<>' , 'MAP<>' , 'STRUCT<>' , 'UNIONTYPE<>' ] ) ;
}
if ( parser . isImpala ( ) ) {
return parser . getTypeKeywords ( ) . concat ( [ 'ARRAY<>' , 'MAP<>' , 'STRUCT<>' ] ) ;
}
return parser . getTypeKeywords ( ) ;
} ;
parser . addColRefIfExists = function ( valueExpression ) {
if ( valueExpression . columnReference ) {
parser . yy . result . colRef = { identifierChain : valueExpression . columnReference } ;
}
} ;
parser . selectListNoTableSuggest = function ( selectListEdit , hasDistinctOrAll ) {
if ( selectListEdit . cursorAtStart ) {
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! hasDistinctOrAll ) {
keywords = keywords . concat ( [ { value : 'ALL' , weight : 2 } , { value : 'DISTINCT' , weight : 2 } ] ) ;
}
if ( parser . isImpala ( ) ) {
keywords . push ( 'STRAIGHT_JOIN' ) ;
}
parser . suggestKeywords ( keywords ) ;
} else {
parser . checkForKeywords ( selectListEdit ) ;
}
if ( selectListEdit . suggestFunctions ) {
parser . suggestFunctions ( ) ;
}
if ( selectListEdit . suggestColumns ) {
parser . suggestColumns ( ) ;
}
if ( selectListEdit . suggestAggregateFunctions && ( ! hasDistinctOrAll || hasDistinctOrAll === 'ALL' ) ) {
parser . suggestAggregateFunctions ( ) ;
parser . suggestAnalyticFunctions ( ) ;
}
} ;
parser . suggestJoinConditions = function ( details ) {
parser . yy . result . suggestJoinConditions = details || { } ;
if ( parser . yy . latestTablePrimaries && ! parser . yy . result . suggestJoinConditions . tablePrimaries ) {
parser . yy . result . suggestJoinConditions . tablePrimaries = parser . yy . latestTablePrimaries . concat ( ) ;
}
} ;
parser . suggestJoins = function ( details ) {
parser . yy . result . suggestJoins = details || { } ;
} ;
parser . valueExpressionSuggest = function ( oppositeValueExpression , operator ) {
if ( oppositeValueExpression && oppositeValueExpression . columnReference ) {
parser . suggestValues ( ) ;
parser . yy . result . colRef = { identifierChain : oppositeValueExpression . columnReference } ;
}
parser . suggestColumns ( ) ;
parser . suggestFunctions ( ) ;
var keywords = [ { value : 'CASE' , weight : 450 } , { value : 'FALSE' , weight : 450 } , { value : 'NULL' , weight : 450 } , { value : 'TRUE' , weight : 450 } ] ;
if ( parser . isHive ( ) || typeof oppositeValueExpression === 'undefined' || typeof operator === 'undefined' ) {
keywords = keywords . concat ( [ 'EXISTS' , 'NOT' ] ) ;
}
if ( oppositeValueExpression && oppositeValueExpression . types [ 0 ] === 'NUMBER' ) {
parser . applyTypeToSuggestions ( [ 'NUMBER' ] ) ;
} else if ( parser . isImpala ( ) && ( typeof operator === 'undefined' || operator === '-' || operator === '+' ) ) {
keywords . push ( 'INTERVAL' ) ;
}
parser . suggestKeywords ( keywords ) ;
} ;
parser . applyTypeToSuggestions = function ( types ) {
if ( types [ 0 ] === 'BOOLEAN' ) {
return ;
}
if ( parser . yy . result . suggestFunctions && ! parser . yy . result . suggestFunctions . types ) {
parser . yy . result . suggestFunctions . types = types ;
}
if ( parser . yy . result . suggestColumns && ! parser . yy . result . suggestColumns . types ) {
parser . yy . result . suggestColumns . types = types ;
}
} ;
parser . findCaseType = function ( whenThenList ) {
var types = { } ;
whenThenList . caseTypes . forEach ( function ( valueExpression ) {
valueExpression . types . forEach ( function ( type ) {
types [ type ] = true ;
} ) ;
} ) ;
if ( Object . keys ( types ) . length === 1 ) {
return { types : [ Object . keys ( types ) [ 0 ] ] } ;
}
return { types : [ 'T' ] } ;
} ;
parser . findReturnTypes = function ( functionName ) {
return typeof SqlFunctions === 'undefined' ? [ 'T' ] : SqlFunctions . getReturnTypes ( parser . yy . activeDialect , functionName . toLowerCase ( ) ) ;
} ;
parser . applyArgumentTypesToSuggestions = function ( functionName , position ) {
var foundArguments = typeof SqlFunctions === 'undefined' ? [ 'T' ] : SqlFunctions . getArgumentTypes ( parser . yy . activeDialect , functionName . toLowerCase ( ) , position ) ;
if ( foundArguments . length == 0 && parser . yy . result . suggestColumns ) {
delete parser . yy . result . suggestColumns ;
delete parser . yy . result . suggestKeyValues ;
delete parser . yy . result . suggestValues ;
delete parser . yy . result . suggestFunctions ;
delete parser . yy . result . suggestIdentifiers ;
delete parser . yy . result . suggestKeywords ;
} else {
parser . applyTypeToSuggestions ( foundArguments ) ;
}
} ;
var getCleanImpalaPrimaries = function ( primaries ) {
var cleanPrimaries = [ ] ;
for ( var i = primaries . length - 1 ; i >= 0 ; i -- ) {
var cleanPrimary = primaries [ i ] ;
if ( cleanPrimary . identifierChain && cleanPrimary . identifierChain . length > 0 ) {
for ( var j = i - 1 ; j >= 0 ; j -- ) {
var parentPrimary = primaries [ j ] ;
if ( parentPrimary . alias && cleanPrimary . identifierChain [ 0 ] . name === parentPrimary . alias ) {
var restOfChain = cleanPrimary . identifierChain . concat ( ) ;
restOfChain . shift ( ) ;
if ( cleanPrimary . alias ) {
cleanPrimary = { identifierChain : parentPrimary . identifierChain . concat ( restOfChain ) , alias : cleanPrimary . alias , impalaComplex : true } ;
} else {
cleanPrimary = { identifierChain : parentPrimary . identifierChain . concat ( restOfChain ) , impalaComplex : true } ;
}
}
}
}
cleanPrimaries . push ( cleanPrimary ) ;
}
return cleanPrimaries ;
} ;
parser . commitLocations = function ( ) {
if ( parser . yy . locations . length === 0 ) {
return ;
}
var tablePrimaries = parser . yy . latestTablePrimaries ;
if ( parser . isImpala ( ) ) {
tablePrimaries = [ ] ;
getCleanImpalaPrimaries ( parser . yy . latestTablePrimaries ) . forEach ( function ( primary ) {
var cleanPrimary = primary ;
if ( primary . identifierChain && primary . identifierChain . length > 0 ) {
for ( var j = parser . yy . primariesStack . length - 1 ; j >= 0 ; j -- ) {
getCleanImpalaPrimaries ( parser . yy . primariesStack [ j ] ) . every ( function ( parentPrimary ) {
if ( parentPrimary . alias && parentPrimary . alias === primary . identifierChain [ 0 ] . name ) {
var identifierChain = primary . identifierChain . concat ( ) ;
identifierChain . shift ( ) ;
cleanPrimary = { identifierChain : parentPrimary . identifierChain . concat ( identifierChain ) } ;
if ( primary . alias ) {
cleanPrimary . alias = primary . alias ;
}
return false ;
}
return true ;
} ) ;
}
}
tablePrimaries . unshift ( cleanPrimary ) ;
} ) ;
}
var i = parser . yy . locations . length ;
while ( i -- ) {
var location = parser . yy . locations [ i ] ;
if ( location . type === 'variable' && location . colRef ) {
parser . expandIdentifierChain ( { wrapper : location . colRef , tablePrimaries : tablePrimaries , isColumnWrapper : true } ) ;
delete location . colRef . linked ;
}
// Impala can have references to previous tables after FROM, i.e. FROM testTable t, t.testArray
// In this testArray would be marked a type table so we need to switch it to column.
if ( location . type === 'table' && typeof location . identifierChain !== 'undefined' && location . identifierChain . length > 1 && tablePrimaries ) {
var allPrimaries = tablePrimaries ;
parser . yy . primariesStack . forEach ( function ( parentPrimaries ) {
allPrimaries = getCleanImpalaPrimaries ( parentPrimaries ) . concat ( allPrimaries ) ;
} ) ;
var found = allPrimaries . filter ( function ( primary ) {
return equalIgnoreCase ( primary . alias , location . identifierChain [ 0 ] . name ) ;
} ) ;
if ( found . length > 0 ) {
location . type = 'column' ;
}
}
if ( location . type === 'database' && typeof location . identifierChain !== 'undefined' && location . identifierChain . length > 0 && tablePrimaries ) {
var allPrimaries = tablePrimaries ;
parser . yy . primariesStack . forEach ( function ( parentPrimaries ) {
allPrimaries = getCleanImpalaPrimaries ( parentPrimaries ) . concat ( allPrimaries ) ;
} ) ;
var foundAlias = allPrimaries . filter ( function ( primary ) {
return equalIgnoreCase ( primary . alias , location . identifierChain [ 0 ] . name ) ;
} ) ;
if ( foundAlias . length > 0 && parser . isImpala ( ) ) {
// Impala complex reference in FROM clause, i.e. FROM testTable t, t.testMap tm
location . type = 'table' ;
parser . expandIdentifierChain ( { tablePrimaries : allPrimaries , wrapper : location , anyOwner : true } ) ;
location . type = location . identifierChain . length === 1 ? 'table' : 'complex' ;
continue ;
}
}
if ( location . type === 'unknown' ) {
if ( typeof location . identifierChain !== 'undefined' && location . identifierChain . length > 0 && location . identifierChain . length <= 2 && tablePrimaries ) {
var found = tablePrimaries . filter ( function ( primary ) {
return equalIgnoreCase ( primary . alias , location . identifierChain [ 0 ] . name ) || ( primary . identifierChain && equalIgnoreCase ( primary . identifierChain [ 0 ] . name , location . identifierChain [ 0 ] . name ) ) ;
} ) ;
if ( ! found . length && location . firstInChain ) {
found = tablePrimaries . filter ( function ( primary ) {
return ! primary . alias && primary . identifierChain && equalIgnoreCase ( primary . identifierChain [ primary . identifierChain . length - 1 ] . name , location . identifierChain [ 0 ] . name ) ;
} ) ;
}
if ( found . length ) {
if ( found [ 0 ] . identifierChain . length > 1 && location . identifierChain . length === 1 && equalIgnoreCase ( found [ 0 ] . identifierChain [ 0 ] . name , location . identifierChain [ 0 ] . name ) ) {
location . type = 'database' ;
} else if ( found [ 0 ] . alias && equalIgnoreCase ( location . identifierChain [ 0 ] . name , found [ 0 ] . alias ) && location . identifierChain . length > 1 ) {
location . type = 'column' ;
parser . expandIdentifierChain ( { tablePrimaries : tablePrimaries , wrapper : location , anyOwner : true } ) ;
} else if ( ! found [ 0 ] . alias && found [ 0 ] . identifierChain && equalIgnoreCase ( location . identifierChain [ 0 ] . name , found [ 0 ] . identifierChain [ found [ 0 ] . identifierChain . length - 1 ] . name ) && location . identifierChain . length > 1 ) {
location . type = 'column' ;
parser . expandIdentifierChain ( { tablePrimaries : tablePrimaries , wrapper : location , anyOwner : true } ) ;
} else {
location . type = found [ 0 ] . impalaComplex ? 'column' : 'table' ;
parser . expandIdentifierChain ( { tablePrimaries : tablePrimaries , wrapper : location , anyOwner : true } ) ;
}
} else {
if ( parser . yy . subQueries ) {
found = parser . yy . subQueries . filter ( function ( subQuery ) {
return equalIgnoreCase ( subQuery . alias , location . identifierChain [ 0 ] . name ) ;
} ) ;
if ( found . length > 0 ) {
location . type = 'subQuery' ;
location . identifierChain = [ { subQuery : found [ 0 ] . alias } ] ;
}
}
}
}
}
if ( location . type === 'asterisk' && ! location . linked ) {
if ( tablePrimaries && tablePrimaries . length > 0 ) {
location . tables = [ ] ;
location . linked = false ;
if ( ! location . identifierChain ) {
location . identifierChain = [ { asterisk : true } ] ;
}
parser . expandIdentifierChain ( { tablePrimaries : tablePrimaries , wrapper : location , anyOwner : false } ) ;
if ( location . tables . length === 0 ) {
parser . yy . locations . splice ( i , 1 ) ;
}
} else {
parser . yy . locations . splice ( i , 1 ) ;
}
}
if ( location . type === 'table' && typeof location . identifierChain !== 'undefined' && location . identifierChain . length === 1 && location . identifierChain [ 0 ] . name ) {
// Could be a cte reference
parser . yy . locations . some ( function ( otherLocation ) {
if ( otherLocation . type === 'alias' && otherLocation . source === 'cte' && SqlUtils . identifierEquals ( otherLocation . alias , location . identifierChain [ 0 ] . name ) ) {
// TODO: Possibly add the other location if we want to show the link in the future.
// i.e. highlight select definition on hover over alias, also for subquery references.
location . type = 'alias' ;
location . target = 'cte' ;
location . alias = location . identifierChain [ 0 ] . name ;
delete location . identifierChain ;
return true ;
}
} ) ;
}
if ( location . type === 'table' && ( typeof location . identifierChain === 'undefined' || location . identifierChain . length === 0 ) ) {
parser . yy . locations . splice ( i , 1 ) ;
}
if ( location . type === 'unknown' ) {
location . type = 'column' ;
}
// A column location might refer to a previously defined alias, i.e. last 'foo' in "SELECT cast(id AS int) foo FROM tbl ORDER BY foo;"
if ( location . type === 'column' ) {
for ( var j = i - 1 ; j >= 0 ; j -- ) {
var otherLocation = parser . yy . locations [ j ] ;
if ( otherLocation . type === 'alias' && otherLocation . source === 'column' && location . identifierChain && location . identifierChain . length === 1 && location . identifierChain [ 0 ] . name && otherLocation . alias && location . identifierChain [ 0 ] . name . toLowerCase ( ) === otherLocation . alias . toLowerCase ( ) ) {
location . type = 'alias' ;
location . source = 'column' ;
location . alias = location . identifierChain [ 0 ] . name ;
delete location . identifierChain ;
location . parentLocation = otherLocation . parentLocation ;
break ;
}
}
}
if ( location . type === 'column' ) {
if ( parser . isHive ( ) && ! location . linked ) {
location . identifierChain = parser . expandLateralViews ( parser . yy . lateralViews , location . identifierChain ) ;
}
var initialIdentifierChain = location . identifierChain ? location . identifierChain . concat ( ) : undefined ;
parser . expandIdentifierChain ( { tablePrimaries : tablePrimaries , wrapper : location , anyOwner : true , isColumnWrapper : true , isColumnLocation : true } ) ;
if ( typeof location . identifierChain === 'undefined' ) {
parser . yy . locations . splice ( i , 1 ) ;
} else if ( location . identifierChain . length === 0 && initialIdentifierChain && initialIdentifierChain . length === 1 ) {
// This is for the case "SELECT tblOrColName FROM db.tblOrColName";
location . identifierChain = initialIdentifierChain ;
}
}
if ( location . type === 'column' && location . identifierChain ) {
if ( location . identifierChain . length > 1 && location . tables && location . tables . length > 0 ) {
location . type = 'complex' ;
}
}
delete location . firstInChain ;
if ( location . type !== 'column' && location . type !== 'complex' ) {
delete location . qualified ;
} else if ( typeof location . qualified === 'undefined' ) {
location . qualified = false ;
}
}
if ( parser . yy . locations . length > 0 ) {
parser . yy . allLocations = parser . yy . allLocations . concat ( parser . yy . locations ) ;
parser . yy . locations = [ ] ;
}
} ;
var prioritizeSuggestions = function ( ) {
parser . yy . result . lowerCase = parser . yy . lowerCase || false ;
var cteIndex = { } ;
if ( typeof parser . yy . latestCommonTableExpressions !== 'undefined' ) {
parser . yy . latestCommonTableExpressions . forEach ( function ( cte ) {
cteIndex [ cte . alias . toLowerCase ( ) ] = cte ;
} )
}
SIMPLE _TABLE _REF _SUGGESTIONS . forEach ( function ( suggestionType ) {
if ( suggestionType !== 'suggestAggregateFunctions' && typeof parser . yy . result [ suggestionType ] !== 'undefined' && parser . yy . result [ suggestionType ] . tables . length === 0 ) {
delete parser . yy . result [ suggestionType ] ;
} else if ( typeof parser . yy . result [ suggestionType ] !== 'undefined' && typeof parser . yy . result [ suggestionType ] . tables !== 'undefined' ) {
for ( var i = parser . yy . result [ suggestionType ] . tables . length - 1 ; i >= 0 ; i -- ) {
var table = parser . yy . result [ suggestionType ] . tables [ i ] ;
if ( table . identifierChain . length === 1 && typeof table . identifierChain [ 0 ] . name !== 'undefined' && typeof cteIndex [ table . identifierChain [ 0 ] . name . toLowerCase ( ) ] !== 'undefined' ) {
parser . yy . result [ suggestionType ] . tables . splice ( i , 1 ) ;
}
}
}
} ) ;
if ( typeof parser . yy . result . colRef !== 'undefined' ) {
if ( ! parser . yy . result . colRef . linked || typeof parser . yy . result . colRef . identifierChain === 'undefined' || parser . yy . result . colRef . identifierChain . length === 0 ) {
delete parser . yy . result . colRef ;
if ( typeof parser . yy . result . suggestColRefKeywords !== 'undefined' ) {
Object . keys ( parser . yy . result . suggestColRefKeywords ) . forEach ( function ( type ) {
parser . yy . result . suggestKeywords = parser . yy . result . suggestKeywords . concat ( parser . createWeightedKeywords ( parser . yy . result . suggestColRefKeywords [ type ] , - 1 ) ) ;
} ) ;
delete parser . yy . result . suggestColRefKeywords ;
}
if ( parser . yy . result . suggestColumns && parser . yy . result . suggestColumns . types . length === 1 && parser . yy . result . suggestColumns . types [ 0 ] === 'COLREF' ) {
parser . yy . result . suggestColumns . types = [ 'T' ] ;
}
delete parser . yy . result . suggestValues ;
}
}
if ( typeof parser . yy . result . colRef !== 'undefined' ) {
if ( ! parser . yy . result . suggestValues && ! parser . yy . result . suggestColRefKeywords &&
( ! parser . yy . result . suggestColumns ||
parser . yy . result . suggestColumns . types [ 0 ] !== 'COLREF' ) ) {
delete parser . yy . result . colRef ;
}
}
if ( typeof parser . yy . result . suggestIdentifiers !== 'undefined' && parser . yy . result . suggestIdentifiers . length > 0 ) {
delete parser . yy . result . suggestTables ;
delete parser . yy . result . suggestDatabases ;
}
if ( typeof parser . yy . result . suggestColumns !== 'undefined' ) {
var suggestColumns = parser . yy . result . suggestColumns ;
if ( typeof suggestColumns . tables === 'undefined' || suggestColumns . tables . length === 0 ) {
// Impala supports statements like SELECT * FROM tbl1, tbl2 WHERE db.tbl1.col = tbl2.bla
if ( parser . yy . result . suggestColumns . linked && parser . isImpala ( ) && typeof suggestColumns . identifierChain !== 'undefined' && suggestColumns . identifierChain . length > 0 ) {
if ( suggestColumns . identifierChain . length === 1 ) {
parser . yy . result . suggestTables = suggestColumns ;
delete parser . yy . result . suggestColumns
} else {
suggestColumns . tables = [ { identifierChain : suggestColumns . identifierChain } ] ;
delete suggestColumns . identifierChain ;
}
} else {
delete parser . yy . result . suggestColumns ;
delete parser . yy . result . subQueries ;
}
} else {
delete parser . yy . result . suggestTables ;
delete parser . yy . result . suggestDatabases ;
suggestColumns . tables . forEach ( function ( table ) {
if ( typeof table . identifierChain !== 'undefined' && table . identifierChain . length === 1 && typeof table . identifierChain [ 0 ] . name !== 'undefined' ) {
var cte = cteIndex [ table . identifierChain [ 0 ] . name . toLowerCase ( ) ] ;
if ( typeof cte !== 'undefined' ) {
delete table . identifierChain [ 0 ] . name ;
table . identifierChain [ 0 ] . cte = cte . alias ;
}
} else if ( typeof table . identifierChain === 'undefined' && table . subQuery ) {
table . identifierChain = [ { subQuery : table . subQuery } ] ;
delete table . subQuery ;
}
} ) ;
if ( typeof suggestColumns . identifierChain !== 'undefined' && suggestColumns . identifierChain . length === 0 ) {
delete suggestColumns . identifierChain ;
}
}
} else {
delete parser . yy . result . subQueries ;
}
if ( typeof parser . yy . result . suggestJoinConditions !== 'undefined' ) {
if ( typeof parser . yy . result . suggestJoinConditions . tables === 'undefined' || parser . yy . result . suggestJoinConditions . tables . length === 0 ) {
delete parser . yy . result . suggestJoinConditions ;
}
}
if ( typeof parser . yy . result . suggestTables !== 'undefined' && typeof parser . yy . latestCommonTableExpressions !== 'undefined' ) {
var ctes = [ ] ;
parser . yy . latestCommonTableExpressions . forEach ( function ( cte ) {
var suggestion = { name : cte . alias } ;
if ( parser . yy . result . suggestTables . prependFrom ) {
suggestion . prependFrom = true
}
if ( parser . yy . result . suggestTables . prependQuestionMark ) {
suggestion . prependQuestionMark = true ;
}
ctes . push ( suggestion ) ;
} ) ;
if ( ctes . length > 0 ) {
parser . yy . result . suggestCommonTableExpressions = ctes ;
}
}
} ;
/ * *
* Impala supports referencing maps and arrays in the the table reference list i . e .
*
* SELECT m [ 'foo' ] . bar . | FROM someDb . someTable t , t . someMap m ;
*
* From this the tablePrimaries would look like :
*
* [ { alias : 't' , identifierChain : [ { name : 'someDb' } , { name : 'someTable' } ] } ,
* { alias : 'm' , identifierChain : [ { name : 't' } , { name : 'someMap' } ] } ]
*
* with an identifierChain from the select list :
*
* [ { name : 'm' , keySet : true } , { name : 'bar' } ]
*
* Calling this would return an expanded identifierChain , given the above it would be :
*
* [ { name : 't' } , { name : 'someMap' , keySet : true } , { name : 'bar' } ]
* /
parser . expandImpalaIdentifierChain = function ( tablePrimaries , identifierChain ) {
var expandedChain = identifierChain . concat ( ) ; // Clone in case it's called multiple times.
if ( typeof expandedChain === 'undefined' || expandedChain . length === 0 ) {
return identifierChain ;
}
var expand = function ( identifier , expandedChain ) {
var foundPrimary = tablePrimaries . filter ( function ( tablePrimary ) {
var primaryIdentifier = tablePrimary . alias ;
if ( ! primaryIdentifier && tablePrimary . identifierChain && tablePrimary . identifierChain . length > 0 ) {
primaryIdentifier = tablePrimary . identifierChain [ tablePrimary . identifierChain . length - 1 ] . name ;
}
return equalIgnoreCase ( primaryIdentifier , identifier ) ;
} ) ;
if ( foundPrimary . length === 1 && foundPrimary [ 0 ] . identifierChain ) {
var parentPrimary = tablePrimaries . filter ( function ( tablePrimary ) {
return equalIgnoreCase ( tablePrimary . alias , foundPrimary [ 0 ] . identifierChain [ 0 ] . name ) ;
} ) ;
if ( parentPrimary . length === 1 ) {
var keySet = expandedChain [ 0 ] . keySet ;
var secondPart = expandedChain . slice ( 1 ) ;
var firstPart = [ ] ;
// Clone to make sure we don't add keySet to the primaries
foundPrimary [ 0 ] . identifierChain . forEach ( function ( identifier ) {
firstPart . push ( { name : identifier . name } ) ;
} ) ;
if ( keySet && firstPart . length > 0 ) {
firstPart [ firstPart . length - 1 ] . keySet = true ;
}
if ( firstPart . length === 0 || typeof secondPart === 'undefined' || secondPart . length === 0 ) {
return firstPart ;
}
var result = firstPart . concat ( secondPart ) ;
if ( result . length > 0 ) {
return expand ( firstPart [ 0 ] . name , result ) ;
} else {
return result ;
}
}
}
return expandedChain ;
} ;
return expand ( expandedChain [ 0 ] . name , expandedChain ) ;
} ;
parser . identifyPartials = function ( beforeCursor , afterCursor ) {
var beforeMatch = beforeCursor . match ( /[0-9a-zA-Z_]*$/ ) ;
var afterMatch = afterCursor . match ( /^[0-9a-zA-Z_]*(?:\((?:[^)]*\))?)?/ ) ;
return { left : beforeMatch ? beforeMatch [ 0 ] . length : 0 , right : afterMatch ? afterMatch [ 0 ] . length : 0 } ;
} ;
parser . expandLateralViews = function ( lateralViews , originalIdentifierChain , columnSuggestion ) {
var identifierChain = originalIdentifierChain . concat ( ) ; // Clone in case it's re-used
var firstIdentifier = identifierChain [ 0 ] ;
if ( typeof lateralViews !== 'undefined' ) {
lateralViews . concat ( ) . reverse ( ) . forEach ( function ( lateralView ) {
if ( ! lateralView . udtf . expression . columnReference ) {
return ;
}
if ( equalIgnoreCase ( firstIdentifier . name , lateralView . tableAlias ) && identifierChain . length > 1 ) {
identifierChain . shift ( ) ;
firstIdentifier = identifierChain [ 0 ] ;
if ( columnSuggestion ) {
delete parser . yy . result . suggestKeywords ;
}
} else if ( equalIgnoreCase ( firstIdentifier . name , lateralView . tableAlias ) && identifierChain . length === 1 && typeof parser . yy . result . suggestColumns !== 'undefined' ) {
if ( columnSuggestion ) {
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 ;
delete parser . yy . result . suggestKeywords ;
}
return identifierChain ;
}
if ( lateralView . columnAliases . indexOf ( firstIdentifier . name ) !== - 1 ) {
if ( lateralView . columnAliases . length === 2 && lateralView . udtf . function . toLowerCase ( ) === 'explode' && equalIgnoreCase ( firstIdentifier . name , lateralView . columnAliases [ 0 ] ) ) {
identifierChain [ 0 ] = { name : 'key' } ;
} else if ( lateralView . columnAliases . length === 2 && lateralView . udtf . function . toLowerCase ( ) === 'explode' && equalIgnoreCase ( firstIdentifier . name , lateralView . columnAliases [ 1 ] ) ) {
identifierChain [ 0 ] = { name : 'value' } ;
} else {
identifierChain [ 0 ] = { name : 'item' } ;
}
identifierChain = lateralView . udtf . expression . columnReference . concat ( identifierChain ) ;
firstIdentifier = identifierChain [ 0 ] ;
}
} ) ;
}
return identifierChain ;
} ;
var addCleanTablePrimary = function ( tables , tablePrimary ) {
if ( tablePrimary . alias ) {
tables . push ( { alias : tablePrimary . alias , identifierChain : tablePrimary . identifierChain } ) ;
} else {
tables . push ( { identifierChain : tablePrimary . identifierChain } ) ;
}
} ;
parser . expandIdentifierChain = function ( options ) {
var wrapper = options . wrapper ;
var anyOwner = options . anyOwner ;
var isColumnWrapper = options . isColumnWrapper ;
var isColumnLocation = options . isColumnLocation ;
var tablePrimaries = options . tablePrimaries || parser . yy . latestTablePrimaries ;
if ( typeof wrapper . identifierChain === 'undefined' || typeof tablePrimaries === 'undefined' ) {
return ;
}
var identifierChain = wrapper . identifierChain . concat ( ) ;
if ( tablePrimaries . length === 0 ) {
delete wrapper . identifierChain ;
return ;
}
if ( ! anyOwner ) {
tablePrimaries = filterTablePrimariesForOwner ( tablePrimaries , wrapper . owner ) ;
}
if ( identifierChain . length > 0 && identifierChain [ identifierChain . length - 1 ] . asterisk ) {
var tables = [ ] ;
tablePrimaries . forEach ( function ( tablePrimary ) {
if ( identifierChain . length > 1 && ! tablePrimary . subQueryAlias ) {
if ( identifierChain . length === 2 && equalIgnoreCase ( tablePrimary . alias , identifierChain [ 0 ] . name ) ) {
addCleanTablePrimary ( tables , tablePrimary ) ;
} else if ( identifierChain . length === 2 && equalIgnoreCase ( tablePrimary . identifierChain [ 0 ] . name , identifierChain [ 0 ] . name ) ) {
addCleanTablePrimary ( tables , tablePrimary ) ;
} else if ( identifierChain . length === 3 && tablePrimary . identifierChain . length > 1 &&
equalIgnoreCase ( tablePrimary . identifierChain [ 0 ] . name , identifierChain [ 0 ] . name ) &&
equalIgnoreCase ( tablePrimary . identifierChain [ 1 ] . name , identifierChain [ 1 ] . name ) ) {
addCleanTablePrimary ( tables , tablePrimary ) ;
}
} else {
if ( tablePrimary . subQueryAlias ) {
tables . push ( { identifierChain : [ { subQuery : tablePrimary . subQueryAlias } ] } ) ;
} else {
addCleanTablePrimary ( tables , tablePrimary ) ;
}
}
} ) ;
// Possible Joins
if ( tables . length > 0 ) {
wrapper . tables = tables ;
delete wrapper . identifierChain ;
return ;
}
}
// Impala can have references to maps or array, i.e. FROM table t, t.map m
// We need to replace those in the identifierChain
if ( parser . isImpala ( ) ) {
var lengthBefore = identifierChain . length ;
identifierChain = parser . expandImpalaIdentifierChain ( tablePrimaries , identifierChain ) ;
// Change type of any locations marked as table
if ( wrapper . type === 'table' && identifierChain . length > lengthBefore ) {
wrapper . type = 'column' ;
}
wrapper . identifierChain = identifierChain ;
}
// Expand exploded views in the identifier chain
if ( parser . isHive ( ) && identifierChain . length > 0 ) {
identifierChain = parser . expandLateralViews ( parser . yy . lateralViews , identifierChain ) ;
wrapper . identifierChain = identifierChain ;
}
// IdentifierChain contains a possibly started identifier or empty, example: a.b.c = ['a', 'b', 'c']
// Reduce the tablePrimaries to the one that matches the first identifier if found
var foundPrimary ;
var doubleMatch = false ;
var aliasMatch = false ;
if ( identifierChain . length > 0 ) {
for ( var i = 0 ; i < tablePrimaries . length ; i ++ ) {
if ( tablePrimaries [ i ] . subQueryAlias ) {
if ( equalIgnoreCase ( tablePrimaries [ i ] . subQueryAlias , identifierChain [ 0 ] . name ) ) {
foundPrimary = tablePrimaries [ i ] ;
}
} else if ( equalIgnoreCase ( tablePrimaries [ i ] . alias , identifierChain [ 0 ] . name ) ) {
foundPrimary = tablePrimaries [ i ] ;
aliasMatch = true ;
break ;
} else if ( tablePrimaries [ i ] . identifierChain . length > 1 && identifierChain . length > 1 &&
equalIgnoreCase ( tablePrimaries [ i ] . identifierChain [ 0 ] . name , identifierChain [ 0 ] . name ) &&
equalIgnoreCase ( tablePrimaries [ i ] . identifierChain [ 1 ] . name , identifierChain [ 1 ] . name ) ) {
foundPrimary = tablePrimaries [ i ] ;
doubleMatch = true ;
break ;
} else if ( ! foundPrimary && equalIgnoreCase ( tablePrimaries [ i ] . identifierChain [ 0 ] . name , identifierChain [ 0 ] . name ) && identifierChain . length > ( isColumnLocation ? 1 : 0 ) ) {
foundPrimary = tablePrimaries [ i ] ;
// No break as first two can still match.
} else if ( ! foundPrimary && tablePrimaries [ i ] . identifierChain . length > 1 && ! tablePrimaries [ i ] . alias
&& equalIgnoreCase ( tablePrimaries [ i ] . identifierChain [ tablePrimaries [ i ] . identifierChain . length - 1 ] . name , identifierChain [ 0 ] . name ) ) {
// This is for the case SELECT baa. FROM bla.baa, blo.boo;
foundPrimary = tablePrimaries [ i ] ;
break ;
}
}
}
if ( foundPrimary ) {
if ( foundPrimary . impalaComplex && wrapper . type === 'column' ) {
wrapper . type = 'complex' ;
}
identifierChain . shift ( ) ;
if ( doubleMatch ) {
identifierChain . shift ( ) ;
}
} else if ( tablePrimaries . length === 1 && ! isColumnWrapper ) {
foundPrimary = tablePrimaries [ 0 ] ;
}
if ( foundPrimary ) {
if ( isColumnWrapper ) {
wrapper . identifierChain = identifierChain ;
if ( foundPrimary . subQueryAlias ) {
wrapper . tables = [ { subQuery : foundPrimary . subQueryAlias } ] ;
} else if ( foundPrimary . alias ) {
if ( ! isColumnLocation && isColumnWrapper && aliasMatch ) {
// TODO: add alias on table in suggestColumns (needs support in sqlAutocomplete3.js)
// the case is: SELECT cu.| FROM customers cu;
// This prevents alias from being added automatically in sqlAutocompleter3.js
wrapper . tables = [ { identifierChain : foundPrimary . identifierChain } ] ;
} else {
wrapper . tables = [ { identifierChain : foundPrimary . identifierChain , alias : foundPrimary . alias } ] ;
}
} else {
wrapper . tables = [ { identifierChain : foundPrimary . identifierChain } ] ;
}
} else {
if ( foundPrimary . subQueryAlias ) {
identifierChain . unshift ( { subQuery : foundPrimary . subQueryAlias } ) ;
} else {
identifierChain = foundPrimary . identifierChain . concat ( identifierChain ) ;
}
if ( wrapper . tables ) {
wrapper . tables . push ( { identifierChain : identifierChain } ) ;
delete wrapper . identifierChain ;
} else {
wrapper . identifierChain = identifierChain ;
}
}
} else {
if ( isColumnWrapper ) {
wrapper . tables = [ ] ;
}
tablePrimaries . forEach ( function ( tablePrimary ) {
var targetTable = tablePrimary . subQueryAlias ? { subQuery : tablePrimary . subQueryAlias } : { identifierChain : tablePrimary . identifierChain } ;
if ( tablePrimary . alias ) {
targetTable . alias = tablePrimary . alias ;
}
if ( wrapper . tables ) {
wrapper . tables . push ( targetTable )
}
} ) ;
}
delete wrapper . owner ;
wrapper . linked = true ;
} ;
var suggestLateralViewAliasesAsIdentifiers = function ( ) {
if ( typeof parser . yy . lateralViews === 'undefined' || parser . yy . lateralViews . length === 0 ) {
return ;
}
if ( typeof parser . yy . result . suggestIdentifiers === 'undefined' ) {
parser . yy . result . suggestIdentifiers = [ ] ;
}
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 ) {
delete parser . yy . result . suggestIdentifiers ;
}
} ;
var filterTablePrimariesForOwner = function ( tablePrimaries , owner ) {
var result = [ ] ;
tablePrimaries . forEach ( function ( primary ) {
if ( typeof owner === 'undefined' && typeof primary . owner === 'undefined' ) {
result . push ( primary ) ;
} else if ( owner === primary . owner ) {
result . push ( primary ) ;
}
} ) ;
return result ;
} ;
var convertTablePrimariesToSuggestions = function ( tablePrimaries ) {
var tables = [ ] ;
var identifiers = [ ] ;
tablePrimaries . forEach ( function ( tablePrimary ) {
if ( tablePrimary . identifierChain && tablePrimary . identifierChain . length > 0 ) {
var table = { identifierChain : tablePrimary . identifierChain } ;
if ( tablePrimary . alias ) {
table . alias = tablePrimary . alias ;
identifiers . push ( { name : table . alias + '.' , type : 'alias' } ) ;
if ( parser . isImpala ( ) ) {
var testForImpalaAlias = [ { name : table . alias } ] ;
var result = parser . expandImpalaIdentifierChain ( tablePrimaries , testForImpalaAlias ) ;
if ( result . length > 1 ) {
// Continue if it's a reference to a complex type
return ;
}
}
} else {
var lastIdentifier = tablePrimary . identifierChain [ tablePrimary . identifierChain . length - 1 ] ;
if ( typeof lastIdentifier . name !== 'undefined' ) {
identifiers . push ( { name : lastIdentifier . name + '.' , type : 'table' } ) ;
} else if ( typeof lastIdentifier . subQuery !== 'undefined' ) {
identifiers . push ( { name : lastIdentifier . subQuery + '.' , type : 'sub-query' } ) ;
}
}
tables . push ( table ) ;
} else if ( tablePrimary . subQueryAlias ) {
identifiers . push ( { name : tablePrimary . subQueryAlias + '.' , type : 'sub-query' } ) ;
tables . push ( { identifierChain : [ { subQuery : tablePrimary . subQueryAlias } ] } ) ;
}
} ) ;
if ( identifiers . length > 0 ) {
if ( typeof parser . yy . result . suggestIdentifiers === 'undefined' ) {
parser . yy . result . suggestIdentifiers = identifiers ;
} else {
parser . yy . result . suggestIdentifiers = identifiers . concat ( parser . yy . result . suggestIdentifiers ) ;
}
}
parser . yy . result . suggestColumns . tables = tables ;
if ( parser . yy . result . suggestColumns . identifierChain && parser . yy . result . suggestColumns . identifierChain . length === 0 ) {
delete parser . yy . result . suggestColumns . identifierChain ;
}
parser . yy . result . suggestColumns . linked = true ;
} ;
var linkTablePrimaries = function ( ) {
if ( ! parser . yy . cursorFound || typeof parser . yy . latestTablePrimaries === 'undefined' ) {
return ;
}
SIMPLE _TABLE _REF _SUGGESTIONS . forEach ( function ( suggestionType ) {
if ( typeof parser . yy . result [ suggestionType ] !== 'undefined' && parser . yy . result [ suggestionType ] . tablePrimaries && ! parser . yy . result [ suggestionType ] . linked ) {
parser . yy . result [ suggestionType ] . tables = [ ] ;
parser . yy . result [ suggestionType ] . tablePrimaries . forEach ( function ( tablePrimary ) {
if ( ! tablePrimary . subQueryAlias ) {
parser . yy . result [ suggestionType ] . tables . push ( tablePrimary . alias ? {
identifierChain : tablePrimary . identifierChain . concat ( ) ,
alias : tablePrimary . alias
} : { identifierChain : tablePrimary . identifierChain . concat ( ) } ) ;
}
} ) ;
delete parser . yy . result [ suggestionType ] . tablePrimaries ;
parser . yy . result [ suggestionType ] . linked = true ;
}
} ) ;
if ( typeof parser . yy . result . suggestColumns !== 'undefined' && ! parser . yy . result . suggestColumns . linked ) {
var tablePrimaries = filterTablePrimariesForOwner ( parser . yy . latestTablePrimaries , parser . yy . result . suggestColumns . owner ) ;
if ( ! parser . yy . result . suggestColumns . tables ) {
parser . yy . result . suggestColumns . tables = [ ] ;
}
if ( parser . yy . subQueries . length > 0 ) {
parser . yy . result . subQueries = parser . yy . subQueries ;
}
if ( typeof parser . yy . result . suggestColumns . identifierChain === 'undefined' || parser . yy . result . suggestColumns . identifierChain . length === 0 ) {
if ( tablePrimaries . length > 1 ) {
convertTablePrimariesToSuggestions ( tablePrimaries ) ;
} else {
suggestLateralViewAliasesAsIdentifiers ( ) ;
if ( tablePrimaries . length === 1 && ( tablePrimaries [ 0 ] . alias || tablePrimaries [ 0 ] . subQueryAlias ) ) {
convertTablePrimariesToSuggestions ( tablePrimaries ) ;
}
parser . expandIdentifierChain ( { wrapper : parser . yy . result . suggestColumns , anyOwner : false , isColumnWrapper : true } ) ;
}
} else {
// Expand exploded views in the identifier chain
if ( parser . isHive ( ) && ! parser . yy . result . suggestColumns . linked ) {
var originalLength = parser . yy . result . suggestColumns . identifierChain . length ;
parser . yy . result . suggestColumns . identifierChain = parser . expandLateralViews ( parser . yy . lateralViews , parser . yy . result . suggestColumns . identifierChain , true ) ;
// Drop '*' keyword for lateral views
if ( typeof parser . yy . result . suggestColumns !== 'undefined' ) {
if ( parser . yy . result . suggestColumns . identifierChain . length > originalLength &&
typeof parser . yy . result . suggestKeywords !== 'undefined' &&
parser . yy . result . suggestKeywords . length === 1 &&
parser . yy . result . suggestKeywords [ 0 ] . value === '*' ) {
delete parser . yy . result . suggestKeywords ;
}
parser . expandIdentifierChain ( { wrapper : parser . yy . result . suggestColumns , anyOwner : false , isColumnWrapper : true } ) ;
}
} else {
parser . expandIdentifierChain ( { wrapper : parser . yy . result . suggestColumns , anyOwner : false , isColumnWrapper : true } ) ;
}
}
}
if ( typeof parser . yy . result . colRef !== 'undefined' && ! parser . yy . result . colRef . linked ) {
parser . expandIdentifierChain ( { wrapper : parser . yy . result . colRef } ) ;
var primaries = filterTablePrimariesForOwner ( parser . yy . latestTablePrimaries ) ;
if ( primaries . length === 0 || ( primaries . length > 1 && parser . yy . result . colRef . identifierChain . length === 1 ) ) {
parser . yy . result . colRef . identifierChain = [ ] ;
}
}
if ( typeof parser . yy . result . suggestKeyValues !== 'undefined' && ! parser . yy . result . suggestKeyValues . linked ) {
parser . expandIdentifierChain ( { wrapper : parser . yy . result . suggestKeyValues } ) ;
}
} ;
parser . getSubQuery = function ( cols ) {
var columns = [ ] ;
cols . selectList . forEach ( function ( col ) {
var result = { } ;
if ( col . alias ) {
result . alias = col . alias ;
}
if ( col . valueExpression && col . valueExpression . columnReference ) {
result . identifierChain = col . valueExpression . columnReference
} else if ( col . asterisk ) {
result . identifierChain = [ { asterisk : true } ] ;
}
if ( col . valueExpression && col . valueExpression . types && col . valueExpression . types . length === 1 ) {
result . type = col . valueExpression . types [ 0 ] ;
}
columns . push ( result ) ;
} ) ;
return {
columns : columns
} ;
} ;
parser . addTablePrimary = function ( ref ) {
if ( typeof parser . yy . latestTablePrimaries === 'undefined' ) {
parser . yy . latestTablePrimaries = [ ] ;
}
parser . yy . latestTablePrimaries . push ( ref ) ;
} ;
parser . suggestFileFormats = function ( ) {
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'AVRO' , 'INPUTFORMAT' , 'ORC' , 'PARQUET' , 'RCFILE' , 'SEQUENCEFILE' , 'TEXTFILE' ] ) ;
} else {
parser . suggestKeywords ( [ 'AVRO' , 'KUDU' , 'ORC' , 'PARQUET' , 'RCFILE' , 'SEQUENCEFILE' , 'TEXTFILE' ] ) ;
}
} ;
parser . getKeywordsForOptionalsLR = function ( optionals , keywords , override ) {
var result = [ ] ;
for ( var i = 0 ; i < optionals . length ; i ++ ) {
if ( ! optionals [ i ] && ( typeof override === 'undefined' || override [ i ] ) ) {
if ( keywords [ i ] instanceof Array ) {
result = result . concat ( keywords [ i ] ) ;
} else {
result . push ( keywords [ i ] ) ;
}
} else if ( optionals [ i ] ) {
break ;
}
}
return result ;
} ;
parser . suggestDdlAndDmlKeywords = function ( extraKeywords ) {
var keywords = [ 'ALTER' , 'CREATE' , 'DESCRIBE' , 'DROP' , 'GRANT' , 'INSERT' , 'REVOKE' , 'SELECT' , 'SET' , 'SHOW' , 'TRUNCATE' , 'UPDATE' , 'USE' , 'WITH' ] ;
if ( extraKeywords ) {
keywords = keywords . concat ( extraKeywords ) ;
}
if ( parser . isHive ( ) ) {
keywords = keywords . concat ( [ 'ABORT' , 'ANALYZE TABLE' , 'DELETE' , 'EXPORT' , 'IMPORT' , 'LOAD' , 'MERGE' , 'MSCK' , 'RELOAD FUNCTION' , 'RESET' ] ) ;
}
if ( parser . isImpala ( ) ) {
keywords = keywords . concat ( [ 'COMMENT ON' , 'COMPUTE' , 'DELETE' , 'INVALIDATE METADATA' , 'LOAD' , 'REFRESH' , 'UPSERT' ] ) ;
}
parser . suggestKeywords ( keywords ) ;
} ;
parser . checkForSelectListKeywords = function ( selectList ) {
if ( selectList . length === 0 ) {
return ;
}
var last = selectList [ selectList . length - 1 ] ;
if ( ! last || ! last . valueExpression ) {
return ;
}
var valueExpressionKeywords = parser . getValueExpressionKeywords ( last . valueExpression ) ;
var keywords = [ ] ;
if ( last . suggestKeywords ) {
keywords = keywords . concat ( last . suggestKeywords ) ;
}
if ( valueExpressionKeywords . suggestKeywords ) {
keywords = keywords . concat ( valueExpressionKeywords . suggestKeywords ) ;
}
if ( valueExpressionKeywords . suggestColRefKeywords ) {
parser . suggestColRefKeywords ( valueExpressionKeywords . suggestColRefKeywords ) ;
parser . addColRefIfExists ( last . valueExpression ) ;
}
if ( ! last . alias ) {
keywords . push ( 'AS' ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
} ;
parser . checkForKeywords = function ( expression ) {
if ( expression ) {
if ( expression . suggestKeywords && expression . suggestKeywords . length > 0 ) {
parser . suggestKeywords ( expression . suggestKeywords ) ;
}
if ( expression . suggestColRefKeywords ) {
parser . suggestColRefKeywords ( expression . suggestColRefKeywords ) ;
parser . addColRefIfExists ( expression ) ;
}
}
} ;
parser . createWeightedKeywords = function ( keywords , weight ) {
var result = [ ] ;
keywords . forEach ( function ( keyword ) {
if ( typeof keyword . weight !== 'undefined' ) {
keyword . weight = weight + ( keyword . weight / 10 ) ;
result . push ( keyword ) ;
} else {
result . push ( { value : keyword , weight : weight } ) ;
}
} ) ;
return result ;
} ;
parser . suggestKeywords = function ( keywords ) {
var weightedKeywords = [ ] ;
if ( keywords . length == 0 ) {
return ;
}
keywords . forEach ( function ( keyword ) {
if ( typeof keyword . weight !== 'undefined' ) {
weightedKeywords . push ( keyword ) ;
} else {
weightedKeywords . push ( { value : keyword , weight : - 1 } )
}
} ) ;
weightedKeywords . sort ( function ( a , b ) {
if ( a . weight !== b . weight ) {
return b . weight - a . weight ;
}
return a . value . localeCompare ( b . value ) ;
} ) ;
parser . yy . result . suggestKeywords = weightedKeywords ;
} ;
parser . suggestColRefKeywords = function ( colRefKeywords ) {
parser . yy . result . suggestColRefKeywords = colRefKeywords ;
} ;
parser . suggestTablesOrColumns = function ( identifier ) {
if ( typeof parser . yy . latestTablePrimaries == 'undefined' ) {
parser . suggestTables ( { identifierChain : [ { name : identifier } ] } ) ;
return ;
}
var tableRef = parser . yy . latestTablePrimaries . filter ( function ( tablePrimary ) {
return equalIgnoreCase ( tablePrimary . alias , identifier ) ;
} ) ;
if ( tableRef . length > 0 ) {
parser . suggestColumns ( { identifierChain : [ { name : identifier } ] } ) ;
} else {
parser . suggestTables ( { identifierChain : [ { name : identifier } ] } ) ;
}
} ;
parser . suggestFunctions = function ( details ) {
parser . yy . result . suggestFunctions = details || { } ;
} ;
parser . suggestAggregateFunctions = function ( ) {
var primaries = [ ] ;
var aliases = { } ;
parser . yy . latestTablePrimaries . forEach ( function ( primary ) {
if ( typeof primary . alias !== 'undefined' ) {
aliases [ primary . alias ] = true ;
}
// Drop if the first one refers to a table alias (...FROM tbl t, t.map tm ...)
if ( typeof primary . identifierChain !== 'undefined' && ! aliases [ primary . identifierChain [ 0 ] . name ] && typeof primary . owner === 'undefined' ) {
primaries . push ( primary ) ;
}
} ) ;
parser . yy . result . suggestAggregateFunctions = { tablePrimaries : primaries } ;
} ;
parser . suggestAnalyticFunctions = function ( ) {
parser . yy . result . suggestAnalyticFunctions = true ;
} ;
parser . suggestSetOptions = function ( ) {
parser . yy . result . suggestSetOptions = true ;
} ;
parser . suggestIdentifiers = function ( identifiers ) {
parser . yy . result . suggestIdentifiers = identifiers ;
} ;
parser . suggestColumns = function ( details ) {
if ( typeof details === 'undefined' ) {
details = { identifierChain : [ ] } ;
} else if ( typeof details . identifierChain === 'undefined' ) {
details . identifierChain = [ ] ;
}
parser . yy . result . suggestColumns = details ;
} ;
parser . suggestGroupBys = function ( details ) {
parser . yy . result . suggestGroupBys = details || { } ;
} ;
parser . suggestOrderBys = function ( details ) {
parser . yy . result . suggestOrderBys = details || { } ;
} ;
parser . suggestFilters = function ( details ) {
parser . yy . result . suggestFilters = details || { } ;
} ;
parser . suggestKeyValues = function ( details ) {
parser . yy . result . suggestKeyValues = details || { } ;
} ;
parser . suggestTables = function ( details ) {
parser . yy . result . suggestTables = details || { } ;
} ;
var adjustLocationForCursor = function ( location ) {
// columns are 0-based and lines not, so add 1 to cols
var newLocation = {
first _line : location . first _line ,
last _line : location . last _line ,
first _column : location . first _column + 1 ,
last _column : location . last _column + 1
} ;
if ( parser . yy . cursorFound ) {
if ( parser . yy . cursorFound . first _line === newLocation . first _line && parser . yy . cursorFound . last _column <= newLocation . first _column ) {
var additionalSpace = parser . yy . partialLengths . left + parser . yy . partialLengths . right ;
additionalSpace -= parser . yy . partialCursor ? 1 : 3 ; // For some reason the normal cursor eats 3 positions.
newLocation . first _column = newLocation . first _column + additionalSpace ;
newLocation . last _column = newLocation . last _column + additionalSpace ;
}
}
return newLocation ;
} ;
parser . addFunctionLocation = function ( location , functionName ) {
// Remove trailing '(' from location
var adjustedLocation = {
first _line : location . first _line ,
last _line : location . last _line ,
first _column : location . first _column ,
last _column : location . last _column - 1
} ;
parser . yy . locations . push ( {
type : 'function' ,
location : adjustLocationForCursor ( adjustedLocation ) ,
function : functionName . toLowerCase ( )
} ) ;
} ;
parser . addStatementLocation = function ( location ) {
// Don't report lonely cursor as a statement
if ( location . first _line === location . last _line && Math . abs ( location . last _column - location . first _column ) === 1 ) {
return ;
}
var adjustedLocation ;
if ( parser . yy . cursorFound && parser . yy . cursorFound . last _line === location . last _line &&
parser . yy . cursorFound . first _column >= location . first _column && parser . yy . cursorFound . last _column <= location . last _column ) {
var additionalSpace = parser . yy . partialLengths . left + parser . yy . partialLengths . right ;
adjustedLocation = {
first _line : location . first _line ,
last _line : location . last _line ,
first _column : location . first _column + 1 ,
last _column : location . last _column + additionalSpace - ( parser . yy . partialCursor ? 0 : 2 )
}
} else {
adjustedLocation = {
first _line : location . first _line ,
last _line : location . last _line ,
first _column : location . first _column + 1 ,
last _column : location . last _column + 1
}
}
parser . yy . locations . push ( {
type : 'statement' ,
location : adjustedLocation
} ) ;
} ;
parser . firstDefined = function ( ) {
for ( var i = 0 ; i + 1 < arguments . length ; i += 2 ) {
if ( arguments [ i ] ) {
return arguments [ i + 1 ] ;
}
}
} ;
parser . addClauseLocation = function ( type , precedingLocation , locationIfPresent , isCursor ) {
var location ;
if ( isCursor ) {
if ( parser . yy . partialLengths . left === 0 && parser . yy . partialLengths . right === 0 ) {
location = {
type : type ,
missing : true ,
location : adjustLocationForCursor ( {
first _line : precedingLocation . last _line ,
first _column : precedingLocation . last _column ,
last _line : precedingLocation . last _line ,
last _column : precedingLocation . last _column
} )
}
} else {
location = {
type : type ,
missing : false ,
location : {
first _line : locationIfPresent . last _line ,
first _column : locationIfPresent . last _column - 1 ,
last _line : locationIfPresent . last _line ,
last _column : locationIfPresent . last _column - 1 + parser . yy . partialLengths . right + parser . yy . partialLengths . left
}
}
}
} else {
location = {
type : type ,
missing : ! locationIfPresent ,
location : adjustLocationForCursor ( locationIfPresent || {
first _line : precedingLocation . last _line ,
first _column : precedingLocation . last _column ,
last _line : precedingLocation . last _line ,
last _column : precedingLocation . last _column
} )
} ;
}
if ( parser . isInSubquery ( ) ) {
location . subquery = true ;
}
parser . yy . locations . push ( location )
} ;
parser . addStatementTypeLocation = function ( identifier , location , additionalText ) {
if ( ! parser . isImpala ( ) ) {
return ;
}
var loc = {
type : 'statementType' ,
location : adjustLocationForCursor ( location ) ,
identifier : identifier
} ;
if ( typeof additionalText !== 'undefined' ) {
switch ( identifier ) {
case 'ALTER' :
if ( /ALTER\s+VIEW/i . test ( additionalText ) ) {
loc . identifier = 'ALTER VIEW' ;
} else {
loc . identifier = 'ALTER TABLE' ;
}
break ;
case 'COMPUTE' :
loc . identifier = 'COMPUTE STATS' ;
break ;
case 'CREATE' :
if ( /CREATE\s+VIEW/i . test ( additionalText ) ) {
loc . identifier = 'CREATE VIEW' ;
} else if ( /CREATE\s+TABLE/i . test ( additionalText ) ) {
loc . identifier = 'CREATE TABLE' ;
} else if ( /CREATE\s+DATABASE/i . test ( additionalText ) ) {
loc . identifier = 'CREATE DATABASE' ;
} else if ( /CREATE\s+ROLE/i . test ( additionalText ) ) {
loc . identifier = 'CREATE ROLE' ;
} else if ( /CREATE\s+FUNCTION/i . test ( additionalText ) ) {
loc . identifier = 'CREATE FUNCTION' ;
} else {
loc . identifier = 'CREATE TABLE' ;
}
break ;
case 'DROP' :
if ( /DROP\s+VIEW/i . test ( additionalText ) ) {
loc . identifier = 'DROP VIEW' ;
} else if ( /DROP\s+TABLE/i . test ( additionalText ) ) {
loc . identifier = 'DROP TABLE' ;
} else if ( /DROP\s+DATABASE/i . test ( additionalText ) ) {
loc . identifier = 'DROP DATABASE' ;
} else if ( /DROP\s+ROLE/i . test ( additionalText ) ) {
loc . identifier = 'DROP ROLE' ;
} else if ( /DROP\s+STATS/i . test ( additionalText ) ) {
loc . identifier = 'DROP STATS' ;
} else if ( /DROP\s+FUNCTION/i . test ( additionalText ) ) {
loc . identifier = 'DROP FUNCTION' ;
} else {
loc . identifier = 'DROP TABLE' ;
}
break ;
case 'INVALIDATE' :
loc . identifier = 'INVALIDATE METADATA' ;
break ;
case 'LOAD' :
loc . identifier = 'LOAD DATA' ;
break ;
case 'TRUNCATE' :
loc . identifier = 'TRUNCATE TABLE' ;
break ;
default :
}
}
parser . yy . locations . push ( loc ) ;
} ;
parser . addFileLocation = function ( location , path ) {
parser . yy . locations . push ( {
type : 'file' ,
location : adjustLocationForCursor ( location ) ,
path : path
} ) ;
} ;
parser . addDatabaseLocation = function ( location , identifierChain ) {
parser . yy . locations . push ( {
type : 'database' ,
location : adjustLocationForCursor ( location ) ,
identifierChain : identifierChain
} ) ;
} ;
parser . addTableLocation = function ( location , identifierChain ) {
parser . yy . locations . push ( {
type : 'table' ,
location : adjustLocationForCursor ( location ) ,
identifierChain : identifierChain
} ) ;
} ;
parser . addColumnAliasLocation = function ( location , alias , parentLocation ) {
var aliasLocation = {
type : 'alias' ,
source : 'column' ,
alias : alias ,
location : adjustLocationForCursor ( location ) ,
parentLocation : adjustLocationForCursor ( parentLocation )
} ;
if ( parser . yy . locations . length && parser . yy . locations [ parser . yy . locations . length - 1 ] . type === 'column' ) {
var closestColumn = parser . yy . locations [ parser . yy . locations . length - 1 ] ;
if ( closestColumn . location . first _line === aliasLocation . parentLocation . first _line &&
closestColumn . location . last _line === aliasLocation . parentLocation . last _line &&
closestColumn . location . first _column === aliasLocation . parentLocation . first _column &&
closestColumn . location . last _column === aliasLocation . parentLocation . last _column ) {
parser . yy . locations [ parser . yy . locations . length - 1 ] . alias = alias ;
}
}
parser . yy . locations . push ( aliasLocation ) ;
} ;
parser . addTableAliasLocation = function ( location , alias , identifierChain ) {
parser . yy . locations . push ( {
type : 'alias' ,
source : 'table' ,
alias : alias ,
location : adjustLocationForCursor ( location ) ,
identifierChain : identifierChain
} ) ;
} ;
parser . addSubqueryAliasLocation = function ( location , alias ) {
parser . yy . locations . push ( {
type : 'alias' ,
source : 'subquery' ,
alias : alias ,
location : adjustLocationForCursor ( location )
} ) ;
} ;
parser . addAsteriskLocation = function ( location , identifierChain ) {
parser . yy . locations . push ( {
type : 'asterisk' ,
location : adjustLocationForCursor ( location ) ,
identifierChain : identifierChain
} ) ;
} ;
parser . addVariableLocation = function ( location , value ) {
if ( /\$\{[^}]*\}/ . test ( value ) ) {
parser . yy . locations . push ( {
type : 'variable' ,
location : adjustLocationForCursor ( location ) ,
value : value
} ) ;
}
} ;
parser . addColumnLocation = function ( location , identifierChain ) {
var isVariable = identifierChain . length && /\$\{[^}]*\}/ . test ( identifierChain [ identifierChain . length - 1 ] . name ) ;
if ( isVariable ) {
parser . yy . locations . push ( {
type : 'variable' ,
location : adjustLocationForCursor ( location ) ,
value : identifierChain [ identifierChain . length - 1 ] . name
} ) ;
} else {
parser . yy . locations . push ( {
type : 'column' ,
location : adjustLocationForCursor ( location ) ,
identifierChain : identifierChain ,
qualified : identifierChain . length > 1
} ) ;
}
} ;
parser . addCteAliasLocation = function ( location , alias ) {
parser . yy . locations . push ( {
type : 'alias' ,
source : 'cte' ,
alias : alias ,
location : adjustLocationForCursor ( location )
} ) ;
} ;
parser . addUnknownLocation = function ( location , identifierChain ) {
var isVariable = identifierChain . length && /\$\{[^}]*\}/ . test ( identifierChain [ identifierChain . length - 1 ] . name ) ;
var loc ;
if ( isVariable ) {
loc = {
type : 'variable' ,
location : adjustLocationForCursor ( location ) ,
value : identifierChain [ identifierChain . length - 1 ] . name
} ;
} else {
loc = {
type : 'unknown' ,
location : adjustLocationForCursor ( location ) ,
identifierChain : identifierChain ,
qualified : identifierChain . length > 1
} ;
}
parser . yy . locations . push ( loc ) ;
return loc ;
} ;
parser . addColRefToVariableIfExists = function ( left , right ) {
if ( left && left . columnReference && left . columnReference . length && right && right . columnReference && right . columnReference . length && parser . yy . locations . length > 1 ) {
var addColRefToVariableLocation = function ( variableValue , colRef ) {
// See if colref is actually an alias
if ( colRef . length === 1 && colRef [ 0 ] . name ) {
parser . yy . locations . some ( function ( location ) {
if ( location . type === 'column' && location . alias === colRef [ 0 ] . name ) {
colRef = location . identifierChain ;
return true ;
}
} ) ;
}
for ( var i = parser . yy . locations . length - 1 ; i > 0 ; i -- ) {
var location = parser . yy . locations [ i ] ;
if ( location . type === 'variable' && location . value === variableValue ) {
location . colRef = { identifierChain : colRef } ;
break ;
}
}
} ;
if ( /\$\{[^}]*\}/ . test ( left . columnReference [ 0 ] . name ) ) {
// left is variable
addColRefToVariableLocation ( left . columnReference [ 0 ] . name , right . columnReference ) ;
} else if ( /\$\{[^}]*\}/ . test ( right . columnReference [ 0 ] . name ) ) {
// right is variable
addColRefToVariableLocation ( right . columnReference [ 0 ] . name , left . columnReference ) ;
}
}
} ;
parser . suggestDatabases = function ( details ) {
parser . yy . result . suggestDatabases = details || { } ;
} ;
parser . suggestHdfs = function ( details ) {
parser . yy . result . suggestHdfs = details || { } ;
} ;
parser . suggestValues = function ( details ) {
parser . yy . result . suggestValues = details || { } ;
} ;
parser . determineCase = function ( text ) {
if ( ! parser . yy . caseDetermined ) {
parser . yy . lowerCase = text . toLowerCase ( ) === text ;
parser . yy . caseDetermined = true ;
}
} ;
parser . handleQuotedValueWithCursor = function ( lexer , yytext , yylloc , quoteChar ) {
if ( yytext . indexOf ( '\u2020' ) !== - 1 || yytext . indexOf ( '\u2021' ) !== - 1 ) {
parser . yy . partialCursor = yytext . indexOf ( '\u2021' ) !== - 1 ;
var cursorIndex = parser . yy . partialCursor ? yytext . indexOf ( '\u2021' ) : yytext . indexOf ( '\u2020' ) ;
parser . yy . cursorFound = {
first _line : yylloc . first _line ,
last _line : yylloc . last _line ,
first _column : yylloc . first _column + cursorIndex ,
last _column : yylloc . first _column + cursorIndex + 1
} ;
var remainder = yytext . substring ( cursorIndex + 1 ) ;
var remainingQuotes = ( lexer . upcomingInput ( ) . match ( new RegExp ( quoteChar , 'g' ) ) || [ ] ) . length ;
if ( remainingQuotes > 0 && remainingQuotes & 1 != 0 ) {
parser . yy . missingEndQuote = false ;
lexer . input ( ) ;
} else {
parser . yy . missingEndQuote = true ;
lexer . unput ( remainder ) ;
}
lexer . popState ( ) ;
return true ;
}
return false ;
} ;
var lexerModified = false ;
/ * *
* Main parser function
* /
parser . parseSql = function ( beforeCursor , afterCursor , dialect , debug ) {
// Jison counts CRLF as two lines in the locations
beforeCursor = beforeCursor . replace ( /\r\n|\n\r/gm , '\n' ) ;
afterCursor = afterCursor . replace ( /\r\n|\n\r/gm , '\n' ) ;
parser . yy . result = { locations : [ ] } ;
parser . yy . lowerCase = false ;
parser . yy . locations = [ ] ;
parser . yy . allLocations = [ ] ;
parser . yy . subQueries = [ ] ;
parser . yy . errors = [ ] ;
parser . yy . selectListAliases = [ ] ;
parser . yy . locationsStack = [ ] ;
parser . yy . primariesStack = [ ] ;
parser . yy . lateralViewsStack = [ ] ;
parser . yy . subQueriesStack = [ ] ;
parser . yy . resultStack = [ ] ;
parser . yy . selectListAliasesStack = [ ] ;
delete parser . yy . caseDetermined ;
delete parser . yy . cursorFound ;
delete parser . yy . partialCursor ;
parser . prepareNewStatement ( ) ;
var REASONABLE _SURROUNDING _LENGTH = 150000 ; // About 3000 lines before and after
if ( beforeCursor . length > REASONABLE _SURROUNDING _LENGTH ) {
if ( ( beforeCursor . length - beforeCursor . lastIndexOf ( ';' ) ) > REASONABLE _SURROUNDING _LENGTH ) {
// Bail out if the last complete statement is more than 150000 chars before
return { } ;
}
// Cut it at the first statement found within 150000 chars before
var lastReasonableChunk = beforeCursor . substring ( beforeCursor . length - REASONABLE _SURROUNDING _LENGTH ) ;
beforeCursor = lastReasonableChunk . substring ( lastReasonableChunk . indexOf ( ';' ) + 1 ) ;
}
if ( afterCursor . length > REASONABLE _SURROUNDING _LENGTH ) {
if ( ( afterCursor . length - afterCursor . indexOf ( ';' ) ) > REASONABLE _SURROUNDING _LENGTH ) {
// No need to bail out for what's comes after, we can still get keyword completion
afterCursor = '' ;
} else {
// Cut it at the last statement found within 150000 chars after
var firstReasonableChunk = afterCursor . substring ( 0 , REASONABLE _SURROUNDING _LENGTH ) ;
afterCursor = firstReasonableChunk . substring ( 0 , firstReasonableChunk . lastIndexOf ( ';' ) ) ;
}
}
parser . yy . partialLengths = parser . identifyPartials ( beforeCursor , afterCursor ) ;
if ( parser . yy . partialLengths . left > 0 ) {
beforeCursor = beforeCursor . substring ( 0 , beforeCursor . length - parser . yy . partialLengths . left ) ;
}
if ( parser . yy . partialLengths . right > 0 ) {
afterCursor = afterCursor . substring ( parser . yy . partialLengths . right ) ;
}
parser . yy . activeDialect = ( dialect !== 'hive' && dialect !== 'impala' ) ? undefined : dialect ;
// Hack to set the inital state of the lexer without first having to hit a token
// has to be done as the first token found can be dependant on dialect
if ( ! lexerModified ) {
var originalSetInput = parser . lexer . setInput ;
parser . lexer . setInput = function ( input , yy ) {
var lexer = originalSetInput . bind ( parser . lexer ) ( input , yy ) ;
if ( typeof parser . yy . activeDialect !== 'undefined' ) {
lexer . begin ( parser . yy . activeDialect ) ;
}
return lexer ;
} ;
lexerModified = true ;
}
var result ;
try {
// Add |CURSOR| or |PARTIAL_CURSOR| to represent the different cursor states in the lexer
result = parser . parse ( beforeCursor + ( beforeCursor . length == 0 || /[\s\(]$$/ . test ( beforeCursor ) ? ' \u2020 ' : '\u2021' ) + afterCursor ) ;
} catch ( err ) {
// On any error try to at least return any existing result
if ( typeof parser . yy . result === 'undefined' ) {
throw err ;
}
if ( debug ) {
console . log ( err ) ;
console . error ( err . stack ) ;
}
result = parser . yy . result ;
}
if ( parser . yy . errors . length > 0 ) {
parser . yy . result . errors = parser . yy . errors ;
if ( debug ) {
console . log ( parser . yy . errors ) ;
}
}
try {
linkTablePrimaries ( ) ;
parser . commitLocations ( ) ;
// Clean up and prioritize
prioritizeSuggestions ( ) ;
} catch ( err ) {
if ( debug ) {
console . log ( err ) ;
console . error ( err . stack ) ;
}
}
parser . yy . allLocations . sort ( function ( a , b ) {
if ( a . location . first _line !== b . location . first _line ) {
return a . location . first _line - b . location . first _line ;
}
if ( a . location . first _column !== b . location . first _column ) {
return a . location . first _column - b . location . first _column ;
}
if ( a . location . last _column !== b . location . last _column ) {
return b . location . last _column - a . location . last _column ;
}
return b . type . localeCompare ( a . type ) ;
} ) ;
parser . yy . result . locations = parser . yy . allLocations ;
parser . yy . result . locations . forEach ( function ( location ) {
delete location . linked ;
} ) ;
if ( typeof parser . yy . result . suggestColumns !== 'undefined' ) {
delete parser . yy . result . suggestColumns . linked ;
}
SIMPLE _TABLE _REF _SUGGESTIONS . forEach ( function ( suggestionType ) {
if ( typeof parser . yy . result [ suggestionType ] !== 'undefined' ) {
delete parser . yy . result [ suggestionType ] . linked ;
}
} ) ;
if ( typeof parser . yy . result . colRef !== 'undefined' ) {
delete parser . yy . result . colRef . linked ;
}
if ( typeof parser . yy . result . suggestKeyValues !== 'undefined' ) {
delete parser . yy . result . suggestKeyValues . linked ;
}
if ( typeof result . error !== 'undefined' && typeof result . error . expected !== 'undefined' ) {
// Remove any expected tokens from other dialects, jison doesn't remove tokens from other lexer states.
var actualExpected = { } ;
result . error . expected . forEach ( function ( expected ) {
var match = expected . match ( /\<([a-z]+)\>(.*)/ ) ;
if ( match !== null ) {
if ( typeof parser . yy . activeDialect !== 'undefined' && parser . yy . activeDialect === match [ 1 ] ) {
actualExpected [ ( "'" + match [ 2 ] ) ] = true ;
}
} else if ( expected . indexOf ( 'CURSOR' ) == - 1 ) {
actualExpected [ expected ] = true ;
}
} ) ;
result . error . expected = Object . keys ( actualExpected ) ;
}
if ( typeof result . error !== 'undefined' && result . error . recoverable ) {
delete result . error ;
}
// Adjust all the statement locations to include white space surrounding them
var lastStatementLocation = null ;
result . locations . forEach ( function ( location ) {
if ( location . type === 'statement' ) {
if ( lastStatementLocation === null ) {
location . location . first _line = 1 ;
location . location . first _column = 1 ;
} else {
location . location . first _line = lastStatementLocation . location . last _line ;
location . location . first _column = lastStatementLocation . location . last _column + 1 ;
}
lastStatementLocation = location ;
}
} ) ;
return result ;
} ;
} ;
var SYNTAX _PARSER _NOOP _FUNCTIONS = [ 'prepareNewStatement' , 'addCommonTableExpressions' , 'pushQueryState' , 'popQueryState' , 'suggestSelectListAliases' ,
'suggestValueExpressionKeywords' , 'getSelectListKeywords' , 'getValueExpressionKeywords' , 'addColRefIfExists' , 'selectListNoTableSuggest' , 'suggestJoinConditions' ,
'suggestJoins' , 'valueExpressionSuggest' , 'applyTypeToSuggestions' , 'applyArgumentTypesToSuggestions' , 'commitLocations' , 'identifyPartials' ,
'getSubQuery' , 'addTablePrimary' , 'suggestFileFormats' , 'suggestDdlAndDmlKeywords' , 'checkForSelectListKeywords' , 'checkForKeywords' ,
'suggestKeywords' , 'suggestColRefKeywords' , 'suggestTablesOrColumns' , 'suggestFunctions' , 'suggestAggregateFunctions' , 'suggestAnalyticFunctions' ,
'suggestColumns' , 'suggestGroupBys' , 'suggestIdentifiers' , 'suggestOrderBys' , 'suggestFilters' , 'suggestKeyValues' , 'suggestTables' , 'addFunctionLocation' ,
'addStatementLocation' , 'firstDefined' , 'addClauseLocation' , 'addStatementTypeLocation' , 'addFileLocation' , 'addDatabaseLocation' , 'addColumnAliasLocation' ,
'addTableAliasLocation' , 'addSubqueryAliasLocation' , 'addTableLocation' , 'addAsteriskLocation' , 'addVariableLocation' , 'addColumnLocation' , 'addCteAliasLocation' ,
'addUnknownLocation' , 'addColRefToVariableIfExists' , 'suggestDatabases' , 'suggestHdfs' , 'suggestValues' ] ;
var SYNTAX _PARSER _NOOP = function ( ) { } ;
var initSyntaxParser = function ( parser ) {
// Noop functions for compatibility with the autocomplete parser as the grammar is shared
SYNTAX _PARSER _NOOP _FUNCTIONS . forEach ( function ( noopFn ) {
parser [ noopFn ] = SYNTAX _PARSER _NOOP
} ) ;
parser . yy . locations = [ { } ] ;
parser . determineCase = function ( text ) {
if ( ! parser . yy . caseDetermined ) {
parser . yy . lowerCase = text . toLowerCase ( ) === text ;
parser . yy . caseDetermined = true ;
}
} ;
parser . getKeywordsForOptionalsLR = function ( ) {
return [ ] ;
} ;
parser . mergeSuggestKeywords = function ( ) {
return { } ;
} ;
parser . getTypeKeywords = function ( ) {
return [ ] ;
} ;
parser . getColumnDataTypeKeywords = function ( ) {
return [ ] ;
} ;
parser . findCaseType = function ( ) {
return { types : [ 'T' ] } ;
} ;
parser . findReturnTypes = function ( functionName ) {
return [ 'T' ] ;
} ;
parser . isHive = function ( ) {
return parser . yy . activeDialect === 'hive' ;
} ;
parser . isImpala = function ( ) {
return parser . yy . activeDialect === 'impala' ;
} ;
parser . expandImpalaIdentifierChain = function ( ) {
return [ ] ;
} ;
parser . expandIdentifierChain = function ( ) {
return [ ] ;
} ;
parser . expandLateralViews = function ( ) {
return [ ] ;
} ;
parser . createWeightedKeywords = function ( ) {
return [ ] ;
} ;
parser . handleQuotedValueWithCursor = function ( lexer , yytext , yylloc , quoteChar ) {
if ( yytext . indexOf ( '\u2020' ) !== - 1 || yytext . indexOf ( '\u2021' ) !== - 1 ) {
parser . yy . partialCursor = yytext . indexOf ( '\u2021' ) !== - 1 ;
var cursorIndex = parser . yy . partialCursor ? yytext . indexOf ( '\u2021' ) : yytext . indexOf ( '\u2020' ) ;
parser . yy . cursorFound = {
first _line : yylloc . first _line ,
last _line : yylloc . last _line ,
first _column : yylloc . first _column + cursorIndex ,
last _column : yylloc . first _column + cursorIndex + 1
} ;
var remainder = yytext . substring ( cursorIndex + 1 ) ;
var remainingQuotes = ( lexer . upcomingInput ( ) . match ( new RegExp ( quoteChar , 'g' ) ) || [ ] ) . length ;
if ( remainingQuotes > 0 && remainingQuotes & 1 != 0 ) {
parser . yy . missingEndQuote = false ;
lexer . input ( ) ;
} else {
parser . yy . missingEndQuote = true ;
lexer . unput ( remainder ) ;
}
lexer . popState ( ) ;
return true ;
}
return false ;
} ;
var lexerModified = false ;
parser . yy . parseError = function ( str , hash ) {
parser . yy . error = hash ;
} ;
var IGNORED _EXPECTED = {
';' : true ,
'.' : true ,
'EOF' : true ,
'UNSIGNED_INTEGER' : true ,
'UNSIGNED_INTEGER_E' : true ,
'REGULAR_IDENTIFIER' : true , // TODO: Indicate that an identifier was expected
'CURSOR' : true ,
'PARTIAL_CURSOR' : true ,
'HDFS_START_QUOTE' : true ,
'HDFS_PATH' : true ,
'HDFS_END_QUOTE' : true ,
'COMPARISON_OPERATOR' : true , // TODO: Expand in results when found
'ARITHMETIC_OPERATOR' : true , // TODO: Expand in results when found
'VARIABLE_REFERENCE' : true ,
'BACKTICK' : true ,
'VALUE' : true ,
'PARTIAL_VALUE' : true ,
'SINGLE_QUOTE' : true ,
'DOUBLE_QUOTE' : true
} ;
var CLEAN _EXPECTED = {
'BETWEEN_AND' : 'AND' ,
'OVERWRITE_DIRECTORY' : 'OVERWRITE' ,
'STORED_AS_DIRECTORIES' : 'STORED' ,
'LIKE_PARQUET' : 'LIKE' ,
'PARTITION_VALUE' : 'PARTITION'
} ;
parser . parseSyntax = function ( beforeCursor , afterCursor , dialect , debug ) {
parser . yy . caseDetermined = false ;
parser . yy . error = undefined ;
parser . yy . latestTablePrimaries = [ ] ;
parser . yy . subQueries = [ ] ;
parser . yy . selectListAliases = [ ] ;
parser . yy . latestTablePrimaries = [ ] ;
parser . yy . activeDialect = ( dialect !== 'hive' && dialect !== 'impala' ) ? undefined : dialect ;
// Hack to set the inital state of the lexer without first having to hit a token
// has to be done as the first token found can be dependant on dialect
if ( ! lexerModified ) {
var originalSetInput = parser . lexer . setInput ;
parser . lexer . setInput = function ( input , yy ) {
var lexer = originalSetInput . bind ( parser . lexer ) ( input , yy ) ;
if ( typeof parser . yy . activeDialect !== 'undefined' ) {
lexer . begin ( parser . yy . activeDialect ) ;
}
return lexer ;
} ;
lexerModified = true ;
}
// TODO: Find a way around throwing an exception when the parser finds a syntax error
try {
parser . yy . error = false ;
parser . parse ( beforeCursor + afterCursor ) ;
} catch ( err ) {
if ( debug ) {
console . log ( err ) ;
console . error ( err . stack ) ;
console . log ( parser . yy . error ) ;
}
}
if ( parser . yy . error && ( parser . yy . error . loc . last _column < beforeCursor . length || ! beforeCursor . endsWith ( parser . yy . error . text ) ) ) {
var weightedExpected = [ ] ;
var addedExpected = { } ;
var isLowerCase = parser . yy . caseDetermined && parser . yy . lowerCase || parser . yy . error . text . toLowerCase ( ) === parser . yy . error . text ;
if ( parser . yy . error . expected . length == 2 && parser . yy . error . expected . indexOf ( '\';\'' ) !== - 1 && parser . yy . error . expected . indexOf ( '\'EOF\'' ) !== - 1 ) {
parser . yy . error . expected = [ ] ;
parser . yy . error . expectedStatementEnd = true ;
return parser . yy . error ;
}
for ( var i = 0 ; i < parser . yy . error . expected . length ; i ++ ) {
var expected = parser . yy . error . expected [ i ] ;
// Strip away the surrounding ' chars
expected = expected . substring ( 1 , expected . length - 1 ) ;
// TODO: Only suggest alphanumeric?
if ( ! IGNORED _EXPECTED [ expected ] && /[a-z_]+/i . test ( expected ) ) {
if ( dialect && expected . indexOf ( '<' + dialect + '>' ) == 0 ) {
expected = expected . substring ( dialect . length + 2 ) ;
} else if ( /^<[a-z]+>/ . test ( expected ) ) {
continue ;
}
expected = CLEAN _EXPECTED [ expected ] || expected ;
if ( expected === parser . yy . error . text . toUpperCase ( ) ) {
// Can happen when the lexer entry for a rule contains multiple words like 'stored' in 'stored as parquet'
return false ;
}
var text = isLowerCase ? expected . toLowerCase ( ) : expected ;
if ( text && ! addedExpected [ text ] ) {
addedExpected [ text ] = true ;
weightedExpected . push ( {
text : text ,
distance : stringDistance ( parser . yy . error . text , text , true )
} ) ;
}
}
}
if ( weightedExpected . length === 0 ) {
parser . yy . error . expected = [ ] ;
parser . yy . error . incompleteStatement = true ;
return parser . yy . error ;
}
weightedExpected . sort ( function ( a , b ) {
if ( a . distance === b . distance ) {
return a . text . localeCompare ( b . text ) ;
}
return a . distance - b . distance
} ) ;
parser . yy . error . expected = weightedExpected ;
parser . yy . error . incompleteStatement = true ;
return parser . yy . error ;
} else if ( parser . yy . error ) {
parser . yy . error . expected = [ ] ;
parser . yy . error . incompleteStatement = true ;
return parser . yy . error ;
}
return false ;
}
} ;
var initGlobalSearchParser = function ( parser ) {
parser . identifyPartials = function ( beforeCursor , afterCursor ) {
var beforeMatch = beforeCursor . match ( /[0-9a-zA-Z_]*$/ ) ;
var afterMatch = afterCursor . match ( /^[0-9a-zA-Z_]*(?:\((?:[^)]*\))?)?/ ) ;
return { left : beforeMatch ? beforeMatch [ 0 ] . length : 0 , right : afterMatch ? afterMatch [ 0 ] . length : 0 } ;
} ;
parser . mergeFacets = function ( a , b ) {
if ( ! a . facets ) {
a . facets = { } ;
}
if ( ! b . facets ) {
return ;
}
Object . keys ( b . facets ) . forEach ( function ( key ) {
if ( a . facets [ key ] ) {
Object . keys ( b . facets [ key ] ) . forEach ( function ( val ) {
a . facets [ key ] [ val . toLowerCase ( ) ] = true ;
} ) ;
} else {
a . facets [ key ] = b . facets [ key ] ;
}
} ) ;
} ;
parser . mergeText = function ( a , b ) {
if ( ! a . text ) {
a . text = [ ] ;
}
if ( ! b . text ) {
return ;
}
a . text = a . text . concat ( b . text ) ;
} ;
parser . handleQuotedValueWithCursor = function ( lexer , yytext , yylloc , quoteChar ) {
if ( yytext . indexOf ( '\u2020' ) !== - 1 || yytext . indexOf ( '\u2021' ) !== - 1 ) {
var cursorIndex = yytext . indexOf ( '\u2020' ) ;
parser . yy . cursorFound = {
first _line : yylloc . first _line ,
last _line : yylloc . last _line ,
first _column : yylloc . first _column + cursorIndex ,
last _column : yylloc . first _column + cursorIndex + 1
} ;
var remainder = yytext . substring ( cursorIndex + 1 ) ;
var remainingQuotes = ( lexer . upcomingInput ( ) . match ( new RegExp ( quoteChar , 'g' ) ) || [ ] ) . length ;
if ( remainingQuotes > 0 && remainingQuotes & 1 != 0 ) {
parser . yy . missingEndQuote = false ;
lexer . input ( ) ;
} else {
parser . yy . missingEndQuote = true ;
lexer . unput ( remainder ) ;
}
lexer . popState ( ) ;
return true ;
}
return false ;
} ;
parser . parseGlobalSearch = function ( beforeCursor , afterCursor , debug ) {
delete parser . yy . cursorFound ;
var result ;
try {
result = parser . parse ( beforeCursor + '\u2020' + afterCursor ) ;
} catch ( err ) {
if ( debug ) {
console . log ( err ) ;
console . error ( err . stack ) ;
console . log ( parser . yy . error ) ;
}
return {
facets : { } ,
text : [ ]
}
}
return result ;
} ;
} ;
return {
initSqlParser : initSqlParser ,
initSyntaxParser : initSyntaxParser ,
stringDistance : stringDistance ,
initGlobalSearchParser : initGlobalSearchParser
} ;
} ) ( ) ;
/* parser generated by jison 0.4.18 */
/ *
Returns a Parser object of the following structure :
Parser : {
yy : { }
}
Parser . prototype : {
yy : { } ,
trace : function ( ) ,
symbols _ : { associative list : name == > number } ,
terminals _ : { associative list : number == > name } ,
productions _ : [ ... ] ,
performAction : function anonymous ( yytext , yyleng , yylineno , yy , yystate , $$ , _$ ) ,
table : [ ... ] ,
defaultActions : { ... } ,
parseError : function ( str , hash ) ,
parse : function ( input ) ,
lexer : {
EOF : 1 ,
parseError : function ( str , hash ) ,
setInput : function ( input ) ,
input : function ( ) ,
unput : function ( str ) ,
more : function ( ) ,
less : function ( n ) ,
pastInput : function ( ) ,
upcomingInput : function ( ) ,
showPosition : function ( ) ,
test _match : function ( regex _match _array , rule _index ) ,
next : function ( ) ,
lex : function ( ) ,
begin : function ( condition ) ,
popState : function ( ) ,
_currentRules : function ( ) ,
topState : function ( ) ,
pushState : function ( condition ) ,
options : {
ranges : boolean ( optional : true == > token location info will include a . range [ ] member )
flex : boolean ( optional : true == > flex - like lexing behaviour where the rules are tested exhaustively to find the longest match )
backtrack _lexer : boolean ( optional : true == > lexer regexes are tested in order and for each matching regex the action code is invoked ; the lexer terminates the scan when a token is returned by the action code )
} ,
performAction : function ( yy , yy _ , $avoiding _name _collisions , YY _START ) ,
rules : [ ... ] ,
conditions : { associative list : name == > set } ,
}
}
token location info ( @ $ , _$ , etc . ) : {
first _line : n ,
last _line : n ,
first _column : n ,
last _column : n ,
range : [ start _number , end _number ] ( where the numbers are indexes into the input string , regular zero - based )
}
the parseError function receives a 'hash' object with these members for lexer and parser errors : {
text : ( matched text )
token : ( the produced terminal token , if any )
line : ( yylineno )
}
while parser ( grammar ) errors will also provide these members , i . e . parser errors deliver a superset of attributes : {
loc : ( yylloc )
expected : ( string describing the set of expected tokens )
recoverable : ( boolean : TRUE when the parser has a error recovery rule available for this particular error )
}
* /
var sqlSyntaxParser = ( function ( ) {
2018-12-29 11:47:29 +08:00
var o = function ( k , v , o , l ) { for ( o = o || { } , l = k . length ; l -- ; o [ k [ l ] ] = v ) ; return o } , $V0 = [ 6 , 10 , 25 , 29 , 57 , 58 , 73 , 78 , 79 , 96 , 112 , 130 , 144 , 162 , 182 , 218 , 307 , 339 , 352 , 438 , 439 , 440 , 452 , 569 , 570 , 571 , 577 , 760 , 816 , 859 , 921 , 922 , 924 , 1160 , 1184 , 1185 , 1186 , 1187 , 1189 , 1207 , 1221 , 1246 , 1247 , 1273 , 1309 ] , $V1 = [ 2 , 4 ] , $V2 = [ 6 , 10 ] , $V3 = [ 2 , 5 ] , $V4 = [ 1 , 64 ] , $V5 = [ 1 , 44 ] , $V6 = [ 1 , 33 ] , $V7 = [ 1 , 99 ] , $V8 = [ 1 , 129 ] , $V9 = [ 1 , 140 ] , $Va = [ 1 , 108 ] , $Vb = [ 1 , 109 ] , $Vc = [ 1 , 137 ] , $Vd = [ 1 , 122 ] , $Ve = [ 1 , 66 ] , $Vf = [ 1 , 34 ] , $Vg = [ 1 , 65 ] , $Vh = [ 1 , 92 ] , $Vi = [ 1 , 138 ] , $Vj = [ 1 , 69 ] , $Vk = [ 1 , 102 ] , $Vl = [ 1 , 133 ] , $Vm = [ 1 , 134 ] , $Vn = [ 1 , 135 ] , $Vo = [ 1 , 110 ] , $Vp = [ 1 , 104 ] , $Vq = [ 1 , 131 ] , $Vr = [ 1 , 132 ] , $Vs = [ 1 , 101 ] , $Vt = [ 1 , 119 ] , $Vu = [ 1 , 105 ] , $Vv = [ 1 , 116 ] , $Vw = [ 1 , 45 ] , $Vx = [ 1 , 46 ] , $Vy = [ 1 , 47 ] , $Vz = [ 1 , 91 ] , $VA = [ 1 , 125 ] , $VB = [ 1 , 100 ] , $VC = [ 1 , 144 ] , $VD = [ 1 , 67 ] , $VE = [ 1 , 68 ] , $VF = [ 1 , 126 ] , $VG = [ 1 , 143 ] , $VH = [ 1 , 130 ] , $VI = [ 1 , 98 ] , $VJ = [ 1 , 136 ] , $VK = [ 1 , 121 ] , $VL = [ 6 , 10 , 399 , 951 ] , $VM = [ 2 , 866 ] , $VN = [ 1 , 153 ] , $VO = [ 1 , 155 ] , $VP = [ 1 , 158 ] , $VQ = [ 25 , 29 , 58 , 73 , 78 , 79 , 96 , 112 , 130 , 144 , 182 , 218 , 307 , 339 , 352 , 438 , 439 , 440 , 452 , 569 , 570 , 571 , 577 , 760 , 816 , 859 , 921 , 922 , 924 , 1160 , 1184 , 1185 , 1186 , 1187 , 1189 , 1207 , 1221 , 1246 , 1247 , 1273 , 1309 ] , $VR = [ 1 , 172 ] , $VS = [ 1 , 173 ] , $VT = [ 1 , 174 ] , $VU = [ 1 , 175 ] , $VV = [ 1 , 176 ] , $VW = [ 1 , 177 ] , $VX = [ 1 , 178 ] , $VY = [ 1 , 179 ] , $VZ = [ 1 , 180 ] , $V _ = [ 1 , 181 ] , $V$ = [ 1 , 182 ] , $V01 = [ 1 , 183 ] , $V11 = [ 1 , 184 ] , $V21 = [ 1 , 185 ] , $V31 = [ 1 , 186 ] , $V41 = [ 1 , 187 ] , $V51 = [ 1 , 188 ] , $V61 = [ 1 , 189 ] , $V71 = [ 1 , 190 ] , $V81 = [ 1 , 191 ] , $V91 = [ 1 , 192 ] , $Va1 = [ 1 , 193 ] , $Vb1 = [ 1 , 194 ] , $Vc1 = [ 1 , 195 ] , $Vd1 = [ 1 , 196 ] , $Ve1 = [ 1 , 197 ] , $Vf1 = [ 1 , 198 ] , $Vg1 = [ 1 , 199 ] , $Vh1 = [ 1 , 200 ] , $Vi1 = [ 1 , 201 ] , $Vj1 = [ 1 , 202 ] , $Vk1 = [ 1 , 203 ] , $Vl1 = [ 1 , 204 ] , $Vm1 = [ 1 , 205 ] , $Vn1 = [ 1 , 206 ] , $Vo1 = [ 1 , 207 ] , $Vp1 = [ 1 , 208 ] , $Vq1 = [ 1 , 209 ] , $Vr1 = [ 1 , 210 ] , $Vs1 = [ 1 , 211 ] , $Vt1 = [ 1 , 212 ] , $Vu1 = [ 1 , 213 ] , $Vv1 = [ 1 , 214 ] , $Vw1 = [ 1 , 215 ] , $Vx1 = [ 1 , 216 ] , $Vy1 = [ 1 , 217 ] , $Vz1 = [ 1 , 218 ] , $VA1 = [ 1 , 219 ] , $VB1 = [ 1 , 220 ] , $VC1 = [ 1 , 221 ] , $VD1 = [ 1 , 222 ] , $VE1 = [ 1 , 223 ] , $VF1 = [ 1 , 224 ] , $VG1 = [ 1 , 225 ] , $VH1 = [ 1 , 226 ] , $VI1 = [ 1 , 227 ] , $VJ1 = [ 1 , 228 ] , $VK1 = [ 1 , 229 ] , $VL1 = [ 1 , 230 ] , $VM1 = [ 1 , 231 ] , $VN1 = [ 1 , 232 ] , $VO1 = [ 1 , 233 ] , $VP1 = [ 1 , 234 ] , $VQ1 = [ 1 , 235 ] , $VR1 = [ 1 , 236 ] , $VS1 = [ 1 , 237 ] , $VT1 = [ 1 , 238 ] , $VU1 = [ 1 , 239 ] , $VV1 = [ 1 , 240 ] , $VW1 = [ 1 , 241 ] , $VX1 = [ 1 , 242 ] , $VY1 = [ 1 , 243 ] , $VZ1 = [ 1 , 244 ] , $V _1 = [ 1 , 245 ] , $V$1 = [ 1 , 246 ] , $V02 = [ 1 , 247 ] , $V12 = [ 1 , 248 ] , $V22 = [ 1 , 249 ] , $V32 = [ 1 , 250 ] , $V42 = [ 1 , 251 ] , $V52 = [ 1 , 252 ] , $V62 = [ 1 , 253 ] , $V72 = [ 1 , 254 ] , $V82 = [ 1 , 255 ] , $V92 = [ 1 , 256 ] , $Va2 = [ 1 , 257 ] , $Vb2 = [ 1 , 258 ] , $Vc2 = [ 1 , 259 ] , $Vd2 = [ 1 , 260 ] , $Ve2 = [ 1 , 261 ] , $Vf2 = [ 1 , 262 ] , $Vg2 = [ 1 , 263 ] , $Vh2 = [ 1 , 264 ] , $Vi2 = [ 1 , 265 ] , $Vj2 = [ 1 , 266 ] , $Vk2 = [ 1 , 267 ] , $Vl2 = [ 1 , 268 ] , $Vm2 = [ 1 , 269 ] , $Vn2 = [ 1 , 270 ] , $Vo2 = [ 1 , 271 ] , $Vp2 = [ 1 , 272 ] , $Vq2 = [ 1 , 273 ] , $Vr2 = [ 1 , 274 ] , $Vs2 = [ 1 , 275 ] , $Vt2 = [ 1 , 276 ] , $Vu2 = [ 1 , 277 ] , $Vv2 = [ 1 , 278 ] , $Vw2 = [ 1 , 279 ] , $Vx2 = [ 1 , 280 ] , $Vy2 = [ 1 , 281 ] , $Vz2 = [ 1 , 282 ] , $VA2 = [ 1 , 283 ] , $VB2 = [ 1 , 284 ] , $VC2 = [ 1 , 285 ] , $VD2 = [ 1 , 286 ] , $VE2 = [ 1 , 287 ] , $VF2 = [ 1 , 288 ] , $VG2 = [ 1 , 289 ] , $VH2 = [ 1 , 290 ] , $VI2 = [ 1 , 291 ] , $VJ2 = [ 1 , 292 ] , $VK2 = [ 1 , 293 ] , $VL2 = [ 1 , 294 ] , $VM2 = [ 1 , 295 ] , $VN2 = [ 1 , 296 ] , $VO2 = [ 1 , 297 ] , $VP2 = [ 1 , 298 ] , $VQ2 = [ 1 , 299 ] , $VR2 = [ 1 , 300 ] , $VS2 = [ 1 , 301 ] , $VT2 = [ 1 , 302 ] , $VU2 = [ 1 , 303 ] , $VV2 = [ 1 , 304 ] , $VW2 = [ 1 , 169 ] , $VX2 = [ 1 , 170 ] , $VY2 = [ 1 , 168 ] , $VZ2 = [ 1 , 325 ] , $V _2 = [ 1 , 323 ] , $V$2 = [ 1 , 324 ] , $V03 = [ 1 , 322 ] , $V13 = [ 1 , 320 ] , $V23 = [ 1 , 316 ] , $V33 = [ 1 , 319 ] , $V43 = [ 1 , 321 ] , $V53 = [ 1 , 318 ] , $V63 = [ 1 , 315 ] , $V73 = [ 1 , 317 ] , $V83 = [ 1 , 328 ] , $V93 = [ 1 , 330 ] , $Va3 = [ 1 , 334 ] , $Vb3 = [ 1 , 329 ] , $Vc3 = [ 1 , 331 ] , $Vd3 = [ 1 , 333 ] , $Ve3 = [ 1 , 332 ] , $Vf3 = [ 1 , 358 ] , $Vg3 = [ 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 118 , 119 , 120 , 121 , 122 , 123 , 124 , 125 , 126 , 127 , 128 , 129 , 130 , 131 , 132 , 133 , 134 , 135 , 136 , 137 , 138 , 139 , 140 , 141 , 142 , 143 , 144 , 145 , 146 , 147 , 148 , 149 , 150 , 151 , 152 , 153 , 154 , 155 , 156 , 157 , 159 , 160 , 168 , 207 , 236 , 260 , 281 , 285 , 292 , 303 , 304 , 311 , 321 , 322 , 323 , 346 , 353 , 354 , 355 , 356 , 357 , 358 , 359 , 360 , 361 , 362 , 363 , 364 , 365 , 366 , 367 , 368 , 370 , 371 , 372 , 373 , 374 , 375 , 376 , 377 , 378 , 379 , 380 , 381 , 382 , 383 , 391 , 392 , 395 , 396 , 397 , 398 , 402 , 403 , 404 , 759 , 760 , 791 ] , $Vh3 = [ 2 , 901 ] , $Vi3 = [ 1 , 373 ] , $Vj3 = [ 1 , 374 ] , $Vk3 = [ 1 , 375 ] , $Vl3 = [ 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 118 , 119 ,
2018-08-16 18:02:51 +08:00
var parser = { trace : function trace ( ) { } ,
yy : { } ,
2018-12-10 16:10:37 +08:00
symbols _ : { "error" : 2 , "SqlSyntax" : 3 , "NewStatement" : 4 , "SqlStatements" : 5 , "EOF" : 6 , "SqlAutocomplete" : 7 , "SqlStatements_EDIT" : 8 , "SqlStatement" : 9 , ";" : 10 , "SqlStatement_EDIT" : 11 , "DataDefinition" : 12 , "DataManipulation" : 13 , "QuerySpecification" : 14 , "ExplainClause" : 15 , "AnyCursor" : 16 , "CommonTableExpression" : 17 , "CURSOR" : 18 , "ExplainClause_EDIT" : 19 , "DataDefinition_EDIT" : 20 , "DataManipulation_EDIT" : 21 , "QuerySpecification_EDIT" : 22 , "SetSpecification_EDIT" : 23 , "NonReservedKeyword" : 24 , "<hive>ABORT" : 25 , "<hive>ADD" : 26 , "<hive>ADMIN" : 27 , "<hive>AFTER" : 28 , "<hive>ANALYZE" : 29 , "<hive>ARCHIVE" : 30 , "<hive>AVRO" : 31 , "<hive>BUCKET" : 32 , "<hive>BUCKETS" : 33 , "<hive>CASCADE" : 34 , "<hive>CHANGE" : 35 , "<hive>CLUSTERED" : 36 , "<hive>COLLECTION" : 37 , "<hive>COLUMNS" : 38 , "<hive>COMMENT" : 39 , "<hive>COMPACT" : 40 , "<hive>COMPACTIONS" : 41 , "<hive>COMPUTE" : 42 , "<hive>CONCATENATE" : 43 , "<hive>DATA" : 44 , "<hive>DATABASES" : 45 , "<hive>DBPROPERTIES" : 46 , "<hive>DEFERRED" : 47 , "<hive>DEFINED" : 48 , "<hive>DELIMITED" : 49 , "<hive>DEPENDENCY" : 50 , "<hive>DIRECTORY" : 51 , "<hive>DISABLE" : 52 , "<hive>DOUBLE_PRECISION" : 53 , "<hive>ENABLE" : 54 , "<hive>ESCAPED" : 55 , "<hive>EXCHANGE" : 56 , "<hive>EXPLAIN" : 57 , "<hive>EXPORT" : 58 , "<hive>FIELDS" : 59 , "<hive>FILE" : 60 , "<hive>FILEFORMAT" : 61 , "<hive>FIRST" : 62 , "<hive>FORMAT" : 63 , "<hive>FUNCTIONS" : 64 , "<hive>INPATH" : 65 , "<hive>INPUTFORMAT" : 66 , "<hive>JAR" : 67 , "<hive>IDXPROPERTIES" : 68 , "<hive>ITEMS" : 69 , "<hive>KEY" : 70 , "<hive>KEYS" : 71 , "<hive>LINES" : 72 , "<hive>LOAD" : 73 , "<hive>LOCATION" : 74 , "<hive>LOCKS" : 75 , "<hive>MATCHED" : 76 , "<hive>METADATA" : 77 , "<hive>MERGE" : 78 , "<hive>MSCK" : 79 , "<hive>NOSCAN" : 80 , "<hive>NOVALIDATE" : 81 , "<hive>NO_DROP" : 82 , "<hive>OFFLINE" : 83 , "<hive>ORC" : 84 , "<hive>OUTPUTFORMAT" : 85 , "<hive>OVERWRITE" : 86 , "<hive>OWNER" : 87 , "<hive>PARQUET" : 88 , "<hive>PARTITIONED" : 89 , "<hive>PARTITIONS" : 90 , "<hive>PERCENT" : 91 , "<hive>PRIVILEGES" : 92 , "<hive>PURGE" : 93 , "<hive>RCFILE" : 94 , "<hive>REBUILD" : 95 , "<hive>RELOAD" : 96 , "<hive>RELY" : 97 , "<hive>NORELY" : 98 , "<hive>REPAIR" : 99 , "<hive>REPLICATION" : 100 , "<hive>RECOVER" : 101 , "<hive>RENAME" : 102 , "<hive>REPLACE" : 103 , "<hive>RESTRICT" : 104 , "<hive>ROLE" : 105 , "<hive>ROLES" : 106 , "<hive>SCHEMAS" : 107 , "<hive>SEQUENCEFILE" : 108 , "<hive>SERDE" : 109 , "<hive>SERDEPROPERTIES" : 110 , "<hive>SETS" : 111 , "<hive>SHOW" : 112 , "<hive>SKEWED" : 113 , "<hive>SORTED" : 114 , "<hive>STATISTICS" : 115 , "<hive>STORED" : 116 , "<hive>STRING" : 117 , "STRUCT" : 118 , "<hive>TABLES" : 119 , "<hive>TBLPROPERTIES" : 120 , "<hive>TEMPORARY" : 121 , "<hive>TERMINATED" : 122 , "<hive>TEXTFILE" : 123 , "<hive>TIMESTAMP" : 124 , "<hive>TINYINT" : 125 , "<hive>TOUCH" : 126 , "<hive>TRANSACTIONS" : 127 , "<hive>UNARCHIVE" : 128 , "<hive>UNIONTYPE" : 129 , "<hive>USE" : 130 , "<hive>USER" : 131 , "<hive>VIEW" : 132 , "<hive>WAIT" : 133 , "<hive>DAY" : 134 , "<hive>HOUR" : 135 , "<hive>MINUTE" : 136 , "<hive>MONTH" : 137 , "<hive>QUARTER" : 138 , "<hive>SECOND" : 139 , "<hive>WEEK" : 140 , "<hive>YEAR" : 141 , "<impala>ANALYTIC" : 142 , "<impala>CURRENT" : 143 , "<impala>GRANT" : 144 , "<impala>RECOVER" : 145 , "<impala>ROLE" : 146 , "<impala>ROLES" : 147 , "<impala>URI" : 148 , "<impala>SERVER" : 149 , "<impala>UNKNOWN" : 150 , "<impala>BLOCK_SIZE" : 151 , "<impala>COMPRESSION" : 152 , "<impala>DEFAULT" : 153 , "<impala>ENCODING" : 154 , "<impala>KEY" : 155 , "ROLE" : 156 , "OPTION" : 157 , "RegularIdentifier" : 158 , "REGULAR_IDENTIFIER" : 159 , "VARIABLE_REFERENCE" : 160 , "OptionalHiveExplainTypes" : 161 , "<impala>EXPLAIN" : 162 , "<hive>AUTHORIZATION" : 163 , "<hive>EXTENDED" : 164 , "NonStartingToken" : 165 , "<hive>ALL" : 166 , "<hive>AS" : 167 , "<hive>BINARY" : 168 , "<hive>CACHE" : 169 , "<hive>CLUSTER" : 170 , "<hive>CONF" : 171 , "<hive>CONSTRAINT" : 172 , "<hive>CUBE" : 173 , "<hive>CURRENT" : 174 , "<hive>DATE" : 175 , "<hive>DISTRIBUTE" : 176 , "<hive>DISTRIBUTED" : 177 , "<hive>EXTERNAL" : 178 , "<hive>FOR" : 179 , "<hive>FOREIGN" : 180 , "<hive>FUNCTION" : 181 , "<hive>GRANT" : 182 , "<hive>GROUPING" : 183 , "<hive>LATERAL" : 184 , "<hive>LOCAL" : 185 , "<hive>LOCK" : 186 , "<hive>MACRO" : 187 , "<hive>PARTITION" : 188 , "<hive>PRIMARY" : 189 , "<hive>REFERENCES" : 190 , "<hive>ROLLUP" : 191 , "<hive>SHOW_DATABASE" : 192 , "<hive>TABLE" : 193 , "<hive>ASC" : 194 , "<hive>FORMATTED" : 195 , "<hive>INDEX" : 196 , "<hive>INDEXES" : 197 , "<hive>NONE" : 198 , "<hive>OF" : 199 , "<hive>OUT" : 200 , "<hive>SCHEMA" : 201 , "<hive>STORED_AS_DIRECTORIES" : 202 , "<hive>TABLESAMPLE" : 203 , "<hive>USING" : 204 , "<hive>VIEWS" : 205 , "<hive>WINDOW" : 206 , "<hive>." : 207 , "<hive>[" : 208 , "<hive>]" : 209 , " < impala
terminals _ : { 2 : "error" , 6 : "EOF" , 10 : ";" , 18 : "CURSOR" , 23 : "SetSpecification_EDIT" , 25 : "<hive>ABORT" , 26 : "<hive>ADD" , 27 : "<hive>ADMIN" , 28 : "<hive>AFTER" , 29 : "<hive>ANALYZE" , 30 : "<hive>ARCHIVE" , 31 : "<hive>AVRO" , 32 : "<hive>BUCKET" , 33 : "<hive>BUCKETS" , 34 : "<hive>CASCADE" , 35 : "<hive>CHANGE" , 36 : "<hive>CLUSTERED" , 37 : "<hive>COLLECTION" , 38 : "<hive>COLUMNS" , 39 : "<hive>COMMENT" , 40 : "<hive>COMPACT" , 41 : "<hive>COMPACTIONS" , 42 : "<hive>COMPUTE" , 43 : "<hive>CONCATENATE" , 44 : "<hive>DATA" , 45 : "<hive>DATABASES" , 46 : "<hive>DBPROPERTIES" , 47 : "<hive>DEFERRED" , 48 : "<hive>DEFINED" , 49 : "<hive>DELIMITED" , 50 : "<hive>DEPENDENCY" , 51 : "<hive>DIRECTORY" , 52 : "<hive>DISABLE" , 53 : "<hive>DOUBLE_PRECISION" , 54 : "<hive>ENABLE" , 55 : "<hive>ESCAPED" , 56 : "<hive>EXCHANGE" , 57 : "<hive>EXPLAIN" , 58 : "<hive>EXPORT" , 59 : "<hive>FIELDS" , 60 : "<hive>FILE" , 61 : "<hive>FILEFORMAT" , 62 : "<hive>FIRST" , 63 : "<hive>FORMAT" , 64 : "<hive>FUNCTIONS" , 65 : "<hive>INPATH" , 66 : "<hive>INPUTFORMAT" , 67 : "<hive>JAR" , 68 : "<hive>IDXPROPERTIES" , 69 : "<hive>ITEMS" , 70 : "<hive>KEY" , 71 : "<hive>KEYS" , 72 : "<hive>LINES" , 73 : "<hive>LOAD" , 74 : "<hive>LOCATION" , 75 : "<hive>LOCKS" , 76 : "<hive>MATCHED" , 77 : "<hive>METADATA" , 78 : "<hive>MERGE" , 79 : "<hive>MSCK" , 80 : "<hive>NOSCAN" , 81 : "<hive>NOVALIDATE" , 82 : "<hive>NO_DROP" , 83 : "<hive>OFFLINE" , 84 : "<hive>ORC" , 85 : "<hive>OUTPUTFORMAT" , 86 : "<hive>OVERWRITE" , 87 : "<hive>OWNER" , 88 : "<hive>PARQUET" , 89 : "<hive>PARTITIONED" , 90 : "<hive>PARTITIONS" , 91 : "<hive>PERCENT" , 92 : "<hive>PRIVILEGES" , 93 : "<hive>PURGE" , 94 : "<hive>RCFILE" , 95 : "<hive>REBUILD" , 96 : "<hive>RELOAD" , 97 : "<hive>RELY" , 98 : "<hive>NORELY" , 99 : "<hive>REPAIR" , 100 : "<hive>REPLICATION" , 101 : "<hive>RECOVER" , 102 : "<hive>RENAME" , 103 : "<hive>REPLACE" , 104 : "<hive>RESTRICT" , 105 : "<hive>ROLE" , 106 : "<hive>ROLES" , 107 : "<hive>SCHEMAS" , 108 : "<hive>SEQUENCEFILE" , 109 : "<hive>SERDE" , 110 : "<hive>SERDEPROPERTIES" , 111 : "<hive>SETS" , 112 : "<hive>SHOW" , 113 : "<hive>SKEWED" , 114 : "<hive>SORTED" , 115 : "<hive>STATISTICS" , 116 : "<hive>STORED" , 117 : "<hive>STRING" , 118 : "STRUCT" , 119 : "<hive>TABLES" , 120 : "<hive>TBLPROPERTIES" , 121 : "<hive>TEMPORARY" , 122 : "<hive>TERMINATED" , 123 : "<hive>TEXTFILE" , 124 : "<hive>TIMESTAMP" , 125 : "<hive>TINYINT" , 126 : "<hive>TOUCH" , 127 : "<hive>TRANSACTIONS" , 128 : "<hive>UNARCHIVE" , 129 : "<hive>UNIONTYPE" , 130 : "<hive>USE" , 131 : "<hive>USER" , 132 : "<hive>VIEW" , 133 : "<hive>WAIT" , 134 : "<hive>DAY" , 135 : "<hive>HOUR" , 136 : "<hive>MINUTE" , 137 : "<hive>MONTH" , 138 : "<hive>QUARTER" , 139 : "<hive>SECOND" , 140 : "<hive>WEEK" , 141 : "<hive>YEAR" , 142 : "<impala>ANALYTIC" , 143 : "<impala>CURRENT" , 144 : "<impala>GRANT" , 145 : "<impala>RECOVER" , 146 : "<impala>ROLE" , 147 : "<impala>ROLES" , 148 : "<impala>URI" , 149 : "<impala>SERVER" , 150 : "<impala>UNKNOWN" , 151 : "<impala>BLOCK_SIZE" , 152 : "<impala>COMPRESSION" , 153 : "<impala>DEFAULT" , 154 : "<impala>ENCODING" , 155 : "<impala>KEY" , 156 : "ROLE" , 157 : "OPTION" , 159 : "REGULAR_IDENTIFIER" , 160 : "VARIABLE_REFERENCE" , 162 : "<impala>EXPLAIN" , 163 : "<hive>AUTHORIZATION" , 164 : "<hive>EXTENDED" , 166 : "<hive>ALL" , 167 : "<hive>AS" , 168 : "<hive>BINARY" , 169 : "<hive>CACHE" , 170 : "<hive>CLUSTER" , 171 : "<hive>CONF" , 172 : "<hive>CONSTRAINT" , 173 : "<hive>CUBE" , 174 : "<hive>CURRENT" , 175 : "<hive>DATE" , 176 : "<hive>DISTRIBUTE" , 177 : "<hive>DISTRIBUTED" , 178 : "<hive>EXTERNAL" , 179 : "<hive>FOR" , 180 : "<hive>FOREIGN" , 181 : "<hive>FUNCTION" , 182 : "<hive>GRANT" , 183 : "<hive>GROUPING" , 184 : "<hive>LATERAL" , 185 : "<hive>LOCAL" , 186 : "<hive>LOCK" , 187 : "<hive>MACRO" , 188 : "<hive>PARTITION" , 189 : "<hive>PRIMARY" , 190 : "<hive>REFERENCES" , 191 : "<hive>ROLLUP" , 192 : "<hive>SHOW_DATABASE" , 193 : "<hive>TABLE" , 194 : "<hive>ASC" , 195 : "<hive>FORMATTED" , 196 : "<hive>INDEX" , 197 : "<hive>INDEXES" , 198 : "<hive>NONE" , 199 : "<hive>OF" , 200 : "<hive>OUT" , 201 : "<hive>SCHEMA" , 202 : "<hive>STORED_AS_DIRECTORIES" , 203 : "<hive>TABLESAMPLE" , 204 : "<hive>USING" , 205 : "<hive>VIEWS" , 206 : "<hive>WINDOW" , 207 : "<hive>." , 208 : "<hive>[" , 209 : "<hive>]" , 210 : "<impala>AGGREGATE" , 211 : "<impala>AVRO" , 212 : "<impala>CACHED" , 213 : "<impala>CASCADE" , 214 : "<impala>CLOSE_FN" , 215 : "<impala>COLUMN" , 216 : "<impala>DATA" , 217 : "<impala>DATABASES" , 218 : "<impala>DELETE" , 219 : "<impala>DELIMITED" , 220 : "<impala>ESCAPED" , 221 : "<impala>EXTENDED" , 222 : "<impala>EXTERNAL" , 223 : "<impala>FIELDS" , 224 : "<impala>FILES" , 225 : "<impala>FINALIZE_FN" , 226 : "<impala>FIRST" , 227 : "<impala>FORMAT" , 228 : "<impala>FORMATTED" , 229 : "<impala>FUNCTION" , 230 : "<impala>FUNCTIONS" , 231 : " < i
2018-12-29 11:47:29 +08:00
productions _ : [ 0 , [ 3 , 3 ] , [ 7 , 3 ] , [ 7 , 3 ] , [ 4 , 0 ] , [ 5 , 0 ] , [ 5 , 1 ] , [ 5 , 4 ] , [ 8 , 1 ] , [ 8 , 4 ] , [ 8 , 4 ] , [ 8 , 7 ] , [ 9 , 1 ] , [ 9 , 1 ] , [ 9 , 1 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 9 , 2 ] , [ 11 , 1 ] , [ 11 , 2 ] , [ 11 , 1 ] , [ 11 , 1 ] , [ 11 , 1 ] , [ 11 , 1 ] , [ 11 , 1 ] , [ 11 , 2 ] , [ 11 , 2 ] , [ 11 , 2 ] , [ 11 , 2 ] , [ 11 , 2 ] , [ 11 , 2 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 24 , 1 ] , [ 158 , 1 ] , [ 158 , 1 ] , [ 158 , 1 ] , [ 15 , 2 ] , [ 15 , 1 ] , [ 19 , 3 ] , [ 19 , 2 ] , [ 161 , 0 ] , [ 161 , 1 ] , [ 161 , 1 ] , [ 161 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 165 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 12 , 1 ] , [ 20 , 1 ] , [ 20 , 1 ] , [ 20 , 1 ] , [ 20 , 1 ] , [ 20 , 1 ] , [ 20 , 1 ] , [ 20
2018-08-16 18:02:51 +08:00
performAction : function anonymous ( yytext , yyleng , yylineno , yy , yystate /* action[1] */ , $$ /* vstack */ , _$ /* lstack */ ) {
/* this == yyval */
var $0 = $$ . length - 1 ;
switch ( yystate ) {
case 2 : case 3 :
return parser . yy . result ;
break ;
case 4 :
parser . prepareNewStatement ( ) ;
break ;
case 6 : case 8 : case 10 :
parser . addStatementLocation ( _$ [ $0 ] ) ;
break ;
case 9 : case 11 :
parser . addStatementLocation ( _$ [ $0 - 3 ] ) ;
break ;
case 18 :
if ( parser . isHive ( ) ) {
parser . suggestDdlAndDmlKeywords ( [ 'EXPLAIN' , 'FROM' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestDdlAndDmlKeywords ( [ 'EXPLAIN' ] ) ;
} else {
parser . suggestDdlAndDmlKeywords ( ) ;
}
break ;
case 19 :
if ( parser . isHive ( ) || parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'INSERT' , 'SELECT' ] ) ;
} else {
parser . suggestKeywords ( [ 'SELECT' ] ) ;
}
break ;
case 169 :
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestDdlAndDmlKeywords ( [ { value : 'AUTHORIZATION' , weight : 2 } , { value : 'DEPENDENCY' , weight : 2 } , { value : 'EXTENDED' , weight : 2 } ] ) ;
} else {
parser . suggestDdlAndDmlKeywords ( ) ;
}
break ;
case 170 :
parser . suggestDdlAndDmlKeywords ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 542 :
2018-08-16 18:02:51 +08:00
parser . suggestSetOptions ( ) ;
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'ROLE' ] ) ;
}
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'ALL' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 610 : case 613 : case 718 : case 759 : case 853 : case 1060 : case 1243 : case 1352 : case 1412 : case 2529 : case 2531 : case 3032 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 1 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 611 : case 614 : case 760 :
2018-08-16 18:02:51 +08:00
this . $ = '' ;
break ;
2018-09-26 17:21:26 +08:00
case 635 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'INDEX' , 'INDEXES' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 636 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FORMATTED' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 653 : case 656 :
2018-08-16 18:02:51 +08:00
parser . yy . correlatedSubQuery = false ;
break ;
2018-09-26 17:21:26 +08:00
case 654 : case 658 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'EXISTS' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 657 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'NOT EXISTS' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 668 : case 670 : case 671 : case 673 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ '<' , '<=' , '<>' , '=' , '>' , '>=' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 669 : case 672 : case 3059 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'VALUES' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 696 : case 700 : case 704 : case 740 : case 741 : case 786 : case 789 : case 962 : case 1031 : case 1776 : case 1874 : case 1893 : case 1939 : case 1941 : case 2310 : case 2569 : case 3349 :
2018-08-16 18:02:51 +08:00
parser . suggestColumns ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 708 : case 761 :
2018-08-16 18:02:51 +08:00
parser . addTableLocation ( _$ [ $0 ] , [ { name : $$ [ $0 ] } ] ) ;
this . $ = { identifierChain : [ { name : $$ [ $0 ] } ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 709 : case 762 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 2 ] , [ { name : $$ [ $0 - 2 ] } ] ) ;
parser . addTableLocation ( _$ [ $0 ] , [ { name : $$ [ $0 - 2 ] } , { name : $$ [ $0 ] } ] ) ;
this . $ = { identifierChain : [ { name : $$ [ $0 - 2 ] } , { name : $$ [ $0 ] } ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 710 :
2018-08-16 18:02:51 +08:00
// This is a special case for Impala expression like "SELECT | FROM db.table.col"
this . $ = { identifierChain : [ { name : $$ [ $0 - 3 ] } , { name : $$ [ $0 - 1 ] } ] . concat ( $$ [ $0 ] ) } ;
break ;
2018-12-29 11:47:29 +08:00
case 711 : case 1680 : case 1846 : case 2013 : case 2019 : case 2028 : case 2218 : case 2542 : case 2566 : case 2669 : case 2674 : case 2692 : case 2715 : case 2722 : case 2779 : case 2787 : case 3066 : case 3097 : case 3100 : case 3106 : case 3335 : case 3355 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 712 : case 726 :
2018-08-16 18:02:51 +08:00
parser . suggestDatabases ( ) ;
this . $ = { identifierChain : [ { name : $$ [ $0 - 2 ] } ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 713 :
2018-08-16 18:02:51 +08:00
// In Impala you can have statements like 'SELECT ... FROM testTable t, t.|'
parser . suggestTablesOrColumns ( $$ [ $0 - 2 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 714 :
2018-08-16 18:02:51 +08:00
// TODO: switch to suggestColumns, it's currently handled in sqlAutocompleter2.js
// Issue is that suggestColumns is deleted if no tables are defined and this is
// Impala only cases like "SELECT | FROM db.table.col"
parser . suggestTables ( { identifierChain : [ { name : $$ [ $0 - 3 ] } , { name : $$ [ $0 - 1 ] } ] . concat ( $$ [ $0 ] ) } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 715 : case 891 :
2018-08-16 18:02:51 +08:00
this . $ = [ $$ [ $0 ] ] ;
break ;
2018-09-26 17:21:26 +08:00
case 716 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] . push ( $$ [ $0 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 717 : case 720 :
2018-08-16 18:02:51 +08:00
this . $ = [ ] ;
break ;
2018-09-26 17:21:26 +08:00
case 719 : case 855 : case 1245 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 2 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 721 :
2018-08-16 18:02:51 +08:00
this . $ = { name : $$ [ $0 ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 725 : case 1731 : case 1958 :
2018-08-16 18:02:51 +08:00
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-29 11:47:29 +08:00
case 729 : case 1972 : case 2009 : case 2778 : case 2786 : case 3189 : case 3249 : case 3263 : case 3321 : case 3322 : case 3360 :
2018-08-16 18:02:51 +08:00
parser . suggestDatabases ( ) ;
break ;
2018-12-29 11:47:29 +08:00
case 739 : case 967 : case 968 : case 974 : case 975 : case 1348 : case 1439 : case 3017 : case 3053 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 747 : case 750 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'WITH REPLICATION =' ] } ;
}
break ;
2018-12-29 11:47:29 +08:00
case 752 : case 3207 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'IN' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 756 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'REPLICATION =' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 757 : case 1714 : case 1871 : case 2271 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ '=' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 763 : case 3312 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( { prependDot : true } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 764 :
2018-08-16 18:02:51 +08:00
parser . suggestTablesOrColumns ( $$ [ $0 - 2 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 766 :
2018-08-16 18:02:51 +08:00
this . $ = { identifierChain : $$ [ $0 - 1 ] . identifierChain , alias : $$ [ $0 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 769 :
2018-08-16 18:02:51 +08:00
parser . yy . locations [ parser . yy . locations . length - 1 ] . type = 'column' ;
break ;
2018-09-26 17:21:26 +08:00
case 770 : case 1196 :
2018-08-16 18:02:51 +08:00
parser . addAsteriskLocation ( _$ [ $0 ] , $$ [ $0 - 2 ] . concat ( { asterisk : true } ) ) ;
break ;
2018-09-26 17:21:26 +08:00
case 772 :
2018-08-16 18:02:51 +08:00
this . $ = [ $$ [ $0 ] . identifier ] ;
parser . yy . firstChainLocation = parser . addUnknownLocation ( $$ [ $0 ] . location , [ $$ [ $0 ] . identifier ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 773 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . firstChainLocation ) {
parser . yy . firstChainLocation . firstInChain = true ;
delete parser . yy . firstChainLocation ;
}
$$ [ $0 - 2 ] . push ( $$ [ $0 ] . identifier ) ;
parser . addUnknownLocation ( $$ [ $0 ] . location , $$ [ $0 - 2 ] . concat ( ) ) ;
break ;
2018-09-26 17:21:26 +08:00
case 774 : case 782 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . insideKey ) {
parser . suggestKeyValues ( { identifierChain : [ $$ [ $0 ] . identifier ] } ) ;
parser . suggestColumns ( ) ;
parser . suggestFunctions ( ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 775 : case 783 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . insideKey ) {
parser . suggestKeyValues ( { identifierChain : $$ [ $0 - 2 ] . concat ( [ $$ [ $0 ] . identifier ] ) } ) ;
parser . suggestColumns ( ) ;
parser . suggestFunctions ( ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 778 :
2018-08-16 18:02:51 +08:00
parser . suggestColumns ( {
identifierChain : $$ [ $0 - 2 ]
} ) ;
this . $ = { suggestKeywords : [ { value : '*' , weight : 10000 } ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 779 :
2018-08-16 18:02:51 +08:00
parser . suggestColumns ( {
identifierChain : $$ [ $0 - 4 ]
} ) ;
this . $ = { suggestKeywords : [ { value : '*' , weight : 10000 } ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 780 :
2018-08-16 18:02:51 +08:00
this . $ = [ $$ [ $0 ] . identifier ] ;
break ;
2018-09-26 17:21:26 +08:00
case 781 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . push ( $$ [ $0 ] . identifier ) ;
break ;
2018-09-26 17:21:26 +08:00
case 784 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . insideKey ) {
parser . suggestKeyValues ( { identifierChain : $$ [ $0 - 4 ] . concat ( [ $$ [ $0 - 2 ] . identifier ] ) } ) ;
parser . suggestColumns ( ) ;
parser . suggestFunctions ( ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 785 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . insideKey ) {
parser . suggestKeyValues ( { identifierChain : [ $$ [ $0 - 2 ] . identifier ] } ) ;
parser . suggestColumns ( ) ;
parser . suggestFunctions ( ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 787 :
2018-08-16 18:02:51 +08:00
parser . suggestColumns ( { identifierChain : $$ [ $0 - 2 ] } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 788 :
2018-08-16 18:02:51 +08:00
parser . suggestColumns ( { identifierChain : $$ [ $0 - 4 ] } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 790 :
2018-08-16 18:02:51 +08:00
this . $ = { identifier : { name : $$ [ $0 ] } , location : _$ [ $0 ] } ; ;
break ;
2018-09-26 17:21:26 +08:00
case 791 :
2018-08-16 18:02:51 +08:00
this . $ = { identifier : { name : $$ [ $0 - 3 ] , keySet : true } , location : _$ [ $0 - 3 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 792 :
2018-08-16 18:02:51 +08:00
this . $ = { identifier : { name : $$ [ $0 - 2 ] , keySet : true } , location : _$ [ $0 - 2 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 793 :
2018-08-16 18:02:51 +08:00
this . $ = { identifier : { name : $$ [ $0 - 3 ] } , insideKey : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 794 :
2018-08-16 18:02:51 +08:00
this . $ = { identifier : { name : $$ [ $0 - 3 ] } } ; ;
break ;
2018-09-26 17:21:26 +08:00
case 827 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
parser . addColumnLocation ( _$ [ $0 - 1 ] , $$ [ $0 - 1 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 828 : case 1682 : case 1981 : case 2003 : case 2017 : case 2031 : case 2220 : case 2668 : case 2678 : case 2679 : case 2704 : case 2710 : case 2713 : case 2718 : case 3060 : case 3069 : case 3070 : case 3099 : case 3109 : case 3206 : case 3252 : case 3253 : case 3265 : case 3267 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 829 : case 845 : case 2004 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 ] , [ { name : $$ [ $0 ] } ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 832 : case 1678 : case 2016 : case 2023 : case 2024 : case 3254 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 833 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 4 ] ) {
parser . suggestKeywords ( [ 'EXTENDED' , 'FORMATTED' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 834 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 3 ] ) {
parser . suggestKeywords ( [ 'EXTENDED' , 'FORMATTED' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 835 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
parser . suggestColumns ( ) ;
if ( ! $$ [ $0 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 836 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 839 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'DATABASE' , 'EXTENDED' , 'FORMATTED' , 'FUNCTION' , 'SCHEMA' ] ) ;
}
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 840 : case 842 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'EXTENDED' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 841 : case 843 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'EXTENDED' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 844 : case 1876 : case 1959 : case 1962 : case 2011 : case 2538 : case 2667 : case 2688 : case 2698 : case 2702 : case 2776 : case 2777 : case 2783 : case 3033 : case 3102 : case 3176 : case 3192 : case 3251 : case 3264 : case 3266 : case 3309 : case 3338 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 846 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'DATABASE' , weight : 2 } , { value : 'EXTENDED' , weight : 1 } , { value : 'FORMATTED' , weight : 1 } ] ) ;
}
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 848 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ { value : 'DATABASE' , weight : 2 } , { value : 'EXTENDED' , weight : 1 } , { value : 'FORMATTED' , weight : 1 } ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 849 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'EXTENDED' , 'FORMATTED' ] ) ;
}
parser . suggestDatabases ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 850 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'EXTENDED' , 'FORMATTED' ] ) ;
}
parser . addDatabaseLocation ( _$ [ $0 ] , [ { name : $$ [ $0 ] } ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 858 :
2018-08-16 18:02:51 +08:00
parser . addCommonTableExpressions ( $$ [ $0 - 3 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 859 : case 860 : case 894 :
2018-08-16 18:02:51 +08:00
parser . addCommonTableExpressions ( $$ [ $0 - 2 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 864 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 1 ] , _$ [ $0 - 1 ] , $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] ) , _$ [ $0 ] ) ;
this . $ = { selectList : $$ [ $0 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 865 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] ) , _$ [ $0 - 1 ] ) ;
this . $ = { selectList : $$ [ $0 - 1 ] , tableExpression : $$ [ $0 ] }
break ;
2018-09-26 17:21:26 +08:00
case 876 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'DISTINCT' , 'SELECT' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 877 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'DISTINCT' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 879 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 1 ] , _$ [ $0 - 1 ] , $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] ) , _$ [ $0 ] ) ;
if ( $$ [ $0 ] . cursorAtStart ) {
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 - 2 ] ) {
keywords . push ( { value : 'ALL' , weight : 2 } ) ;
keywords . push ( { value : 'DISTINCT' , weight : 2 } ) ;
}
if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] ) {
keywords . push ( { value : 'STRAIGHT_JOIN' , weight : 1 } ) ;
}
parser . suggestKeywords ( keywords ) ;
} else {
parser . checkForSelectListKeywords ( $$ [ $0 ] ) ;
}
if ( $$ [ $0 ] . suggestFunctions ) {
parser . suggestFunctions ( ) ;
}
if ( $$ [ $0 ] . suggestColumns ) {
parser . suggestColumns ( { identifierChain : [ ] , source : 'select' } ) ;
}
if ( $$ [ $0 ] . suggestTables ) {
parser . suggestTables ( { prependQuestionMark : true , prependFrom : true } ) ;
}
if ( $$ [ $0 ] . suggestDatabases ) {
parser . suggestDatabases ( { prependQuestionMark : true , prependFrom : true , appendDot : true } ) ;
}
if ( $$ [ $0 ] . suggestAggregateFunctions && ( ! $$ [ $0 - 2 ] || $$ [ $0 - 2 ] === 'ALL' ) ) {
parser . suggestAggregateFunctions ( ) ;
parser . suggestAnalyticFunctions ( ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 880 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 1 ] , _$ [ $0 - 1 ] , $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] ) , _$ [ $0 ] , true ) ;
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! $$ [ $0 - 2 ] || $$ [ $0 - 2 ] === 'ALL' ) {
parser . suggestAggregateFunctions ( ) ;
parser . suggestAnalyticFunctions ( ) ;
}
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 - 2 ] ) {
keywords . push ( { value : 'ALL' , weight : 2 } ) ;
keywords . push ( { value : 'DISTINCT' , weight : 2 } ) ;
}
if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] ) {
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 } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 881 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] ) , _$ [ $0 - 1 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 882 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] ) , _$ [ $0 - 1 ] ) ;
parser . selectListNoTableSuggest ( $$ [ $0 - 1 ] , $$ [ $0 - 3 ] ) ;
if ( parser . yy . result . suggestColumns ) {
parser . yy . result . suggestColumns . source = 'select' ;
}
break ;
2018-09-26 17:21:26 +08:00
case 883 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] ) , _$ [ $0 - 1 ] , true ) ;
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! $$ [ $0 - 3 ] || $$ [ $0 - 3 ] === 'ALL' ) {
parser . suggestAggregateFunctions ( ) ;
parser . suggestAnalyticFunctions ( ) ;
}
if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 3 ] ) {
keywords . push ( { value : 'ALL' , weight : 2 } ) ;
keywords . push ( { value : 'DISTINCT' , weight : 2 } ) ;
}
if ( parser . isImpala ( ) && ! $$ [ $0 - 2 ] ) {
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 } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 884 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] ) , _$ [ $0 - 2 ] ) ;
parser . checkForSelectListKeywords ( $$ [ $0 - 2 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 885 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] , $$ [ $0 - 6 ] , _$ [ $0 - 6 ] ) , _$ [ $0 - 3 ] ) ;
parser . checkForSelectListKeywords ( $$ [ $0 - 3 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 886 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'selectList' , parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] ) , _$ [ $0 - 1 ] ) ;
parser . checkForSelectListKeywords ( $$ [ $0 - 1 ] ) ;
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 } ) ;
break ;
2018-12-29 11:47:29 +08:00
case 889 : case 934 : case 965 : case 978 : case 982 : case 1020 : case 1024 : case 1052 : case 1078 : case 1079 : case 1160 : case 1162 : case 1230 : case 1240 : case 1247 : case 1259 : case 1437 : case 1633 : case 1634 : case 1922 : case 2091 : case 2108 : case 3052 : case 3354 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 892 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 2 ] . concat ( [ $$ [ $0 ] ] ) ; ;
break ;
2018-09-26 17:21:26 +08:00
case 896 :
2018-08-16 18:02:51 +08:00
parser . addCommonTableExpressions ( $$ [ $0 - 4 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 897 :
2018-08-16 18:02:51 +08:00
parser . addCteAliasLocation ( _$ [ $0 - 4 ] , $$ [ $0 - 4 ] ) ;
$$ [ $0 - 1 ] . alias = $$ [ $0 - 4 ] ;
this . $ = $$ [ $0 - 1 ] ;
break ;
2018-12-10 16:10:37 +08:00
case 898 : case 1492 : case 2331 : case 2391 : case 2468 : case 2472 : case 2545 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'AS' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 899 : case 1355 : case 1955 : case 2405 : case 2414 : case 3034 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SELECT' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 905 : case 906 :
2018-08-16 18:02:51 +08:00
parser . addClauseLocation ( 'whereClause' , _$ [ $0 - 1 ] , $$ [ $0 ] . whereClauseLocation ) ;
parser . addClauseLocation ( 'limitClause' , $$ [ $0 ] . limitClausePreceding || _$ [ $0 - 1 ] , $$ [ $0 ] . limitClauseLocation ) ;
break ;
2018-09-26 17:21:26 +08:00
case 907 :
2018-08-16 18:02:51 +08:00
var keywords = [ ] ;
parser . addClauseLocation ( 'whereClause' , _$ [ $0 - 3 ] , $$ [ $0 - 1 ] . whereClauseLocation ) ;
parser . addClauseLocation ( 'limitClause' , $$ [ $0 - 2 ] . limitClausePreceding || _$ [ $0 - 3 ] , $$ [ $0 - 2 ] . limitClauseLocation ) ;
if ( $$ [ $0 - 3 ] ) {
if ( ! $$ [ $0 - 3 ] . hasLateralViews && typeof $$ [ $0 - 3 ] . tableReferenceList . hasJoinCondition !== 'undefined' && ! $$ [ $0 - 3 ] . tableReferenceList . hasJoinCondition ) {
keywords . push ( { value : 'ON' , weight : 3 } ) ;
if ( parser . isImpala ( ) ) {
keywords . push ( { value : 'USING' , weight : 3 } ) ;
}
}
if ( $$ [ $0 - 3 ] . suggestKeywords ) {
keywords = parser . createWeightedKeywords ( $$ [ $0 - 3 ] . suggestKeywords , 3 ) ;
}
if ( $$ [ $0 - 3 ] . tableReferenceList . suggestJoinConditions ) {
parser . suggestJoinConditions ( $$ [ $0 - 3 ] . tableReferenceList . suggestJoinConditions ) ;
}
if ( $$ [ $0 - 3 ] . tableReferenceList . suggestJoins ) {
parser . suggestJoins ( $$ [ $0 - 3 ] . tableReferenceList . suggestJoins ) ;
}
if ( ! $$ [ $0 - 3 ] . hasLateralViews && $$ [ $0 - 3 ] . tableReferenceList . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 3 ] . 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 ( ! $$ [ $0 - 3 ] . hasLateralViews && $$ [ $0 - 3 ] . tableReferenceList . types ) {
var veKeywords = parser . getValueExpressionKeywords ( $$ [ $0 - 3 ] . tableReferenceList ) ;
keywords = keywords . concat ( veKeywords . suggestKeywords ) ;
if ( veKeywords . suggestColRefKeywords ) {
parser . suggestColRefKeywords ( veKeywords . suggestColRefKeywords ) ;
parser . addColRefIfExists ( $$ [ $0 - 3 ] . tableReferenceList ) ;
}
}
}
if ( $$ [ $0 - 1 ] . empty && $$ [ $0 ] && $$ [ $0 ] . joinType . toUpperCase ( ) === 'JOIN' ) {
keywords = keywords . concat ( [ 'FULL' , 'FULL OUTER' , 'LEFT' , 'LEFT OUTER' , 'RIGHT' , 'RIGHT OUTER' ] ) ;
if ( parser . isHive ( ) ) {
keywords = keywords . concat ( [ 'CROSS' , 'INNER' , 'LEFT SEMI' ] ) ;
} else if ( parser . isImpala ( ) ) {
keywords = keywords . concat ( [ 'ANTI' , 'CROSS' , 'INNER' , 'LEFT ANTI' , 'LEFT INNER' , 'LEFT SEMI' , 'OUTER' , 'RIGHT ANTI' , 'RIGHT INNER' , 'RIGHT SEMI' , 'SEMI' ] ) ;
} else {
keywords . push ( 'INNER' ) ;
}
parser . suggestKeywords ( keywords ) ;
return ;
}
if ( $$ [ $0 - 1 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 1 ] . suggestKeywords , 2 ) ) ;
}
if ( $$ [ $0 - 1 ] . suggestFilters ) {
parser . suggestFilters ( $$ [ $0 - 1 ] . suggestFilters ) ;
}
if ( $$ [ $0 - 1 ] . suggestGroupBys ) {
parser . suggestGroupBys ( $$ [ $0 - 1 ] . suggestGroupBys ) ;
}
if ( $$ [ $0 - 1 ] . suggestOrderBys ) {
parser . suggestOrderBys ( $$ [ $0 - 1 ] . suggestOrderBys ) ;
}
if ( $$ [ $0 - 1 ] . empty ) {
keywords . push ( { value : 'UNION' , weight : 2.11 } ) ;
}
keywords = keywords . concat ( [
{ value : 'FULL JOIN' , weight : 1 } ,
{ value : 'FULL OUTER JOIN' , weight : 1 } ,
{ value : 'JOIN' , weight : 1 } ,
{ value : 'LEFT JOIN' , weight : 1 } ,
{ value : 'LEFT OUTER JOIN' , weight : 1 } ,
{ value : 'RIGHT JOIN' , weight : 1 } ,
{ value : 'RIGHT OUTER JOIN' , weight : 1 }
] ) ;
if ( parser . isHive ( ) ) {
keywords = keywords . concat ( [
{ value : 'CROSS JOIN' , weight : 1 } ,
{ value : 'INNER JOIN' , weight : 1 } ,
{ value : 'LEFT SEMI JOIN' , weight : 1 }
] ) ;
} else if ( parser . isImpala ( ) ) {
keywords = keywords . concat ( [
{ value : 'ANTI JOIN' , weight : 1 } ,
{ value : 'INNER JOIN' , weight : 1 } ,
{ value : 'LEFT ANTI JOIN' , weight : 1 } ,
{ value : 'LEFT INNER 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 SEMI JOIN' , weight : 1 } ,
{ value : 'SEMI JOIN' , weight : 1 }
] ) ;
} else {
keywords . push ( { value : 'INNER JOIN' , weight : 1 } ) ;
}
parser . suggestKeywords ( keywords ) ;
break ;
2018-09-26 17:21:26 +08:00
case 908 :
2018-08-16 18:02:51 +08:00
// 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 ( ! $$ [ $0 - 1 ] ) {
parser . addClauseLocation ( 'whereClause' , _$ [ $0 - 2 ] ) ;
parser . addClauseLocation ( 'limitClause' , _$ [ $0 - 2 ] ) ;
return ;
}
parser . addClauseLocation ( 'whereClause' , _$ [ $0 - 2 ] , $$ [ $0 - 1 ] . whereClauseLocation ) ;
parser . addClauseLocation ( 'limitClause' , $$ [ $0 - 1 ] . limitClausePreceding || _$ [ $0 - 2 ] , $$ [ $0 - 1 ] . limitClauseLocation ) ;
var keywords = [ ] ;
if ( $$ [ $0 - 1 ] . suggestColRefKeywords ) {
parser . suggestColRefKeywords ( $$ [ $0 - 1 ] . suggestColRefKeywords ) ;
parser . addColRefIfExists ( $$ [ $0 - 1 ] ) ;
}
if ( $$ [ $0 - 1 ] . suggestKeywords && $$ [ $0 - 1 ] . suggestKeywords . length ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 1 ] . suggestKeywords , 2 ) ) ;
}
if ( $$ [ $0 - 1 ] . cursorAtEnd ) {
keywords . push ( { value : 'UNION' , weight : 2.11 } ) ;
}
parser . suggestKeywords ( keywords ) ;
break ;
2018-09-26 17:21:26 +08:00
case 912 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
this . $ = { tableReferenceList : $$ [ $0 - 1 ] , suggestKeywords : [ 'LATERAL VIEW' ] }
} else {
this . $ = { tableReferenceList : $$ [ $0 - 1 ] }
}
if ( parser . isHive ( ) && $$ [ $0 ] ) {
parser . yy . lateralViews = $$ [ $0 ] . lateralViews ;
this . $ . hasLateralViews = true ;
if ( $$ [ $0 ] . suggestKeywords ) {
this . $ . suggestKeywords = this . $ . suggestKeywords . concat ( $$ [ $0 ] . suggestKeywords ) ;
}
}
break ;
2018-09-26 17:21:26 +08:00
case 913 : case 1252 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 914 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] ) {
parser . yy . lateralViews = $$ [ $0 ] . lateralViews ;
}
break ;
2018-09-26 17:21:26 +08:00
case 916 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR (
[ $$ [ $0 - 7 ] , $$ [ $0 - 6 ] , $$ [ $0 - 5 ] , $$ [ $0 - 4 ] , $$ [ $0 - 3 ] , $$ [ $0 - 2 ] , $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] ,
[ { value : 'WHERE' , weight : 9 } , { value : 'GROUP BY' , weight : 8 } , { value : 'HAVING' , weight : 7 } , { value : 'WINDOW' , weight : 6 } , { value : 'ORDER BY' , weight : 5 } , [ { value : 'CLUSTER BY' , weight : 4 } , { value : 'DISTRIBUTE BY' , weight : 4 } ] , { value : 'SORT BY' , weight : 4 } , { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] ,
[ true , true , true , parser . isHive ( ) , true , parser . isHive ( ) , parser . isHive ( ) && ! $$ [ $0 - 3 ] , true , parser . isImpala ( ) ] ) ;
if ( keywords . length > 0 ) {
this . $ = { suggestKeywords : keywords , empty : ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] } ;
} else {
this . $ = { } ;
}
this . $ . whereClauseLocation = $$ [ $0 - 7 ] ? _$ [ $0 - 7 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] , $$ [ $0 - 6 ] , _$ [ $0 - 6 ] , $$ [ $0 - 7 ] , _$ [ $0 - 7 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
if ( ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ . suggestFilters = { prefix : 'WHERE' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ;
}
if ( ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ . suggestGroupBys = { prefix : 'GROUP BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ;
}
if ( ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ . suggestOrderBys = { prefix : 'ORDER BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ;
}
break ;
2018-09-26 17:21:26 +08:00
case 917 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestColumns ) {
parser . yy . result . suggestColumns . source = 'where' ;
}
break ;
2018-09-26 17:21:26 +08:00
case 918 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestColumns ) {
parser . yy . result . suggestColumns . source = 'group by' ;
}
break ;
2018-09-26 17:21:26 +08:00
case 921 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestColumns ) {
parser . yy . result . suggestColumns . source = 'order by' ;
}
break ;
2018-09-26 17:21:26 +08:00
case 925 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR (
[ $$ [ $0 - 6 ] , $$ [ $0 - 5 ] , $$ [ $0 - 4 ] , $$ [ $0 - 3 ] , $$ [ $0 - 2 ] , $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] ,
[ { value : 'GROUP BY' , weight : 8 } , { value : 'HAVING' , weight : 7 } , { value : 'WINDOW' , weight : 6 } , { value : 'ORDER BY' , weight : 5 } , [ { value : 'CLUSTER BY' , weight : 4 } , { value : 'DISTRIBUTE BY' , weight : 4 } ] , { value : 'SORT BY' , weight : 4 } , { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] ,
[ true , true , parser . isHive ( ) , true , parser . isHive ( ) , parser . isHive ( ) && ! $$ [ $0 - 3 ] , true , parser . isImpala ( ) ] ) ;
if ( $$ [ $0 - 8 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 8 ] . suggestKeywords , 1 ) ) ;
}
this . $ = parser . getValueExpressionKeywords ( $$ [ $0 - 8 ] , keywords ) ;
this . $ . cursorAtEnd = ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ;
if ( $$ [ $0 - 8 ] . columnReference ) {
this . $ . columnReference = $$ [ $0 - 8 ] . columnReference ;
}
if ( ! $$ [ $0 - 6 ] ) {
parser . suggestGroupBys ( { prefix : 'GROUP BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
if ( ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] ) {
parser . suggestOrderBys ( { prefix : 'ORDER BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] , $$ [ $0 - 6 ] , _$ [ $0 - 6 ] , $$ [ $0 - 8 ] , _$ [ $0 - 8 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 926 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR (
[ $$ [ $0 - 5 ] , $$ [ $0 - 4 ] , $$ [ $0 - 3 ] , $$ [ $0 - 2 ] , $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] ,
[ { value : 'HAVING' , weight : 7 } , { value : 'WINDOW' , weight : 6 } , { value : 'ORDER BY' , weight : 5 } , [ { value : 'CLUSTER BY' , weight : 4 } , { value : 'DISTRIBUTE BY' , weight : 4 } ] , { value : 'SORT BY' , weight : 4 } , { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] ,
[ true , parser . isHive ( ) , true , parser . isHive ( ) , parser . isHive ( ) && ! $$ [ $0 - 3 ] , true , parser . isImpala ( ) ] ) ;
if ( $$ [ $0 - 7 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 7 ] . suggestKeywords , 8 ) ) ;
}
if ( $$ [ $0 - 7 ] . valueExpression ) {
this . $ = parser . getValueExpressionKeywords ( $$ [ $0 - 7 ] . valueExpression , keywords ) ;
if ( $$ [ $0 - 7 ] . valueExpression . columnReference ) {
this . $ . columnReference = $$ [ $0 - 7 ] . valueExpression . columnReference ;
}
} else {
this . $ = { suggestKeywords : keywords } ;
}
this . $ . cursorAtEnd = ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ;
if ( ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] ) {
parser . suggestOrderBys ( { prefix : 'ORDER BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] , $$ [ $0 - 7 ] , _$ [ $0 - 7 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 927 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR (
[ $$ [ $0 - 4 ] , $$ [ $0 - 3 ] , $$ [ $0 - 2 ] , $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] ,
[ { value : 'WINDOW' , weight : 6 } , { value : 'ORDER BY' , weight : 5 } , [ { value : 'CLUSTER BY' , weight : 4 } , { value : 'DISTRIBUTE BY' , weight : 4 } ] , { value : 'SORT BY' , weight : 4 } , { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] ,
[ parser . isHive ( ) , true , parser . isHive ( ) , parser . isHive ( ) && ! $$ [ $0 - 3 ] , true , parser . isImpala ( ) ] ) ;
this . $ = { suggestKeywords : keywords , cursorAtEnd : ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] } ;
if ( ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] ) {
parser . suggestOrderBys ( { prefix : 'ORDER BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 6 ] , _$ [ $0 - 6 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 928 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR ( [ $$ [ $0 - 3 ] , $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] , [ { value : 'ORDER BY' , weight : 5 } , [ { value : 'CLUSTER BY' , weight : 4 } , { value : 'DISTRIBUTE BY' , weight : 4 } , { value : 'SORT BY' , weight : 4 } ] , { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] , [ true , parser . isHive ( ) , true , parser . isImpala ( ) ] ) ;
this . $ = { suggestKeywords : keywords , cursorAtEnd : ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] } ;
if ( ! $$ [ $0 - 3 ] ) {
parser . suggestOrderBys ( { prefix : 'ORDER BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 929 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR ( [ $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] , [ [ { value : 'CLUSTER BY' , weight : 4 } , { value : 'DISTRIBUTE BY' , weight : 4 } ] , { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] , [ parser . isHive ( ) , true , parser . isImpala ( ) ] ) ;
if ( $$ [ $0 - 4 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 4 ] . suggestKeywords , 5 ) ) ;
}
this . $ = { suggestKeywords : keywords , cursorAtEnd : ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] } ;
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 2 ] , _$ [ $0 - 2 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 930 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR ( [ $$ [ $0 - 1 ] , $$ [ $0 ] ] , [ { value : 'LIMIT' , weight : 3 } , { value : 'OFFSET' , weight : 2 } ] , [ true , parser . isImpala ( ) ] ) ;
if ( $$ [ $0 - 3 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 3 ] . suggestKeywords , 4 ) ) ;
}
this . $ = { suggestKeywords : keywords , cursorAtEnd : ! $$ [ $0 - 1 ] && ! $$ [ $0 ] } ;
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = _$ [ $0 - 3 ] ;
this . $ . limitClauseLocation = $$ [ $0 - 1 ] ? _$ [ $0 - 1 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 931 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getKeywordsForOptionalsLR ( [ $$ [ $0 ] ] , [ { value : 'OFFSET' , weight : 2 } ] , [ parser . isImpala ( ) ] ) ;
this . $ = { suggestKeywords : keywords , cursorAtEnd : ! $$ [ $0 ] } ;
this . $ . whereClauseLocation = $$ [ $0 - 8 ] ? _$ [ $0 - 8 ] : undefined ;
this . $ . limitClausePreceding = parser . firstDefined ( $$ [ $0 - 3 ] , _$ [ $0 - 3 ] , $$ [ $0 - 4 ] , _$ [ $0 - 4 ] , $$ [ $0 - 5 ] , _$ [ $0 - 5 ] , $$ [ $0 - 6 ] , _$ [ $0 - 6 ] , $$ [ $0 - 7 ] , _$ [ $0 - 7 ] , $$ [ $0 - 8 ] , _$ [ $0 - 8 ] ) ;
this . $ . limitClauseLocation = $$ [ $0 - 2 ] ? _$ [ $0 - 2 ] : undefined ;
break ;
2018-09-26 17:21:26 +08:00
case 935 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . suggestFilters ) {
parser . suggestFilters ( { tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 936 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( ) ;
parser . suggestColumns ( ) ;
parser . suggestKeywords ( [ 'EXISTS' , 'NOT EXISTS' ] ) ;
parser . suggestFilters ( { tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 939 :
2018-08-16 18:02:51 +08:00
this . $ = { valueExpression : $$ [ $0 ] ? false : $$ [ $0 - 1 ] } ;
if ( ! $$ [ $0 ] && parser . isHive ( ) ) {
this . $ . suggestKeywords = [ 'GROUPING SETS' , 'WITH CUBE' , 'WITH ROLLUP' ] ;
}
break ;
2018-09-26 17:21:26 +08:00
case 940 : case 989 : case 1015 : case 1019 : case 1022 :
2018-08-16 18:02:51 +08:00
parser . suggestSelectListAliases ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 941 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestSelectListAliases ( ) ;
parser . suggestGroupBys ( { tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 942 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'BY' ] ) ;
parser . suggestGroupBys ( { prefix : 'BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 949 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'CUBE' , 'ROLLUP' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 951 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SETS' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 979 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . emptyOrderBy ) {
parser . suggestOrderBys ( { tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 980 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'BY' ] ) ;
parser . suggestOrderBys ( { prefix : 'BY' , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 984 :
2018-08-16 18:02:51 +08:00
this . $ = { emptyOrderBy : false }
parser . valueExpressionSuggest ( ) ;
parser . suggestAnalyticFunctions ( ) ;
parser . suggestSelectListAliases ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 985 : case 986 : case 987 :
2018-08-16 18:02:51 +08:00
this . $ = { emptyOrderBy : false } ;
break ;
2018-09-26 17:21:26 +08:00
case 988 :
2018-08-16 18:02:51 +08:00
this . $ = parser . mergeSuggestKeywords ( $$ [ $0 - 1 ] , $$ [ $0 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 991 :
2018-08-16 18:02:51 +08:00
this . $ = { emptyOrderBy : true }
parser . valueExpressionSuggest ( ) ;
parser . suggestAnalyticFunctions ( ) ;
parser . suggestSelectListAliases ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 992 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'ASC' , 'DESC' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 997 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
this . $ = { suggestKeywords : [ 'NULLS FIRST' , 'NULLS LAST' ] } ;
} else {
this . $ = { } ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1000 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FIRST' , 'LAST' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1004 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'SORT BY' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1013 : case 1017 : case 1021 :
2018-08-16 18:02:51 +08:00
suggestKeywords : [ 'BY' ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1014 : case 1018 :
2018-08-16 18:02:51 +08:00
parser . suggestColumns ( ) ;
parser . suggestSelectListAliases ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1029 :
2018-08-16 18:02:51 +08:00
parser . addColumnLocation ( $$ [ $0 - 1 ] . location , [ $$ [ $0 - 1 ] . identifier ] ) ;
this . $ = $$ [ $0 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1040 : case 1045 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( { types : [ 'BIGINT' ] } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1041 : case 1046 :
2018-08-16 18:02:51 +08:00
delete parser . yy . result . suggestColumns ;
break ;
2018-09-26 17:21:26 +08:00
case 1050 : case 1051 :
2018-08-16 18:02:51 +08:00
// verifyType($$[$0], 'BOOLEAN');
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1053 :
2018-08-16 18:02:51 +08:00
// verifyType($$[$0], 'NUMBER');
this . $ = $$ [ $0 ] ;
$$ [ $0 ] . types = [ 'NUMBER' ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1054 : case 1055 : case 1056 : case 1057 : case 1058 : case 1065 : case 1066 : case 1067 : case 1068 : case 1069 : case 1070 : case 1076 : case 1077 : case 1098 : case 1156 : case 1157 : case 1219 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1059 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] } ;
// clear correlated flag after completed sub-query (set by lexer)
parser . yy . correlatedSubQuery = false ;
break ;
2018-09-26 17:21:26 +08:00
case 1061 : case 1062 : case 1063 : case 1064 :
2018-08-16 18:02:51 +08:00
parser . addColRefToVariableIfExists ( $$ [ $0 - 2 ] , $$ [ $0 ] ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1071 : case 1072 :
2018-08-16 18:02:51 +08:00
// verifyType($$[$0-2], 'BOOLEAN');
// verifyType($$[$0], 'BOOLEAN');
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1073 : case 1074 : case 1075 :
2018-08-16 18:02:51 +08:00
// verifyType($$[$0-2], 'NUMBER');
// verifyType($$[$0], 'NUMBER');
this . $ = { types : [ 'NUMBER' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1081 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'BETWEEN' , 'EXISTS' , 'IN' , 'ILIKE' , 'IREGEXP' , 'LIKE' , 'REGEXP' , 'RLIKE' ] ) ;
} else {
parser . suggestKeywords ( [ 'BETWEEN' , 'EXISTS' , 'IN' , 'LIKE' , 'REGEXP' , 'RLIKE' ] ) ;
}
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1082 : case 1084 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1083 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( ) ;
parser . suggestColumns ( ) ;
parser . suggestKeywords ( [ 'EXISTS' ] ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1085 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( { types : [ 'BOOLEAN' ] } ) ;
parser . suggestColumns ( { types : [ 'BOOLEAN' ] } ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1086 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'T' ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1087 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( ) ;
parser . suggestColumns ( ) ;
this . $ = { types : [ 'T' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1088 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] . typeSet ) {
parser . applyTypeToSuggestions ( 'NUMBER' ) ;
}
this . $ = { types : [ 'NUMBER' ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1089 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( { types : [ 'NUMBER' ] } ) ;
parser . suggestColumns ( { types : [ 'NUMBER' ] } ) ;
this . $ = { types : [ 'NUMBER' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1090 :
2018-08-16 18:02:51 +08:00
var keywords = [ 'FALSE' , 'NOT NULL' , 'NOT TRUE' , 'NOT FALSE' , 'NULL' , 'TRUE' ] ;
if ( parser . isImpala ( ) ) {
keywords = keywords . concat ( [ 'DISTINCT FROM' , 'NOT DISTINCT FROM' , 'NOT UNKNOWN' , 'UNKNOWN' ] ) ;
}
parser . suggestKeywords ( keywords ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1091 :
2018-08-16 18:02:51 +08:00
var keywords = [ 'FALSE' , 'NULL' , 'TRUE' ] ;
if ( parser . isImpala ( ) ) {
keywords = keywords . concat ( [ 'DISTINCT FROM' , 'UNKNOWN' ] ) ;
}
parser . suggestKeywords ( keywords ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1092 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'FROM' ] ) ;
}
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1093 : case 1094 : case 1095 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'NOT' ] ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1096 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 5 ] , $$ [ $0 - 3 ] ? 'IS NOT DISTINCT FROM' : 'IS DISTINCT FROM' ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1097 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 ] . suggestFilters }
break ;
2018-09-26 17:21:26 +08:00
case 1099 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 1 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1100 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { types : [ 'T' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1101 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1102 : case 1103 : case 1104 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1105 : case 1106 : case 1107 : case 1108 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 ] . types ) ;
parser . addColRefIfExists ( $$ [ $0 ] ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters }
break ;
2018-09-26 17:21:26 +08:00
case 1109 : case 1111 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 2 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1110 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 2 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true , endsWithLessThanOrEqual : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1112 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 2 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true , endsWithLessThanOrEqual : $$ [ $0 - 1 ] === '<=' } ;
break ;
2018-09-26 17:21:26 +08:00
case 1113 : case 1114 : case 1115 : case 1116 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
parser . addColRefIfExists ( $$ [ $0 - 2 ] ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 ] . suggestFilters }
break ;
2018-09-26 17:21:26 +08:00
case 1117 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . inValueEdit ) {
parser . valueExpressionSuggest ( $$ [ $0 - 3 ] , $$ [ $0 - 2 ] + ' ' + $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 3 ] . types ) ;
}
if ( $$ [ $0 ] . cursorAtStart ) {
parser . suggestKeywords ( [ 'SELECT' ] ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1118 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . inValueEdit ) {
parser . valueExpressionSuggest ( $$ [ $0 - 2 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
}
if ( $$ [ $0 ] . cursorAtStart ) {
parser . suggestKeywords ( [ 'SELECT' ] ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1119 : case 1120 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 5 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1121 : case 1122 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 4 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1123 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . types [ 0 ] === $$ [ $0 ] . types [ 0 ] && ! $$ [ $0 - 5 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 5 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1124 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 5 ] . types [ 0 ] === $$ [ $0 ] . types [ 0 ] && ! $$ [ $0 - 2 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 5 ] . types ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1125 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 5 ] . types [ 0 ] === $$ [ $0 - 2 ] . types [ 0 ] && ! $$ [ $0 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 5 ] . types ) ;
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1126 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 5 ] , $$ [ $0 - 1 ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1127 : case 1133 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 1 ] , [ 'AND' ] ) ;
this . $ = { types : [ 'BOOLEAN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1128 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 3 ] , $$ [ $0 - 2 ] + ' ' + $$ [ $0 - 1 ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1129 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 4 ] . types [ 0 ] === $$ [ $0 - 2 ] . types [ 0 ] && ! $$ [ $0 - 4 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 4 ] . types )
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 4 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1130 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 4 ] . types [ 0 ] === $$ [ $0 - 2 ] . types [ 0 ] && ! $$ [ $0 - 2 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 4 ] . types )
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1131 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 4 ] . types [ 0 ] === $$ [ $0 - 2 ] . types [ 0 ] && ! $$ [ $0 ] . typeSet ) {
parser . applyTypeToSuggestions ( $$ [ $0 - 4 ] . types )
}
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1132 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 4 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 4 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1134 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( $$ [ $0 - 2 ] , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . types ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1135 : case 1137 : case 1139 : case 1141 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( undefined , $$ [ $0 - 1 ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true , suggestFilters : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1136 : case 1140 :
2018-08-16 18:02:51 +08:00
parser . addColRefIfExists ( $$ [ $0 ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters }
break ;
2018-09-26 17:21:26 +08:00
case 1138 : case 1142 :
2018-08-16 18:02:51 +08:00
parser . addColRefIfExists ( $$ [ $0 - 2 ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 ] . suggestFilters }
break ;
2018-09-26 17:21:26 +08:00
case 1143 : case 1144 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( undefined , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( [ 'NUMBER' ] ) ;
this . $ = { types : [ 'NUMBER' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1145 : case 1146 : case 1147 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] . typeSet ) {
parser . applyTypeToSuggestions ( [ 'NUMBER' ] ) ;
parser . addColRefIfExists ( $$ [ $0 ] ) ;
}
this . $ = { types : [ 'NUMBER' ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters }
break ;
2018-09-26 17:21:26 +08:00
case 1148 : case 1149 : case 1150 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( undefined , $$ [ $0 - 1 ] ) ;
parser . applyTypeToSuggestions ( [ 'NUMBER' ] ) ;
this . $ = { types : [ 'NUMBER' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1151 : case 1152 : case 1153 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] . typeSet ) {
parser . applyTypeToSuggestions ( [ 'NUMBER' ] ) ;
parser . addColRefIfExists ( $$ [ $0 - 2 ] ) ;
}
this . $ = { types : [ 'NUMBER' ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1154 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 1 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1155 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'BOOLEAN' ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters } ;
break ;
2018-09-26 17:21:26 +08:00
case 1158 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( undefined , $$ [ $0 ] ) ;
parser . applyTypeToSuggestions ( [ 'STRING' ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1159 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( undefined , $$ [ $0 - 1 ] + ' ' + $$ [ $0 ] ) ;
parser . applyTypeToSuggestions ( [ 'STRING' ] ) ;
this . $ = { types : [ 'BOOLEAN' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1161 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = { types : [ 'T' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1163 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ 'WHEN' ] ) ;
this . $ = { types : [ 'T' ] , typeSet : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1164 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 ] ;
this . $ . suggestFilters = $$ [ $0 - 1 ] . suggestFilters ;
break ;
2018-09-26 17:21:26 +08:00
case 1165 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'T' ] , suggestFilters : $$ [ $0 - 1 ] . suggestFilters } ;
break ;
2018-12-10 16:10:37 +08:00
case 1166 : case 1495 : case 1500 : case 1501 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'T' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1167 : case 1169 :
2018-08-16 18:02:51 +08:00
$$ [ $0 ] . position = 1 ;
break ;
2018-09-26 17:21:26 +08:00
case 1168 :
2018-08-16 18:02:51 +08:00
$$ [ $0 ] . position = $$ [ $0 - 2 ] . position + 1 ;
this . $ = $$ [ $0 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1170 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . position += 1 ;
break ;
2018-09-26 17:21:26 +08:00
case 1171 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . position = 1 ;
break ;
2018-09-26 17:21:26 +08:00
case 1172 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 4 ] . position += 1 ;
break ;
2018-09-26 17:21:26 +08:00
case 1173 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
$$ [ $0 - 2 ] . position += 1 ;
break ;
2018-09-26 17:21:26 +08:00
case 1174 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
$$ [ $0 - 4 ] . position += 1 ;
break ;
2018-09-26 17:21:26 +08:00
case 1175 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1176 : case 1177 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { cursorAtStart : true , position : 1 } ;
break ;
2018-09-26 17:21:26 +08:00
case 1178 : case 1179 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { position : 2 } ;
break ;
2018-09-26 17:21:26 +08:00
case 1183 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'COLREF' ] , columnReference : $$ [ $0 ] . chain } ;
break ;
2018-09-26 17:21:26 +08:00
case 1184 :
2018-08-16 18:02:51 +08:00
// We need to handle arbitrary UDFs here instead of inside UserDefinedFunction or there will be a conflict
// with columnReference for functions like: db.udf(foo)
2018-09-03 15:44:45 +08:00
var fn = $$ [ $0 - 1 ] . chain [ $$ [ $0 - 1 ] . chain . length - 1 ] . name . toLowerCase ( ) ;
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] . lastLoc . type = 'function' ;
$$ [ $0 - 1 ] . lastLoc . function = fn ;
2018-09-03 15:44:45 +08:00
if ( $$ [ $0 - 1 ] . lastLoc . location ) {
$$ [ $0 - 1 ] . lastLoc . location = {
first _line : $$ [ $0 - 1 ] . lastLoc . location . first _line ,
last _line : $$ [ $0 - 1 ] . lastLoc . location . last _line ,
first _column : $$ [ $0 - 1 ] . lastLoc . location . first _column ,
last _column : $$ [ $0 - 1 ] . lastLoc . location . last _column - 1
}
2018-08-16 18:02:51 +08:00
}
if ( $$ [ $0 - 1 ] . lastLoc !== $$ [ $0 - 1 ] . firstLoc ) {
$$ [ $0 - 1 ] . firstLoc . type = 'database' ;
} else {
delete $$ [ $0 - 1 ] . lastLoc . identifierChain ;
}
if ( $$ [ $0 ] . expression ) {
this . $ = { function : fn , expression : $$ [ $0 ] . expression , types : parser . findReturnTypes ( fn ) }
} else {
this . $ = { function : fn , types : parser . findReturnTypes ( fn ) }
}
break ;
2018-09-26 17:21:26 +08:00
case 1185 :
2018-08-16 18:02:51 +08:00
parser . addFunctionLocation ( _$ [ $0 - 1 ] , $$ [ $0 - 1 ] ) ;
if ( $$ [ $0 ] . expression ) {
this . $ = { function : $$ [ $0 - 1 ] , expression : $$ [ $0 ] . expression , types : parser . findReturnTypes ( $$ [ $0 - 1 ] ) }
} else {
this . $ = { function : $$ [ $0 - 1 ] , types : parser . findReturnTypes ( $$ [ $0 - 1 ] ) }
}
break ;
2018-09-26 17:21:26 +08:00
case 1187 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'NULL' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1188 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'TIMESTAMP' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1190 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . suggestKeywords ) {
this . $ = { types : [ 'COLREF' ] , columnReference : $$ [ $0 ] , suggestKeywords : $$ [ $0 ] . suggestKeywords } ;
} else {
this . $ = { types : [ 'COLREF' ] , columnReference : $$ [ $0 ] } ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1191 :
2018-08-16 18:02:51 +08:00
var fn = $$ [ $0 - 1 ] . chain [ $$ [ $0 - 1 ] . chain . length - 1 ] . name . toLowerCase ( ) ;
$$ [ $0 - 1 ] . lastLoc . type = 'function' ;
$$ [ $0 - 1 ] . lastLoc . function = fn ;
$$ [ $0 - 1 ] . lastLoc . location = {
first _line : $$ [ $0 - 1 ] . lastLoc . location . first _line ,
last _line : $$ [ $0 - 1 ] . lastLoc . location . last _line ,
first _column : $$ [ $0 - 1 ] . lastLoc . location . first _column ,
last _column : $$ [ $0 - 1 ] . lastLoc . location . last _column - 1
}
if ( $$ [ $0 - 1 ] . lastLoc !== $$ [ $0 - 1 ] . firstLoc ) {
$$ [ $0 - 1 ] . firstLoc . type = 'database' ;
} else {
delete $$ [ $0 - 1 ] . lastLoc . identifierChain ;
}
if ( $$ [ $0 ] . position ) {
parser . applyArgumentTypesToSuggestions ( fn , $$ [ $0 ] . position ) ;
}
this . $ = { types : parser . findReturnTypes ( fn ) } ;
break ;
2018-09-26 17:21:26 +08:00
case 1192 : case 1397 : case 1398 :
2018-08-16 18:02:51 +08:00
parser . addFunctionLocation ( _$ [ $0 - 1 ] , $$ [ $0 - 1 ] ) ;
if ( $$ [ $0 ] . position ) {
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 1 ] , $$ [ $0 ] . position ) ;
}
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 1 ] ) } ;
break ;
2018-09-26 17:21:26 +08:00
case 1195 :
2018-08-16 18:02:51 +08:00
var lastLoc = parser . yy . locations [ parser . yy . locations . length - 1 ] ;
if ( lastLoc . type !== 'variable' ) {
lastLoc . type = 'column' ;
}
// used for function references with db prefix
var firstLoc = parser . yy . locations [ parser . yy . locations . length - $$ [ $0 ] . length ] ;
this . $ = { chain : $$ [ $0 ] , firstLoc : firstLoc , lastLoc : lastLoc }
break ;
2018-09-26 17:21:26 +08:00
case 1199 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DAYS' , 'HOURS' , 'MICROSECONDS' , 'MILLISECONDS' , 'MINUTES' , 'MONTHS' , 'NANOSECONDS' , 'SECONDS' , 'WEEKS' , 'YEARS' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1204 :
2018-08-16 18:02:51 +08:00
parser . suggestValues ( $$ [ $0 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1205 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'NUMBER' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1211 : case 1213 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 1 ] + $$ [ $0 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1212 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 2 ] + $$ [ $0 - 1 ] + $$ [ $0 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1217 : case 1218 :
2018-08-16 18:02:51 +08:00
if ( /\$\{[^}]*\}/ . test ( $$ [ $0 ] ) ) {
parser . addVariableLocation ( _$ [ $0 ] , $$ [ $0 ] ) ;
this . $ = { types : [ 'STRING' ] , columnReference : [ { name : $$ [ $0 ] } ] }
} else {
this . $ = { types : [ 'STRING' ] }
}
break ;
2018-09-26 17:21:26 +08:00
case 1220 :
2018-08-16 18:02:51 +08:00
this . $ = { partialQuote : '\'' , missingEndQuote : parser . yy . missingEndQuote } ;
break ;
2018-09-26 17:21:26 +08:00
case 1221 :
2018-08-16 18:02:51 +08:00
this . $ = { partialQuote : '"' , missingEndQuote : parser . yy . missingEndQuote } ;
break ;
2018-09-26 17:21:26 +08:00
case 1226 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] ) {
parser . addColumnAliasLocation ( $$ [ $0 ] . location , $$ [ $0 ] . alias , _$ [ $0 - 1 ] ) ;
this . $ = { valueExpression : $$ [ $0 - 1 ] , alias : $$ [ $0 ] . alias } ;
if ( ! parser . yy . selectListAliases ) {
parser . yy . selectListAliases = [ ] ;
}
parser . yy . selectListAliases . push ( { name : $$ [ $0 ] . alias , types : $$ [ $0 - 1 ] . types || [ 'T' ] } ) ;
} else {
this . $ = { valueExpression : $$ [ $0 - 1 ] }
}
break ;
2018-09-26 17:21:26 +08:00
case 1227 :
2018-08-16 18:02:51 +08:00
parser . addAsteriskLocation ( _$ [ $0 ] , [ { asterisk : true } ] ) ;
this . $ = { asterisk : true }
break ;
2018-09-26 17:21:26 +08:00
case 1228 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] ) {
parser . addColumnAliasLocation ( $$ [ $0 ] . location , $$ [ $0 ] . alias , _$ [ $0 - 1 ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1229 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( ) ;
parser . suggestColumns ( ) ;
parser . addColumnAliasLocation ( _$ [ $0 ] , $$ [ $0 ] , _$ [ $0 - 2 ] ) ;
this . $ = { suggestAggregateFunctions : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1231 : case 1590 :
2018-08-16 18:02:51 +08:00
this . $ = [ $$ [ $0 ] ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1232 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . push ( $$ [ $0 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1234 : case 1235 :
2018-08-16 18:02:51 +08:00
this . $ = { cursorAtStart : true , suggestFunctions : true , suggestColumns : true , suggestAggregateFunctions : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1237 :
2018-08-16 18:02:51 +08:00
parser . checkForSelectListKeywords ( $$ [ $0 - 2 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1238 :
2018-08-16 18:02:51 +08:00
parser . checkForSelectListKeywords ( $$ [ $0 - 3 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1239 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : parser . getSelectListKeywords ( ) , suggestTables : true , suggestDatabases : true , suggestFunctions : true , suggestColumns : true , suggestAggregateFunctions : true } ;
break ;
2018-09-26 17:21:26 +08:00
case 1241 : case 1242 : case 1244 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : parser . getSelectListKeywords ( ) , suggestFunctions : true , suggestColumns : true , suggestAggregateFunctions : true , } ;
break ;
2018-09-26 17:21:26 +08:00
case 1255 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 ] ;
if ( parser . yy . latestTablePrimaries . length > 0 ) {
var idx = parser . yy . latestTablePrimaries . length - 1 ;
var tables = [ ] ;
do {
var tablePrimary = parser . yy . latestTablePrimaries [ idx ] ;
if ( ! tablePrimary . subQueryAlias ) {
tables . unshift ( tablePrimary . alias ? { identifierChain : tablePrimary . identifierChain , alias : tablePrimary . alias } : { identifierChain : tablePrimary . identifierChain } )
}
idx -- ;
} while ( idx >= 0 && tablePrimary . join && ! tablePrimary . subQueryAlias )
if ( tables . length > 0 ) {
this . $ . suggestJoins = {
prependJoin : true ,
tables : tables
} ;
}
}
break ;
2018-09-26 17:21:26 +08:00
case 1262 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] && $$ [ $0 ] . valueExpression ) {
this . $ = $$ [ $0 ] . valueExpression ;
} else {
this . $ = { } ;
}
this . $ . joinType = $$ [ $0 - 3 ] ;
if ( $$ [ $0 ] . noJoinCondition ) {
this . $ . suggestJoinConditions = { prependOn : true , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) }
}
if ( $$ [ $0 ] . suggestKeywords ) {
this . $ . suggestKeywords = $$ [ $0 ] . suggestKeywords ;
}
if ( parser . yy . latestTablePrimaries . length > 0 ) {
parser . yy . latestTablePrimaries [ parser . yy . latestTablePrimaries . length - 1 ] . join = true ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1263 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] && $$ [ $0 ] . valueExpression ) {
this . $ = $$ [ $0 ] . valueExpression ;
} else {
this . $ = { } ;
}
this . $ . joinType = $$ [ $0 - 4 ] ;
if ( $$ [ $0 ] . noJoinCondition ) {
this . $ . suggestJoinConditions = { prependOn : true , tablePrimaries : parser . yy . latestTablePrimaries . concat ( ) }
}
if ( $$ [ $0 ] . suggestKeywords ) {
this . $ . suggestKeywords = $$ [ $0 ] . suggestKeywords ;
}
if ( parser . yy . latestTablePrimaries . length > 0 ) {
parser . yy . latestTablePrimaries [ parser . yy . latestTablePrimaries . length - 1 ] . join = true ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1264 :
2018-08-16 18:02:51 +08:00
this . $ = { joinType : $$ [ $0 - 1 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1265 :
2018-08-16 18:02:51 +08:00
this . $ = { joinType : $$ [ $0 - 2 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1269 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 3 ] . suggestKeywords ) {
parser . suggestKeywords ( $$ [ $0 - 3 ] . suggestKeywords ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1270 : case 1826 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . suggestKeywords ) {
parser . suggestKeywords ( $$ [ $0 - 1 ] . suggestKeywords ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1273 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] && parser . isImpala ( ) ) {
parser . suggestKeywords ( [ '[BROADCAST]' , '[SHUFFLE]' ] ) ;
}
if ( ! $$ [ $0 - 2 ] && parser . yy . latestTablePrimaries . length > 0 ) {
var idx = parser . yy . latestTablePrimaries . length - 1 ;
var tables = [ ] ;
do {
var tablePrimary = parser . yy . latestTablePrimaries [ idx ] ;
if ( ! tablePrimary . subQueryAlias ) {
tables . unshift ( tablePrimary . alias ? { identifierChain : tablePrimary . identifierChain , alias : tablePrimary . alias } : { identifierChain : tablePrimary . identifierChain } )
}
idx -- ;
} while ( idx >= 0 && tablePrimary . join && ! tablePrimary . subQueryAlias )
if ( tables . length > 0 ) {
parser . suggestJoins ( {
prependJoin : false ,
joinType : $$ [ $0 - 3 ] ,
tables : tables
} )
}
}
parser . suggestTables ( ) ;
parser . suggestDatabases ( {
appendDot : true
} ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1278 :
2018-08-16 18:02:51 +08:00
this . $ = 'JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1279 :
2018-08-16 18:02:51 +08:00
this . $ = 'ANTI JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1280 :
2018-08-16 18:02:51 +08:00
this . $ = 'CROSS JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1281 :
2018-08-16 18:02:51 +08:00
this . $ = 'INNER JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1282 :
2018-08-16 18:02:51 +08:00
this . $ = 'OUTER JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1283 :
2018-08-16 18:02:51 +08:00
this . $ = 'SEMI JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1284 :
2018-08-16 18:02:51 +08:00
this . $ = 'FULL JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1285 :
2018-08-16 18:02:51 +08:00
this . $ = 'FULL OUTER JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1286 :
2018-08-16 18:02:51 +08:00
this . $ = 'LEFT JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1287 :
2018-08-16 18:02:51 +08:00
this . $ = 'LEFT ANTI JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1288 :
2018-08-16 18:02:51 +08:00
this . $ = 'LEFT INNER JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1289 :
2018-08-16 18:02:51 +08:00
this . $ = 'LEFT OUTER JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1290 :
2018-08-16 18:02:51 +08:00
this . $ = 'LEFT SEMI JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1291 :
2018-08-16 18:02:51 +08:00
this . $ = 'RIGHT JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1292 :
2018-08-16 18:02:51 +08:00
this . $ = 'RIGHT ANTI JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1293 : case 1294 :
2018-08-16 18:02:51 +08:00
this . $ = 'RIGHT OUTER JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1295 :
2018-08-16 18:02:51 +08:00
this . $ = 'RIGHT SEMI JOIN' ;
break ;
2018-09-26 17:21:26 +08:00
case 1296 : case 1297 : case 1298 : case 1299 : case 1300 : case 1301 : case 1303 : case 1304 : case 1305 : case 1306 : case 1308 : case 1309 : case 1310 : case 1311 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'JOIN' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1302 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'OUTER' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1307 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : parser . isImpala ( ) ? [ 'ANTI' , 'INNER' , 'OUTER' , 'SEMI' ] : parser . isHive ( ) ? [ 'OUTER' , 'SEMI' ] : [ 'OUTER' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1312 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : parser . isImpala ( ) ? [ 'ANTI' , 'INNER' , 'OUTER' , 'SEMI' ] : [ 'OUTER' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1313 :
2018-08-16 18:02:51 +08:00
this . $ = { noJoinCondition : true , suggestKeywords : parser . isImpala ( ) ? [ 'ON' , 'USING' ] : [ 'ON' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1314 :
2018-08-16 18:02:51 +08:00
this . $ = { valueExpression : $$ [ $0 ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1315 : case 2121 :
2018-08-16 18:02:51 +08:00
this . $ = { } ;
break ;
2018-09-26 17:21:26 +08:00
case 1319 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestJoinConditions ( { prependOn : false } ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1320 :
2018-08-16 18:02:51 +08:00
this . $ = {
primary : $$ [ $0 - 3 ]
}
if ( $$ [ $0 - 3 ] . identifierChain ) {
if ( $$ [ $0 - 1 ] ) {
$$ [ $0 - 3 ] . alias = $$ [ $0 - 1 ] . alias
parser . addTableAliasLocation ( $$ [ $0 - 1 ] . location , $$ [ $0 - 1 ] . alias , $$ [ $0 - 3 ] . identifierChain ) ;
}
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
}
var keywords = [ ] ;
if ( $$ [ $0 ] && $$ [ $0 ] . suggestKeywords ) {
keywords = $$ [ $0 ] . suggestKeywords ;
} else {
// Right-to-left for cursor after TablePrimary
keywords = parser . getKeywordsForOptionalsLR ( [ $$ [ $0 ] , $$ [ $0 - 1 ] , $$ [ $0 - 2 ] ] , [ { value : 'TABLESAMPLE' , weight : 1 } , { value : 'AS' , weight : 2 } , { value : 'TABLESAMPLE' , weight : 3 } ] , [ parser . isImpala ( ) , true , parser . isHive ( ) ] ) ;
}
if ( keywords . length > 0 ) {
this . $ . suggestKeywords = keywords ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1321 :
2018-08-16 18:02:51 +08:00
this . $ = {
primary : $$ [ $0 - 2 ]
} ;
if ( $$ [ $0 - 1 ] ) {
2018-09-03 16:25:47 +08:00
if ( this . $ . primary ) {
this . $ . primary . alias = $$ [ $0 - 1 ] . alias ;
parser . addTablePrimary ( { subQueryAlias : $$ [ $0 - 1 ] . alias } ) ;
parser . addSubqueryAliasLocation ( $$ [ $0 - 1 ] . location , $$ [ $0 - 1 ] . alias , $$ [ $0 - 2 ] . identifierChain ) ;
}
2018-08-16 18:02:51 +08:00
}
var keywords = [ ] ;
if ( $$ [ $0 ] && $$ [ $0 ] . suggestKeywords ) {
keywords = $$ [ $0 ] . suggestKeywords ;
} else {
keywords = parser . getKeywordsForOptionalsLR ( [ $$ [ $0 ] , $$ [ $0 - 1 ] ] , [ { value : 'TABLESAMPLE' , weight : 1 } , { value : 'AS' , weight : 2 } ] , [ parser . isImpala ( ) , true ] ) ;
}
if ( keywords . length > 0 ) {
this . $ . suggestKeywords = keywords ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1322 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] ) {
parser . addTableAliasLocation ( $$ [ $0 - 1 ] . location , $$ [ $0 - 1 ] . alias , $$ [ $0 - 3 ] . identifierChain ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1323 : case 1324 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] ) {
$$ [ $0 - 3 ] . alias = $$ [ $0 - 1 ] . alias ;
parser . addTableAliasLocation ( $$ [ $0 - 1 ] . location , $$ [ $0 - 1 ] . alias , $$ [ $0 - 3 ] . identifierChain ) ;
}
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1325 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] ) {
parser . addTablePrimary ( { subQueryAlias : $$ [ $0 - 1 ] . alias } ) ;
parser . addSubqueryAliasLocation ( $$ [ $0 - 1 ] . location , $$ [ $0 - 1 ] . alias ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1336 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'BUCKET' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1337 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OUT OF' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1338 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OF' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1339 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'ON' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1341 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . indexOf ( '.' ) === - 1 ) {
parser . suggestKeywords ( [ 'PERCENT' , 'ROWS' ] ) ;
} else {
parser . suggestKeywords ( [ 'PERCENT' ] ) ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1343 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'REPEATABLE()' ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1345 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SYSTEM()' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1350 :
2018-08-16 18:02:51 +08:00
parser . pushQueryState ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1351 :
2018-08-16 18:02:51 +08:00
parser . popQueryState ( ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1353 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] ) {
$$ [ $0 - 2 ] . alias = $$ [ $0 - 1 ] . alias ;
parser . addTablePrimary ( { subQueryAlias : $$ [ $0 - 1 ] . alias } ) ;
parser . addSubqueryAliasLocation ( $$ [ $0 - 1 ] . location , $$ [ $0 - 1 ] . alias , $$ [ $0 - 2 ] . identifierChain ) ;
}
this . $ = $$ [ $0 - 2 ] ;
break ;
2018-09-26 17:21:26 +08:00
case 1356 :
2018-08-16 18:02:51 +08:00
var subQuery = parser . getSubQuery ( $$ [ $0 ] ) ;
2018-09-03 16:25:47 +08:00
if ( subQuery ) {
subQuery . columns . forEach ( function ( column ) {
parser . expandIdentifierChain ( { wrapper : column } ) ;
delete column . linked ;
2018-08-16 18:02:51 +08:00
} ) ;
2018-09-03 16:25:47 +08:00
}
2018-08-16 18:02:51 +08:00
parser . popQueryState ( subQuery ) ;
this . $ = subQuery ;
break ;
2018-09-26 17:21:26 +08:00
case 1373 : case 1374 :
2018-08-16 18:02:51 +08:00
this . $ = { alias : $$ [ $0 ] , location : _$ [ $0 ] } ;
break ;
2018-09-26 17:21:26 +08:00
case 1379 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] && $$ [ $0 ] . lateralView ) {
$$ [ $0 - 1 ] . lateralViews . push ( $$ [ $0 ] . lateralView ) ;
this . $ = $$ [ $0 - 1 ] ;
} else if ( $$ [ $0 ] . lateralView ) {
this . $ = { lateralViews : [ $$ [ $0 ] . lateralView ] } ;
}
if ( $$ [ $0 ] . suggestKeywords ) {
this . $ . suggestKeywords = $$ [ $0 ] . suggestKeywords
}
break ;
2018-09-26 17:21:26 +08:00
case 1381 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] ) {
$$ [ $0 - 1 ] . suggestKeywords = [ 'OVER' ] ;
}
break ;
2018-09-26 17:21:26 +08:00
case 1390 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OVER' ] ) ;
break ;
2018-09-26 17:21:26 +08:00
case 1395 : case 1396 :
2018-08-16 18:02:51 +08:00
parser . addFunctionLocation ( _$ [ $0 - 1 ] , $$ [ $0 - 1 ] ) ;
if ( $$ [ $0 ] . expression ) {
this . $ = { function : $$ [ $0 - 1 ] , expression : $$ [ $0 ] . expression , types : parser . findReturnTypes ( $$ [ $0 - 1 ] ) }
} else {
this . $ = { function : $$ [ $0 - 1 ] , types : parser . findReturnTypes ( $$ [ $0 - 1 ] ) }
}
break ;
2018-12-10 16:10:37 +08:00
case 1409 :
this . $ = { expression : $$ [ $0 - 2 ] } ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 1410 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { position : 1 }
break ;
2018-12-10 16:10:37 +08:00
case 1411 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1419 : case 1507 : case 1573 :
2018-08-16 18:02:51 +08:00
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 2 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1420 :
2018-08-16 18:02:51 +08:00
this . $ = { function : $$ [ $0 - 3 ] , expression : $$ [ $0 - 2 ] , types : parser . findReturnTypes ( $$ [ $0 - 3 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1421 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 3 ] , 1 ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 3 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1422 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1423 :
2018-08-16 18:02:51 +08:00
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 3 ] , $$ [ $0 - 1 ] . position ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 3 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1431 : case 1432 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestFunctions ) {
parser . suggestAggregateFunctions ( ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1433 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'PARTITION BY' , weight : 2 } , { value : 'ORDER BY' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'PARTITION BY' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1434 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] , [ { value : 'ORDER BY' , weight : 2 } ] ) ;
} else {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1438 : case 1757 : case 2240 : case 2241 : case 2244 : case 2254 : case 2288 : case 2297 : case 2315 : case 2372 : case 2373 : case 2378 : case 2383 : case 2387 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'BY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1443 :
2018-08-16 18:02:51 +08:00
// Only allowed in last order by
delete parser . yy . result . suggestAnalyticFunctions ;
break ;
2018-12-10 16:10:37 +08:00
case 1444 :
2018-08-16 18:02:51 +08:00
var keywords = [ ] ;
if ( $$ [ $0 - 2 ] . suggestKeywords ) {
keywords = parser . createWeightedKeywords ( $$ [ $0 - 2 ] . suggestKeywords , 2 ) ;
}
if ( ! $$ [ $0 ] ) {
keywords = keywords . concat ( [ { value : 'RANGE BETWEEN' , weight : 1 } , { value : 'ROWS BETWEEN' , weight : 1 } ] ) ;
}
parser . suggestKeywords ( keywords ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1450 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( parser . isHive ( ) ? [ 'BETWEEN' , 'UNBOUNDED' ] : [ 'BETWEEN' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1451 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'CURRENT ROW' , 'UNBOUNDED PRECEDING' ] ) ;
} else if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'AND' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1454 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] && parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'PRECEDING' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1456 :
2018-08-16 18:02:51 +08:00
lexer . popState ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1457 :
2018-08-16 18:02:51 +08:00
lexer . begin ( 'hdfs' ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1459 :
2018-08-16 18:02:51 +08:00
parser . suggestHdfs ( { path : $$ [ $0 - 3 ] } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1460 :
2018-08-16 18:02:51 +08:00
parser . suggestHdfs ( { path : $$ [ $0 - 2 ] } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1461 :
2018-08-16 18:02:51 +08:00
parser . suggestHdfs ( { path : $$ [ $0 - 1 ] } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1462 :
2018-08-16 18:02:51 +08:00
parser . suggestHdfs ( { path : '' } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1463 :
2018-08-16 18:02:51 +08:00
parser . suggestHdfs ( { path : '' } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1469 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'PRECEDING' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1470 : case 1480 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ROW' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1479 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'CURRENT ROW' , 'UNBOUNDED FOLLOWING' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1481 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FOLLOWING' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1487 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestAggregateFunctions ( ) ;
parser . suggestSelectListAliases ( true ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1488 :
2018-08-16 18:02:51 +08:00
parser . suggestAggregateFunctions ( ) ;
parser . suggestSelectListAliases ( true ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1494 : case 1499 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ $$ [ $0 - 1 ] . toUpperCase ( ) ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1496 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { types : [ $$ [ $0 - 1 ] . toUpperCase ( ) ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1497 : case 1498 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { types : [ 'T' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1502 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] , [ { value : 'AS' , weight : 2 } ] ) ;
this . $ = { types : [ $$ [ $0 - 1 ] . toUpperCase ( ) ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1503 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ { value : 'AS' , weight : 2 } ] ) ;
this . $ = { types : [ 'T' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1504 : case 1505 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( parser . getTypeKeywords ( ) ) ;
this . $ = { types : [ 'T' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1506 : case 1528 :
2018-08-16 18:02:51 +08:00
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 3 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1508 : case 1529 : case 1572 :
2018-08-16 18:02:51 +08:00
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1509 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! $$ [ $0 - 2 ] ) {
keywords . push ( 'DISTINCT' ) ;
if ( parser . isImpala ( ) ) {
keywords . push ( 'ALL' ) ;
}
if ( parser . yy . result . suggestKeywords ) {
keywords = parser . yy . result . suggestKeywords . concat ( keywords ) ;
}
}
parser . suggestKeywords ( keywords ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1510 : case 1531 : case 1575 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 5 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1511 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . cursorAtStart ) {
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! $$ [ $0 - 2 ] ) {
keywords . push ( 'DISTINCT' ) ;
if ( parser . isImpala ( ) ) {
keywords . push ( 'ALL' ) ;
}
}
parser . suggestKeywords ( keywords ) ;
}
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1512 : case 1516 :
2018-08-16 18:02:51 +08:00
this . $ = { types : [ 'INT' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1513 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DAY' , 'DAYOFWEEK' , 'HOUR' , 'MINUTE' , 'MONTH' , 'QUARTER' , 'SECOND' , 'WEEK' , 'YEAR' ] ) ;
this . $ = { types : [ 'INT' ] }
break ;
2018-12-10 16:10:37 +08:00
case 1514 : case 1518 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FROM' ] ) ;
this . $ = { types : [ 'INT' ] }
break ;
2018-12-10 16:10:37 +08:00
case 1515 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { types : [ 'INT' ] }
break ;
2018-12-10 16:10:37 +08:00
case 1517 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DAY' , 'DAYOFWEEK' , 'HOUR' , 'MINUTE' , 'MONTH' , 'QUARTER' , 'SECOND' , 'WEEK' , 'YEAR' ] ) ;
this . $ = { types : [ 'INT' ] }
break ;
2018-12-10 16:10:37 +08:00
case 1530 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
var keywords = parser . getSelectListKeywords ( true ) ;
if ( ! $$ [ $0 - 2 ] ) {
if ( $$ [ $0 - 4 ] . toLowerCase ( ) === 'group_concat' ) {
keywords . push ( 'ALL' ) ;
} else if ( parser . isImpala ( ) ) {
keywords . push ( 'ALL' ) ;
keywords . push ( 'DISTINCT' ) ;
} else {
keywords . push ( 'DISTINCT' ) ;
}
}
if ( parser . yy . result . suggestKeywords ) {
keywords = parser . yy . result . suggestKeywords . concat ( keywords ) ;
}
parser . suggestKeywords ( keywords ) ;
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 4 ] , 1 ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1532 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . cursorAtStart ) {
var keywords = parser . getSelectListKeywords ( true ) ;
if ( ! $$ [ $0 - 2 ] ) {
if ( $$ [ $0 - 4 ] . toLowerCase ( ) === 'group_concat' ) {
keywords . push ( 'ALL' ) ;
} else if ( parser . isImpala ( ) ) {
keywords . push ( 'ALL' ) ;
keywords . push ( 'DISTINCT' ) ;
} else {
keywords . push ( 'DISTINCT' ) ;
}
}
if ( parser . yy . result . suggestKeywords ) {
keywords = parser . yy . result . suggestKeywords . concat ( keywords ) ;
}
parser . suggestKeywords ( keywords ) ;
}
if ( parser . yy . result . suggestFunctions && ! parser . yy . result . suggestFunctions . types ) {
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 4 ] , $$ [ $0 - 1 ] . position ) ;
}
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1558 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . toLowerCase ( ) === 'from' ? [ 'STRING' ] : [ 'TIMESTAMP' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 5 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1559 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 1 ] . toLowerCase ( ) === 'from' ? [ 'STRING' ] : [ 'TIMESTAMP' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1560 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyTypeToSuggestions ( [ 'STRING' , 'TIMESTAMP' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 3 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1561 :
2018-08-16 18:02:51 +08:00
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . toLowerCase ( ) === 'from' ? [ 'STRING' ] : [ 'TIMESTAMP' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 5 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1562 :
2018-08-16 18:02:51 +08:00
parser . applyTypeToSuggestions ( $$ [ $0 - 1 ] . toLowerCase ( ) === 'from' ? [ 'STRING' ] : [ 'TIMESTAMP' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1563 :
2018-08-16 18:02:51 +08:00
parser . applyTypeToSuggestions ( [ 'STRING' , 'TIMESTAMP' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 3 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1564 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . toLowerCase ( ) === 'from' ? [ 'TIMESTAMP' ] : [ 'STRING' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 5 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1565 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyTypeToSuggestions ( $$ [ $0 - 1 ] . toLowerCase ( ) === 'from' ? [ 'TIMESTAMP' ] : [ 'STRING' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1566 :
2018-08-16 18:02:51 +08:00
parser . applyTypeToSuggestions ( $$ [ $0 - 2 ] . toLowerCase ( ) === 'from' ? [ 'TIMESTAMP' ] : [ 'STRING' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 5 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1567 :
2018-08-16 18:02:51 +08:00
parser . applyTypeToSuggestions ( $$ [ $0 - 1 ] . toLowerCase ( ) === 'from' ? [ 'TIMESTAMP' ] : [ 'STRING' ] ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1568 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 3 ] . types [ 0 ] === 'STRING' ) {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] , [ 'FROM' ] ) ;
} else {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] ) ;
}
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 5 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1569 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . types [ 0 ] === 'STRING' ) {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ 'FROM' ] ) ;
} else {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] ) ;
}
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1574 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 4 ] , 1 ) ;
var keywords = parser . getSelectListKeywords ( true ) ;
if ( ! $$ [ $0 - 2 ] ) {
keywords . push ( 'DISTINCT' ) ;
if ( parser . isImpala ( ) ) {
keywords . push ( 'ALL' ) ;
}
}
if ( parser . yy . result . suggestKeywords ) {
keywords = parser . yy . result . suggestKeywords . concat ( keywords ) ;
}
parser . suggestKeywords ( keywords ) ;
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1576 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestFunctions && ! parser . yy . result . suggestFunctions . types ) {
parser . applyArgumentTypesToSuggestions ( $$ [ $0 - 4 ] , 1 ) ;
}
this . $ = { types : parser . findReturnTypes ( $$ [ $0 - 4 ] ) } ;
break ;
2018-12-10 16:10:37 +08:00
case 1577 :
2018-08-16 18:02:51 +08:00
this . $ = { lateralView : { udtf : $$ [ $0 - 2 ] , tableAlias : $$ [ $0 - 1 ] , columnAliases : $$ [ $0 ] } } ;
break ;
2018-12-10 16:10:37 +08:00
case 1578 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . function . toLowerCase ( ) === 'explode' ) {
this . $ = { lateralView : { udtf : $$ [ $0 - 1 ] , tableAlias : $$ [ $0 ] , columnAliases : [ 'key' , 'value' ] } , suggestKeywords : [ 'AS' ] } ;
} else if ( $$ [ $0 - 1 ] . function . toLowerCase ( ) === 'posexplode' ) {
this . $ = { lateralView : { udtf : $$ [ $0 - 1 ] , tableAlias : $$ [ $0 ] , columnAliases : [ 'pos' , 'val' ] } , suggestKeywords : [ 'AS' ] } ;
} else {
this . $ = { lateralView : { udtf : $$ [ $0 - 1 ] , tableAlias : $$ [ $0 ] , columnAliases : [ ] } , suggestKeywords : [ 'AS' ] } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1579 :
2018-08-16 18:02:51 +08:00
this . $ = { lateralView : { udtf : $$ [ $0 - 1 ] , columnAliases : $$ [ $0 ] } } ;
break ;
2018-12-10 16:10:37 +08:00
case 1586 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'OUTER' , weight : 2 } , { value : 'explode' , weight : 1 } , { value : 'posexplode' , weight : 1 } ] ) ;
} else {
parser . suggestKeywords ( [ 'explode' , 'posexplode' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1587 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'VIEW' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1591 :
2018-08-16 18:02:51 +08:00
this . $ = [ $$ [ $0 - 2 ] , $$ [ $0 ] ] ;
break ;
2018-12-10 16:10:37 +08:00
case 1595 :
2018-08-16 18:02:51 +08:00
this . $ = { inValueEdit : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1596 :
2018-08-16 18:02:51 +08:00
this . $ = { inValueEdit : true , cursorAtStart : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1597 : case 1598 : case 1599 : case 1600 : case 1601 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'NOT' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1607 : case 1608 : case 1609 : case 1610 : case 1611 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( { types : [ 'STRING' ] } ) ;
parser . suggestColumns ( { types : [ 'STRING' ] } ) ;
this . $ = { types : [ 'BOOLEAN' ] }
break ;
2018-12-10 16:10:37 +08:00
case 1612 : case 1614 :
2018-08-16 18:02:51 +08:00
this . $ = parser . findCaseType ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1613 : case 1616 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 3 ] . caseTypes . push ( $$ [ $0 - 1 ] ) ;
this . $ = parser . findCaseType ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1615 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 1 ] , [ 'END' ] ) ;
$$ [ $0 - 3 ] . caseTypes . push ( $$ [ $0 - 1 ] ) ;
this . $ = parser . findCaseType ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1617 :
2018-08-16 18:02:51 +08:00
this . $ = parser . findCaseType ( $$ [ $0 - 2 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1618 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . toLowerCase ( ) !== 'end' ) {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] , [ { value : 'END' , weight : 3 } , { value : 'ELSE' , weight : 2 } , { value : 'WHEN' , weight : 1 } ] ) ;
} else {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 3 ] , [ { value : 'ELSE' , weight : 2 } , { value : 'WHEN' , weight : 1 } ] ) ;
}
this . $ = parser . findCaseType ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1619 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . toLowerCase ( ) !== 'end' ) {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ { value : 'END' , weight : 3 } , { value : 'ELSE' , weight : 2 } , { value : 'WHEN' , weight : 1 } ] ) ;
} else {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ { value : 'ELSE' , weight : 2 } , { value : 'WHEN' , weight : 1 } ] ) ;
}
this . $ = parser . findCaseType ( $$ [ $0 - 2 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1620 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 3 ] . caseTypes . push ( $$ [ $0 - 1 ] ) ;
this . $ = parser . findCaseType ( $$ [ $0 - 3 ] ) ;
this . $ . suggestFilters = $$ [ $0 - 1 ] . suggestFilters
break ;
2018-12-10 16:10:37 +08:00
case 1621 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = parser . findCaseType ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1622 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { types : [ 'T' ] , typeSet : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1623 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = $$ [ $0 - 1 ] ;
break ;
2018-12-10 16:10:37 +08:00
case 1624 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = { types : [ 'T' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1627 :
2018-08-16 18:02:51 +08:00
this . $ = { caseTypes : [ $$ [ $0 ] ] , lastType : $$ [ $0 ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1628 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] . caseTypes . push ( $$ [ $0 ] ) ;
this . $ = { caseTypes : $$ [ $0 - 1 ] . caseTypes , lastType : $$ [ $0 ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1632 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ 'WHEN' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1635 :
2018-08-16 18:02:51 +08:00
this . $ = { caseTypes : [ { types : [ 'T' ] } ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-12-10 16:10:37 +08:00
case 1636 :
2018-08-16 18:02:51 +08:00
this . $ = { caseTypes : [ { types : [ 'T' ] } ] , suggestFilters : $$ [ $0 - 1 ] . suggestFilters } ;
break ;
2018-12-10 16:10:37 +08:00
case 1637 :
2018-08-16 18:02:51 +08:00
this . $ = { caseTypes : [ $$ [ $0 ] ] , suggestFilters : $$ [ $0 - 2 ] . suggestFilters } ;
break ;
2018-12-10 16:10:37 +08:00
case 1638 : case 1639 :
2018-08-16 18:02:51 +08:00
this . $ = { caseTypes : [ $$ [ $0 ] ] , suggestFilters : $$ [ $0 ] . suggestFilters } ;
break ;
2018-12-10 16:10:37 +08:00
case 1640 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1641 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = { caseTypes : [ $$ [ $0 ] ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1642 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1643 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestKeywords ( [ 'WHEN' ] ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1644 : case 1646 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] , suggestFilters : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1645 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
parser . suggestKeywords ( [ 'THEN' ] ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] , suggestFilters : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1647 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { caseTypes : [ $$ [ $0 ] ] , suggestFilters : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 1648 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 1 ] , [ 'THEN' ] ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1649 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 2 ] , [ 'THEN' ] ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1650 : case 1651 : case 1652 : case 1653 :
2018-08-16 18:02:51 +08:00
parser . valueExpressionSuggest ( ) ;
this . $ = { caseTypes : [ { types : [ 'T' ] } ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 1668 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'DATABASE' , 'INDEX' , 'SCHEMA' , 'TABLE' , 'VIEW' ] ) ;
} else {
parser . suggestKeywords ( [ 'TABLE' , 'VIEW' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1669 : case 1671 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 3 ] , [ { name : $$ [ $0 - 3 ] } ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1670 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 2 ] , [ { name : $$ [ $0 - 2 ] } ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1672 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestDatabases ( ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1673 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 1 ] , [ { name : $$ [ $0 - 1 ] } ] ) ;
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'SET DBPROPERTIES' , 'SET LOCATION' , 'SET OWNER' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1674 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 2 ] , [ { name : $$ [ $0 - 2 ] } ] ) ;
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'DBPROPERTIES' , 'LOCATION' , 'OWNER' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1675 : case 1969 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 2 ] , [ { name : $$ [ $0 - 2 ] } ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1676 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 3 ] , [ { name : $$ [ $0 - 3 ] } ] ) ;
parser . suggestKeywords ( [ 'GROUP' , 'ROLE' , 'USER' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1677 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 3 ] , [ { name : $$ [ $0 - 3 ] } ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 1679 : case 1762 : case 2316 : case 2691 : case 3016 : case 3228 : case 3244 : case 3246 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ON' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1683 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'PARTITION' , 'REBUILD' ] ) ;
} else {
parser . suggestKeywords ( [ 'REBUILD' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1704 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] && parser . isImpala ( ) ) {
parser . suggestKeywords ( [ { value : 'IF NOT EXISTS' , weight : 4 } , { value : 'COLUMNS' , weight : 3 } , { value : 'PARTITION' , weight : 2 } , { value : 'RANGE PARTITION' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 1 ] && parser . isHive ( ) ) {
parser . suggestKeywords ( [ { value : 'IF NOT EXISTS' , weight : 3 } , { value : 'COLUMNS' , weight : 2 } , { value : 'CONSTRAINT' , weight : 1 } , { value : 'PARTITION' , weight : 1 } ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ { value : 'PARTITION' , weight : 2 } , { value : 'RANGE PARTITION' , weight : 1 } ] ) ;
} else if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1705 : case 1726 : case 1996 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'COLUMNS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1710 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
if ( ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'LOCATION' , 'PARTITION' ] ) ;
} else if ( $$ [ $0 - 2 ] && $$ [ $0 - 2 ] . suggestKeywords ) {
var keywords = parser . createWeightedKeywords ( $$ [ $0 - 2 ] . suggestKeywords , 2 ) ;
keywords . push ( { value : 'PARTITION' , weight : 1 } ) ;
parser . suggestKeywords ( keywords ) ;
} else {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
} else if ( parser . isImpala ( ) ) {
if ( ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'LOCATION' , 'CACHED IN' , 'UNCACHED' ] ) ;
} else if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'CACHED IN' , 'UNCACHED' ] ) ;
} else if ( $$ [ $0 - 1 ] && $$ [ $0 - 1 ] . suggestKeywords ) {
parser . suggestKeywords ( $$ [ $0 - 1 ] . suggestKeywords ) ;
}
}
break ;
2018-12-29 11:47:29 +08:00
case 1712 : case 1745 : case 1753 : case 1765 : case 1843 : case 1869 : case 3300 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1713 : case 1870 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'VALUE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1717 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FOREIGN KEY' , 'PRIMARY KEY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1724 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'ADD COLUMNS' , 'ADD IF NOT EXISTS' , 'ADD PARTITION' , 'ARCHIVE PARTITION' , 'CHANGE' ,
'CLUSTERED BY' , 'CONCATENATE' , 'COMPACT' , 'DISABLE NO_DROP' , 'DISABLE OFFLINE' , 'DROP' , 'ENABLE NO_DROP' ,
'ENABLE OFFLINE' , 'EXCHANGE PARTITION' , 'NOT SKEWED' , 'NOT STORED AS DIRECTORIES' , 'PARTITION' ,
'RECOVER PARTITIONS' , 'RENAME TO' , 'REPLACE COLUMNS' , 'SET FILEFORMAT' , 'SET LOCATION' , 'SET OWNER' , 'SET SERDE' ,
'SET SERDEPROPERTIES' , 'SET SKEWED LOCATION' , 'SET TBLPROPERTIES' , 'SKEWED BY' , 'TOUCH' , 'UNARCHIVE PARTITION' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'ADD COLUMNS' , 'ADD PARTITION' , 'ADD RANGE PARTITION' , 'ALTER' , 'ALTER COLUMN' , 'CHANGE' ,
'DROP COLUMN' , 'DROP PARTITION' , 'DROP RANGE PARTITION' , 'PARTITION' , 'RECOVER PARTITIONS' , 'RENAME TO' ,
'REPLACE COLUMNS' , 'SET CACHED IN' , 'SET COLUMN STATS' , 'SET FILEFORMAT' , 'SET LOCATION' , 'SET ROW FORMAT' ,
'SET SERDEPROPERTIES' , 'SET TBLPROPERTIES' , 'SET UNCACHED' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1725 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'ADD COLUMNS' , 'CHANGE' , 'COMPACT' , 'CONCATENATE' , 'DISABLE NO_DROP' , 'DISABLE OFFLINE' ,
'ENABLE NO_DROP' , 'ENABLE OFFLINE' , 'RENAME TO PARTITION' , 'REPLACE COLUMNS' , 'SET FILEFORMAT' , 'SET LOCATION' ,
'SET SERDE' , 'SET SERDEPROPERTIES' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'SET CACHED IN' , 'SET FILEFORMAT' , 'SET LOCATION' , 'SET ROW FORMAT' ,
'SET SERDEPROPERTIES' , 'SET TBLPROPERTIES' , 'SET UNCACHED' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1727 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'FILEFORMAT' , 'LOCATION' , 'SERDE' , 'SERDEPROPERTIES' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'CACHED IN' , 'FILEFORMAT' , 'LOCATION' , 'ROW FORMAT' , 'SERDEPROPERTIES' , 'TBLPROPERTIES' , 'UNCACHED' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1728 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'FILEFORMAT' , 'LOCATION' , 'OWNER' , 'SERDE' , 'SERDEPROPERTIES' , 'SKEWED LOCATION' , 'TBLPROPERTIES' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'CACHED IN' , 'COLUMN STATS' , 'FILEFORMAT' , 'LOCATION' , 'ROW FORMAT' , 'SERDEPROPERTIES' , 'TBLPROPERTIES' , 'UNCACHED' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1730 : case 1957 : case 2749 : case 2765 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TO' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1732 : case 1754 : case 2249 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'PARTITIONS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1749 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'SKEWED' , 'STORED AS DIRECTORIES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1750 : case 1946 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'AS DIRECTORIES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1751 : case 1947 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DIRECTORIES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1752 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TO PARTITION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1755 : case 2429 : case 2448 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'LOCATION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1758 : case 2745 : case 2750 : case 2754 : case 2821 : case 2822 : case 2823 : case 2856 : case 2864 : case 2867 : case 2870 : case 2875 : case 2878 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'GROUP' , 'ROLE' , 'USER' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1763 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'STORED AS DIRECTORIES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1767 : case 1774 : case 1808 : case 1811 : case 1813 :
2018-08-16 18:02:51 +08:00
parser . addColumnLocation ( $$ [ $0 - 3 ] . location , [ $$ [ $0 - 3 ] . identifier ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1768 :
2018-08-16 18:02:51 +08:00
parser . addColumnLocation ( $$ [ $0 - 2 ] . location , [ $$ [ $0 - 2 ] . identifier ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1769 : case 1777 : case 1778 :
2018-08-16 18:02:51 +08:00
parser . addColumnLocation ( $$ [ $0 - 1 ] . location , [ $$ [ $0 - 1 ] . identifier ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1770 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'COLUMN' ] ) ;
}
parser . suggestColumns ( ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1771 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'DROP DEFAULT' , 'SET BLOCK_SIZE' , 'SET COMMENT' , 'SET COMPRESSION' , 'SET DEFAULT' ,
'SET ENCODING' ] ) ;
parser . addColumnLocation ( $$ [ $0 - 1 ] . location , [ $$ [ $0 - 1 ] . identifier ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1772 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'DEFAULT' ] ) ;
parser . addColumnLocation ( $$ [ $0 - 2 ] . location , [ $$ [ $0 - 2 ] . identifier ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1773 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'BLOCK_SIZE' , 'COMMENT' , 'COMPRESSION' , 'DEFAULT' , 'ENCODING' ] ) ;
parser . addColumnLocation ( $$ [ $0 - 2 ] . location , [ $$ [ $0 - 2 ] . identifier ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 1775 : case 2026 : case 2673 : case 3177 : case 3301 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'STATS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1795 :
2018-08-16 18:02:51 +08:00
parser . suggestIdentifiers ( [ '\'avgSize\'' , '\'maxSize\'' , '\'numDVs\'' , '\'numNulls\'' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1810 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'COLUMN' ] ) ;
}
parser . suggestColumns ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1812 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
if ( $$ [ $0 - 3 ] . suggestKeywords ) {
var keywords = parser . createWeightedKeywords ( $$ [ $0 - 3 ] . suggestKeywords , 3 ) ;
keywords = keywords . concat ( [ { value : 'AFTER' , weight : 2 } , { value : 'FIRST' , weight : 2 } , { value : 'CASCADE' , weight : 1 } , { value : 'RESTRICT' , weight : 1 } ] ) ;
parser . suggestKeywords ( keywords ) ;
} else {
parser . suggestKeywords ( [ { value : 'AFTER' , weight : 2 } , { value : 'FIRST' , weight : 2 } , { value : 'CASCADE' , weight : 1 } , { value : 'RESTRICT' , weight : 1 } ] ) ;
}
} else if ( parser . isHive ( ) && $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'CASCADE' , 'RESTRICT' ] ) ;
}
parser . addColumnLocation ( $$ [ $0 - 4 ] . location , [ $$ [ $0 - 4 ] . identifier ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1814 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'AND WAIT' , 'WITH OVERWRITE TBLPROPERTIES' ] ) ;
} else if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'WITH OVERWRITE TBLPROPERTIES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1817 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'NO_DROP' , 'OFFLINE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1819 : case 2336 :
2018-08-16 18:02:51 +08:00
parser . suggestFileFormats ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1822 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'WITH REPLICATION =' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1824 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'FORMAT' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 1825 : case 2962 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DELIMITED' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1828 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'WITH SERDEPROPERTIES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1832 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'WAIT' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1835 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OVERWRITE TBLPROPERTIES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1836 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TBLPROPERTIES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1839 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'CASCADE' , 'RESTRICT' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1844 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'WITH TABLE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 1845 : case 1964 : case 1978 : case 2541 : case 2565 : case 2705 : case 3096 : case 3105 : case 3232 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TABLE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1863 :
2018-08-16 18:02:51 +08:00
parser . addColumnLocation ( $$ [ $0 ] . location , [ $$ [ $0 ] . identifier ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1864 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'CONSTRAINT' , weight : 1 } , { value : 'PARTITION' , weight : 1 } , { value : 'IF EXISTS' , weight : 2 } ] ) ;
} else if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
} else if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'COLUMN' , weight : 1 } , { value : 'PARTITION' , weight : 1 } , { value : 'RANGE PARTITION' , weight : 1 } , { value : 'IF EXISTS' , weight : 2 } ] ) ;
parser . suggestColumns ( ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'PARTITION' , 'RANGE PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1866 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'PURGE' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1877 : case 1980 : case 2682 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestTables ) {
parser . yy . result . suggestTables . onlyTables = true ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1878 : case 1965 : case 1979 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( { onlyTables : true } ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1903 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'CASCADE' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1911 : case 1912 : case 1913 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1929 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'LOCATION' ] } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1953 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'AS' , 'SET TBLPROPERTIES' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'AS' , 'RENAME TO' ] ) ;
} else {
parser . suggestKeywords ( [ 'AS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1954 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'TBLPROPERTIES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1960 : case 1966 : case 2703 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestTables ) {
parser . yy . result . suggestTables . onlyViews = true ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1961 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( { onlyViews : true } ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1963 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'REPAIR TABLE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1968 : case 2440 : case 2651 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FUNCTION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1970 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ON DATABASE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1971 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DATABASE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1973 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 1 ] , [ { name : $$ [ $0 - 1 ] } ] ) ;
parser . suggestKeywords ( [ 'IS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1974 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 - 2 ] , [ { name : $$ [ $0 - 2 ] } ] ) ;
parser . suggestKeywords ( [ 'NULL' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1977 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 6 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1982 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'PARTITION' , weight : 2 } , { value : 'COMPUTE STATISTICS' , weight : 1 } ] ) ;
} else {
parser . suggestKeywords ( [ 'COMPUTE STATISTICS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 1983 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
parser . suggestKeywords ( [ 'STATISTICS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1984 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 7 ] ) ;
parser . suggestKeywords ( parser . getKeywordsForOptionalsLR ( [ $$ [ $0 - 2 ] , $$ [ $0 - 1 ] , $$ [ $0 ] ] , [ { value : 'FOR COLUMNS' , weight : 3 } , { value : 'CACHE METADATA' , weight : 2 } , { value : 'NOSCAN' , weight : 1 } ] ) ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1985 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 7 ] ) ;
parser . suggestKeywords ( parser . getKeywordsForOptionalsLR ( [ $$ [ $0 - 1 ] , $$ [ $0 ] ] , [ { value : 'CACHE METADATA' , weight : 2 } , { value : 'NOSCAN' , weight : 1 } ] ) ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1986 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 7 ] ) ;
parser . suggestKeywords ( parser . getKeywordsForOptionalsLR ( [ $$ [ $0 ] ] , [ { value : 'NOSCAN' , weight : 1 } ] ) ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1987 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TABLE' ] ) ;
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 1988 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TABLE' ] ) ;
parser . addTablePrimary ( $$ [ $0 - 6 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2000 : case 2012 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'METADATA' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2005 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
parser . suggestKeywords ( [ 'FUNCTIONS' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2007 : case 3068 : case 3210 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2015 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
parser . suggestKeywords ( [ 'METADATA' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2018 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'STATS' , 'INCREMENTAL STATS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2021 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'STATS' , 'INCREMENTAL STATS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2022 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'TABLESAMPLE' ] ) ;
} else if ( $$ [ $0 - 1 ] . suggestKeywords ) {
parser . suggestKeywords ( $$ [ $0 - 1 ] . suggestKeywords ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2025 : case 2672 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'INCREMENTAL' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2027 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'STATS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2030 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2045 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
} else if ( parser . isHive ( ) ) {
if ( $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'EXTERNAL TABLE' , 'FUNCTION' , 'MACRO' , 'TABLE' ] ) ;
} else {
parser . suggestKeywords ( [ 'DATABASE' , 'EXTERNAL TABLE' , 'FUNCTION' , 'INDEX' , 'ROLE' , 'SCHEMA' , 'TABLE' , 'TEMPORARY EXTERNAL TABLE' , 'TEMPORARY FUNCTION' , 'TEMPORARY MACRO' , 'TEMPORARY TABLE' , 'VIEW' ] ) ;
}
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'AGGREGATE FUNCTION' , 'DATABASE' , 'EXTERNAL TABLE' , 'FUNCTION' , 'ROLE' , 'SCHEMA' , 'TABLE' , 'VIEW' ] ) ;
} else {
parser . suggestKeywords ( [ 'DATABASE' , 'ROLE' , 'SCHEMA' , 'TABLE' , 'VIEW' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2048 : case 2077 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF NOT EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2050 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'IF NOT EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2053 :
2018-08-16 18:02:51 +08:00
var keywords = [ ] ;
if ( ! $$ [ $0 ] && parser . isHive ( ) ) {
keywords . push ( 'WITH DBPROPERTIES' ) ;
}
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
keywords . push ( 'LOCATION' ) ;
}
if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
keywords . push ( 'COMMENT' ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2068 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DBPROPERTIES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2090 :
2018-08-16 18:02:51 +08:00
var keywords = [ ] ;
2018-09-01 15:40:51 +08:00
if ( ! $$ [ $0 - 10 ] && ! $$ [ $0 - 9 ] && ! $$ [ $0 - 8 ] && ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'LIKE' , weight : 1 } ) ;
if ( parser . isImpala ( ) ) {
keywords . push ( { value : 'LIKE PARQUET' , weight : 1 } ) ;
}
} else {
2018-09-01 15:40:51 +08:00
if ( ! $$ [ $0 - 9 ] && ! $$ [ $0 - 8 ] && ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'COMMENT' , weight : 11 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( ! $$ [ $0 - 8 ] && ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'PARTITIONED BY' , weight : 10 } ) ;
if ( parser . isImpala ( ) ) {
keywords . push ( { value : 'PARTITION BY' , weight : 10 } ) ;
}
}
2018-09-01 15:40:51 +08:00
if ( parser . isImpala ( ) && ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'SORT BY' , weight : 9 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'CLUSTERED BY' , weight : 8 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'SKEWED BY' , weight : 7 } ) ;
2018-09-01 15:40:51 +08:00
} else if ( parser . isHive ( ) && $$ [ $0 - 5 ] && $$ [ $0 - 5 ] . suggestKeywords && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 - 1 ] ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 5 ] . suggestKeywords , 7 ) ) ; // Get the last optional from SKEWED BY
2018-08-16 18:02:51 +08:00
}
2018-09-01 15:40:51 +08:00
if ( ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'ROW FORMAT' , weight : 6 } ) ;
keywords . push ( { value : 'STORED AS' , weight : 6 } ) ;
if ( parser . isHive ( ) ) {
keywords . push ( { value : 'STORED BY' , weight : 6 } ) ;
}
2018-09-01 15:40:51 +08:00
} else if ( $$ [ $0 - 4 ] && $$ [ $0 - 4 ] . suggestKeywords && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 4 ] . suggestKeywords , 6 ) ) ;
2018-08-16 18:02:51 +08:00
}
2018-09-01 15:40:51 +08:00
if ( ( ( $$ [ $0 - 4 ] && $$ [ $0 - 4 ] . storedBy ) || parser . isImpala ( ) ) && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'WITH SERDEPROPERTIES' , weight : 5 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'LOCATION' , weight : 4 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'TBLPROPERTIES' , weight : 3 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( parser . isImpala ( ) && ! $$ [ $0 ] ) {
2018-08-16 18:02:51 +08:00
keywords . push ( { value : 'CACHED IN' , weight : 2 } , { value : 'UNCACHED' , weight : 2 } ) ;
}
2018-09-01 15:40:51 +08:00
if ( parser . isImpala ( ) && $$ [ $0 ] && $$ [ $0 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 ] . suggestKeywords , 2 ) ) ;
2018-08-16 18:02:51 +08:00
}
keywords . push ( { value : 'AS' , weight : 1 } ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2100 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'PARQUET' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2106 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'PRIMARY KEY' ] ) ;
} else if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ { value : 'PRIMARY KEY' , weight : 2 } , { value : 'CONSTRAINT' , weight : 1 } ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2113 : case 2115 : case 2308 :
2018-08-16 18:02:51 +08:00
parser . checkForKeywords ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2114 : case 2116 :
2018-08-16 18:02:51 +08:00
parser . checkForKeywords ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2117 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 2 ] ;
var keywords = [ ] ;
if ( parser . isImpala ( ) ) {
if ( ! $$ [ $0 ] [ 'primary' ] ) {
keywords . push ( 'PRIMARY KEY' ) ;
}
if ( ! $$ [ $0 ] [ 'encoding' ] ) {
keywords . push ( 'ENCODING' ) ;
}
if ( ! $$ [ $0 ] [ 'compression' ] ) {
keywords . push ( 'COMPRESSION' ) ;
}
if ( ! $$ [ $0 ] [ 'default' ] ) {
keywords . push ( 'DEFAULT' ) ;
}
if ( ! $$ [ $0 ] [ 'block_size' ] ) {
keywords . push ( 'BLOCK_SIZE' ) ;
}
if ( ! $$ [ $0 ] [ 'null' ] ) {
keywords . push ( 'NOT NULL' ) ;
keywords . push ( 'NULL' ) ;
}
}
if ( ! $$ [ $0 ] [ 'comment' ] ) {
keywords . push ( 'COMMENT' ) ;
if ( parser . isHive ( ) && $$ [ $0 - 1 ] . toLowerCase ( ) === 'double' ) {
keywords . push ( { value : 'PRECISION' , weight : 2 } ) ;
}
}
if ( keywords . length > 0 ) {
this . $ . suggestKeywords = keywords ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2118 : case 2154 : case 2160 : case 2161 : case 2174 : case 2177 : case 2189 : case 2191 : case 2591 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( parser . getColumnDataTypeKeywords ( ) ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2123 :
2018-08-16 18:02:51 +08:00
this . $ = { } ;
this . $ [ $$ [ $0 ] ] = true ;
break ;
2018-12-10 16:10:37 +08:00
case 2124 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] [ $$ [ $0 ] ] = true ;
break ;
2018-12-10 16:10:37 +08:00
case 2129 :
2018-08-16 18:02:51 +08:00
this . $ = 'primary' ;
break ;
2018-12-10 16:10:37 +08:00
case 2130 :
2018-08-16 18:02:51 +08:00
this . $ = 'encoding' ;
break ;
2018-12-10 16:10:37 +08:00
case 2131 :
2018-08-16 18:02:51 +08:00
this . $ = 'compression' ;
break ;
2018-12-10 16:10:37 +08:00
case 2132 :
2018-08-16 18:02:51 +08:00
this . $ = 'default' ;
break ;
2018-12-10 16:10:37 +08:00
case 2133 :
2018-08-16 18:02:51 +08:00
this . $ = 'block_size' ;
break ;
2018-12-10 16:10:37 +08:00
case 2134 : case 2135 :
2018-08-16 18:02:51 +08:00
this . $ = 'null' ;
break ;
2018-12-10 16:10:37 +08:00
case 2136 :
2018-08-16 18:02:51 +08:00
this . $ = 'comment' ;
break ;
2018-12-10 16:10:37 +08:00
case 2138 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'NULL' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2159 : case 2475 : case 2486 : case 2509 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( parser . getTypeKeywords ( ) ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2173 : case 2176 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'COMMENT' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2201 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'CONSTRAINT' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2202 : case 2205 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FOREIGN KEY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2207 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'PRIMARY KEY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2211 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DISABLE NOVALIDATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2212 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'NOVALIDATE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2214 : case 3103 : case 3110 : case 3117 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 4 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2215 : case 2232 : case 2234 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'KEY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2217 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'REFERENCES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2221 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
parser . suggestKeywords ( [ 'DISABLE NOVALIDATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2222 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
parser . suggestKeywords ( [ 'NOVALIDATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2223 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 5 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'NORELY' , 'RELY' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2245 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'HASH' , 'RANGE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2257 : case 2262 : case 2263 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2270 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'VALUE' , 'VALUES' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 2272 : case 2579 : case 3012 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2273 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . endsWithLessThanOrEqual && parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'VALUES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2274 : case 2277 : case 2280 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ '<' , '<=' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2275 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'VALUES' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2278 : case 2281 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestFunctions ( ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2291 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'INTO' , weight : 1 } , { value : 'SORTED BY' , weight : 2 } ] ) ;
} else {
parser . suggestKeywords ( [ 'INTO' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2292 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'BUCKETS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2313 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'STORED AS DIRECTORIES' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 2323 :
2018-08-16 18:02:51 +08:00
2018-09-01 15:40:51 +08:00
this . $ = parser . mergeSuggestKeywords ( $$ [ $0 - 1 ] , $$ [ $0 ] )
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 2324 : case 2325 :
2018-08-16 18:02:51 +08:00
this . $ = { storedBy : true }
break ;
2018-12-10 16:10:37 +08:00
case 2326 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'AS' , 'BY' ] ) ;
} else {
parser . suggestKeywords ( [ 'AS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2328 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FORMAT' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2329 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'DELIMITED' , 'SERDE' ] ) ;
} else {
parser . suggestKeywords ( [ 'DELIMITED' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2333 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'STORED AS' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 2359 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'FIELDS TERMINATED BY' , weight : 5 } , { value : 'COLLECTION ITEMS TERMINATED BY' , weight : 4 } , { value : 'MAP KEYS TERMINATED BY' , weight : 3 } , { value : 'LINES TERMINATED BY' , weight : 2 } , { value : 'NULL DEFINED AS' , weight : 1 } ] } ;
} else if ( $$ [ $0 - 4 ] && $$ [ $0 - 4 ] . suggestKeywords && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : parser . createWeightedKeywords ( $$ [ $0 - 4 ] . suggestKeywords , 5 ) . concat ( [ { value : 'COLLECTION ITEMS TERMINATED BY' , weight : 4 } , { value : 'MAP KEYS TERMINATED BY' , weight : 3 } , { value : 'LINES TERMINATED BY' , weight : 2 } , { value : 'NULL DEFINED AS' , weight : 1 } ] ) } ;
} else if ( ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'COLLECTION ITEMS TERMINATED BY' , weight : 4 } , { value : 'MAP KEYS TERMINATED BY' , weight : 3 } , { value : 'LINES TERMINATED BY' , weight : 2 } , { value : 'NULL DEFINED AS' , weight : 1 } ] } ;
} else if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'MAP KEYS TERMINATED BY' , weight : 3 } , { value : 'LINES TERMINATED BY' , weight : 2 } , { value : 'NULL DEFINED AS' , weight : 1 } ] } ;
} else if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'LINES TERMINATED BY' , weight : 2 } , { value : 'NULL DEFINED AS' , weight : 1 } ] } ;
} else if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'NULL DEFINED AS' , weight : 1 } ] } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2365 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'FIELDS TERMINATED BY' , weight : 2 } , { value : 'LINES TERMINATED BY' , weight : 1 } ] } ;
} else if ( $$ [ $0 - 1 ] && $$ [ $0 - 1 ] . suggestKeywords && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : parser . createWeightedKeywords ( $$ [ $0 - 1 ] . suggestKeywords , 2 ) . concat ( [ 'LINES TERMINATED BY' ] ) } ;
} else if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'LINES TERMINATED BY' , weight : 1 } ] } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2369 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestKeywords : [ 'ESCAPED BY' ] } ;
break ;
2018-12-10 16:10:37 +08:00
case 2371 : case 2377 : case 2382 : case 2386 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TERMINATED BY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2376 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ITEMS TERMINATED BY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2381 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'KEYS TERMINATED BY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2390 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DEFINED AS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2396 : case 2397 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SERDEPROPERTIES' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2407 :
2018-08-16 18:02:51 +08:00
parser . commitLocations ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2409 : case 2426 : case 2442 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF NOT EXISTS' ] ) ;
}
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2410 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 7 ] ) {
parser . suggestKeywords ( [ 'IF NOT EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2413 :
2018-08-16 18:02:51 +08:00
var keywords = [ { value : 'AS' , weight : 1 } ] ;
if ( ! $$ [ $0 - 1 ] ) {
if ( parser . isHive ( ) ) {
keywords . push ( { value : 'TBLPROPERTIES' , weight : 2 } ) ;
}
if ( ! $$ [ $0 - 2 ] ) {
keywords . push ( { value : 'COMMENT' , weight : 3 } ) ;
}
}
parser . suggestKeywords ( keywords ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2427 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 6 ] ) {
parser . suggestKeywords ( [ 'IF NOT EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2428 : case 2447 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'RETURNS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2430 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SYMBOL' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2441 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 13 ] ) {
parser . suggestKeywords ( [ 'IF NOT EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2449 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'INIT_FN' , weight : 2 } , { value : 'UPDATE_FN' , weight : 1 } ] ) ;
} else {
parser . suggestKeywords ( [ { value : 'UPDATE_FN' , weight : 1 } ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2450 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'MERGE_FN' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2451 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'PREPARE_FN' , weight : 5 } , { value : 'CLOSE_FN' , weight : 4 } , { value : 'SERIALIZE_FN' , weight : 3 } , { value : 'FINALIZE_FN' , weight : 2 } , { value : 'INTERMEDIATE' , weight : 1 } ] ) ;
} else if ( $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'CLOSE_FN' , weight : 4 } , { value : 'SERIALIZE_FN' , weight : 3 } , { value : 'FINALIZE_FN' , weight : 2 } , { value : 'INTERMEDIATE' , weight : 1 } ] ) ;
} else if ( $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'SERIALIZE_FN' , weight : 3 } , { value : 'FINALIZE_FN' , weight : 2 } , { value : 'INTERMEDIATE' , weight : 1 } ] ) ;
} else if ( $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'FINALIZE_FN' , weight : 2 } , { value : 'INTERMEDIATE' , weight : 1 } ] ) ;
} else if ( $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'INTERMEDIATE' , weight : 1 } ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2470 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'USING' ] ) ;
} else {
parser . suggestKeywords ( [ 'ARCHIVE' , 'FILE' , 'JAR' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2476 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ '...' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2511 :
2018-08-16 18:02:51 +08:00
parser . suggestFunctions ( ) ;
parser . suggestAggregateFunctions ( ) ;
parser . suggestAnalyticFunctions ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2514 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ARCHIVE' , 'FILE' , 'JAR' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2526 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'COMMENT' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2530 : case 2532 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 3 ] ;
break ;
2018-12-10 16:10:37 +08:00
case 2540 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ON TABLE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2546 : case 2556 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ '\'BITMAP\'' , '\'COMPACT\'' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2554 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 7 ] && ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'WITH DEFERRED REBUILD' , weight : 7 } , { value : 'IDXPROPERTIES' , weight : 6 } , { value : 'IN TABLE' , weight : 5 } , { value : 'ROW FORMAT' , weight : 4 } , { value : 'STORED AS' , weight : 4 } , { value : 'STORED BY' , weight : 4 } , { value : 'LOCATION' , weight : 3 } , { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 6 ] && ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'IDXPROPERTIES' , weight : 6 } , { value : 'IN TABLE' , weight : 5 } , { value : 'ROW FORMAT' , weight : 4 } , { value : 'STORED AS' , weight : 4 } , { value : 'STORED BY' , weight : 4 } , { value : 'LOCATION' , weight : 3 } , { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 5 ] && ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'IN TABLE' , weight : 5 } , { value : 'ROW FORMAT' , weight : 4 } , { value : 'STORED AS' , weight : 4 } , { value : 'STORED BY' , weight : 4 } , { value : 'LOCATION' , weight : 3 } , { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 4 ] && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'ROW FORMAT' , weight : 4 } , { value : 'STORED AS' , weight : 4 } , { value : 'STORED BY' , weight : 4 } , { value : 'LOCATION' , weight : 3 } , { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ;
} else if ( $$ [ $0 - 4 ] && $$ [ $0 - 4 ] . suggestKeywords && ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( parser . createWeightedKeywords ( $$ [ $0 - 4 ] . suggestKeywords , 4 ) . concat ( [ { value : 'LOCATION' , weight : 3 } , { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ) ;
} else if ( ! $$ [ $0 - 3 ] && ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'LOCATION' , weight : 3 } , { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 2 ] && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'TBLPROPERTIES' , weight : 2 } , { value : 'COMMENT' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { value : 'COMMENT' , weight : 1 } ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2559 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DEFERRED REBUILD' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2560 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'REBUILD' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2605 : case 2607 :
2018-08-16 18:02:51 +08:00
parser . addCommonTableExpressions ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2631 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'DATABASE' , 'FUNCTION' , 'INDEX' , 'ROLE' , 'SCHEMA' , 'TABLE' , 'TEMPORARY FUNCTION' , 'TEMPORARY MACRO' , 'VIEW' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'AGGREGATE FUNCTION' , 'DATABASE' , 'FUNCTION' , 'INCREMENTAL STATS' , 'ROLE' , 'SCHEMA' , 'STATS' , 'TABLE' , 'VIEW' ] ) ;
} else {
parser . suggestKeywords ( [ 'ROLE' , 'SCHEMA' , 'TABLE' , 'VIEW' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2635 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
parser . suggestDatabases ( ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2636 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) || parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'CASCADE' , 'RESTRICT' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2638 : case 2647 : case 2652 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 3 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2645 : case 2646 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2649 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'AGGREGATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2659 : case 2664 : case 2696 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2660 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2671 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
parser . suggestKeywords ( [ 'INCREMENTAL' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2677 : case 3270 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2681 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
parser . suggestTables ( { onlyTables : true } ) ;
parser . suggestDatabases ( {
appendDot : true
} ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2684 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'PURGE' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2689 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2695 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FUNCTION' , 'MACRO' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2699 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
parser . suggestTables ( { onlyViews : true } ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2700 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2706 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
if ( parser . isImpala ( ) && ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2709 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( parser . isHive ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2711 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( parser . isImpala ( ) && ! $$ [ $0 - 3 ] ) {
parser . suggestKeywords ( [ 'IF EXISTS' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2714 : case 2869 : case 2874 : case 2877 : case 2881 : case 2889 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FROM' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2716 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 ] ) {
parser . suggestKeywords ( [ 'WHERE' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2720 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FROM' ] ) ;
if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2723 :
2018-08-16 18:02:51 +08:00
var keywords = [ { value : 'FULL JOIN' , weight : 1 } , { value : 'FULL OUTER JOIN' , weight : 1 } , { value : 'JOIN' , weight : 1 } , { value : 'LEFT JOIN' , weight : 1 } , { value : 'LEFT OUTER JOIN' , weight : 1 } , { value : 'RIGHT JOIN' , weight : 1 } , { value : 'RIGHT OUTER JOIN' , weight : 1 } , { value : 'INNER JOIN' , weight : 1 } , { value : 'LEFT ANTI JOIN' , weight : 1 } , { value : 'LEFT SEMI JOIN' , weight : 1 } , { value : 'RIGHT ANTI JOIN' , weight : 1 } , { value : 'RIGHT SEMI JOIN' , weight : 1 } ] ;
if ( ! $$ [ $0 ] ) {
keywords . push ( { value : 'WHERE' , weight : 3 } ) ;
}
if ( $$ [ $0 - 2 ] . suggestJoinConditions ) {
parser . suggestJoinConditions ( $$ [ $0 - 2 ] . suggestJoinConditions ) ;
}
if ( $$ [ $0 - 2 ] . suggestJoins ) {
parser . suggestJoins ( $$ [ $0 - 2 ] . suggestJoins ) ;
}
if ( $$ [ $0 - 2 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 2 ] . suggestKeywords , 2 ) ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2732 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TRANSACTIONS' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2741 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'ALTER' , 'CREATE' , 'DELETE' , 'DROP' , 'INDEX' , 'INSERT' , 'LOCK' , 'ROLE' , 'SELECT' , 'UPDATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2744 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'ON' , 'TO' ] ) ;
} else {
parser . suggestKeywords ( [ 'TO' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2747 : case 2767 : case 2769 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'WITH GRANT OPTION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2752 : case 2756 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'WITH ADMIN OPTION' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2758 : case 2882 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'ALTER' , 'CREATE' , 'DROP' , 'INSERT' , 'REFRESH' , 'ROLE' , 'SELECT' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2759 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TO GROUP' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2760 : case 2884 : case 3283 : case 3284 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'GROUP' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2762 : case 2886 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . isCreate ) {
parser . suggestKeywords ( [ 'ON DATABASE' , 'ON SERVER' ] ) ;
} else {
parser . suggestKeywords ( [ 'ON DATABASE' , 'ON SERVER' , 'ON TABLE' , 'ON URI' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2763 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . isCreate ) {
parser . suggestKeywords ( [ 'DATABASE' , 'SERVER' ] ) ;
} else {
parser . suggestKeywords ( [ 'DATABASE' , 'SERVER' , 'TABLE' , 'URI' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 2766 : case 2873 : case 2890 : case 3233 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ROLE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2773 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DATABASE' , 'TABLE' ] ) ;
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2789 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . toUpperCase ( ) === 'ALL' ) {
this . $ = { singleAll : true } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2795 : case 2796 : case 2797 : case 2860 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'ALTER' , 'CREATE' , 'DELETE' , 'DROP' , 'INDEX' , 'INSERT' , 'LOCK' , 'SELECT' , 'SHOW_DATABASE' , 'UPDATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2813 :
2018-08-16 18:02:51 +08:00
this . $ = { isCreate : true } ;
break ;
2018-12-10 16:10:37 +08:00
case 2835 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'GRANT OPTION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2836 : case 2837 : case 2841 : case 2893 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OPTION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2840 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ADMIN OPTION' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2852 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ADMIN OPTION FOR' , 'ALL' , 'ALL GRANT OPTION FROM' , 'ALL PRIVILEGES FROM' , 'ALTER' , 'CREATE' , 'DELETE' , 'DROP' , 'GRANT OPTION FOR' , 'INDEX' , 'INSERT' , 'LOCK' , 'ROLE' , 'SELECT' , 'UPDATE' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2855 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
if ( $$ [ $0 - 2 ] . singleAll ) {
parser . suggestKeywords ( [ 'FROM' , 'GRANT OPTION' , 'ON' , 'PRIVILEGES FROM' ] ) ;
} else {
parser . suggestKeywords ( [ 'FROM' , 'ON' ] ) ;
}
} else {
parser . suggestKeywords ( [ 'FROM' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2858 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OPTION FOR' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2859 : case 2872 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FOR' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2863 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'FROM' , 'ON' ] ) ;
} else {
parser . suggestKeywords ( [ 'FROM' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2866 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . toUpperCase ( ) === 'ADMIN' ) {
parser . suggestKeywords ( [ 'FROM' , 'OPTION FOR' ] ) ;
} else {
parser . suggestKeywords ( [ 'FROM' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2883 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FROM GROUP' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2887 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 2 ] . isCreate ) {
parser . suggestKeywords ( [ 'DATABASE' , 'SERVER' ] ) ;
} else {
parser . suggestKeywords ( [ 'DATABASE' , 'SERVER' , 'TABLE' , 'URI' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2904 :
2018-08-16 18:02:51 +08:00
var keywords = [ ] ;
if ( $$ [ $0 - 1 ] . suggestKeywords ) {
keywords = parser . createWeightedKeywords ( $$ [ $0 - 1 ] . suggestKeywords , 2 ) . concat ( [ { value : 'SELECT' , weight : 1 } ] ) ;
} else {
keywords = [ 'SELECT' ] ;
}
if ( $$ [ $0 - 1 ] . addValues ) {
keywords . push ( { weight : 1.1 , value : 'VALUES' } ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2907 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] . keepTables ) {
delete parser . yy . result . suggestTables ;
delete parser . yy . result . suggestDatabases ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2911 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'INSERT INTO' , 'INSERT OVERWRITE' , 'SELECT' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2912 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . cursorAtEnd ) {
parser . checkForSelectListKeywords ( $$ [ $0 - 1 ] ) ;
var keywords = parser . yy . result . suggestKeywords || [ ] ;
if ( $$ [ $0 ] . suggestKeywords ) {
keywords = keywords . concat ( $$ [ $0 ] . suggestKeywords ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
}
delete parser . yy . result . suggestTables ;
delete parser . yy . result . suggestDatabases ;
break ;
2018-12-10 16:10:37 +08:00
case 2913 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . cursorAtStart ) {
parser . checkForSelectListKeywords ( $$ [ $0 - 1 ] . tableExpression ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2914 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'PARTITION' ] }
} else if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'IF NOT EXISTS' ] }
}
break ;
2018-12-10 16:10:37 +08:00
case 2915 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'ROW FORMAT' , weight : 2 } , { value : 'STORED AS' , weight : 1 } ] } ;
} else if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'STORED AS' ] } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2916 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ { value : 'ROW FORMAT' , weight : 2 } , { value : 'STORED AS' , weight : 1 } ] } ;
} else if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'STORED AS' ] } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2917 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'PARTITION' ] , addValues : true } ;
} else if ( ! $$ [ $0 ] ) {
this . $ = { addValues : true } ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2918 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'OVERWRITE' , 'INTO' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2919 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'DIRECTORY' , 'LOCAL DIRECTORY' , 'TABLE' ] ) ;
}
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
this . $ = { keepTables : true }
break ;
2018-12-10 16:10:37 +08:00
case 2920 : case 2931 :
2018-08-16 18:02:51 +08:00
this . $ = { keepTables : true }
break ;
2018-12-29 11:47:29 +08:00
case 2921 : case 2932 : case 2933 : case 2996 : case 2997 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( parser . yy . result . suggestColumns ) {
parser . yy . result . suggestColumns . owner = 'insert' ;
}
break ;
2018-12-29 11:47:29 +08:00
case 2922 : case 2948 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2923 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'DIRECTORY' ] ) ;
break ;
2018-12-10 16:10:37 +08:00
case 2930 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
}
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
this . $ = { keepTables : true }
break ;
2018-12-10 16:10:37 +08:00
case 2943 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . suggestKeywords ) {
parser . suggestKeywords ( parser . createWeightedKeywords ( $$ [ $0 - 1 ] . suggestKeywords , 2 ) . concat ( [ { value : 'SELECT' , weight : 1 } ] ) ) ;
} else {
parser . suggestKeywords ( [ 'SELECT' ] ) ;
}
break ;
2018-12-10 16:10:37 +08:00
case 2944 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . cursorAtEnd ) {
parser . checkForSelectListKeywords ( $$ [ $0 - 1 ] ) ;
var keywords = parser . yy . result . suggestKeywords || [ ] ;
if ( $$ [ $0 ] . suggestKeywords ) {
keywords = keywords . concat ( $$ [ $0 ] . suggestKeywords ) ;
}
if ( keywords . length > 0 ) {
parser . suggestKeywords ( keywords ) ;
}
}
break ;
2018-12-29 11:47:29 +08:00
case 2946 : case 2947 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 3 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2949 : case 2986 : case 3022 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'INTO' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2950 : case 2987 : case 2993 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
}
parser . suggestTables ( ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2952 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'VALUES' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2961 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FORMAT DELIMITED' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2964 :
2018-08-16 18:02:51 +08:00
this . $ = { selectList : $$ [ $0 ] } ;
break ;
2018-12-29 11:47:29 +08:00
case 2965 :
2018-08-16 18:02:51 +08:00
this . $ = $$ [ $0 - 1 ] ;
this . $ . cursorAtEnd = true ;
break ;
2018-12-29 11:47:29 +08:00
case 2966 :
2018-08-16 18:02:51 +08:00
parser . selectListNoTableSuggest ( $$ [ $0 ] , $$ [ $0 - 2 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2967 :
2018-08-16 18:02:51 +08:00
var keywords = parser . getSelectListKeywords ( ) ;
if ( ! $$ [ $0 - 2 ] || $$ [ $0 - 2 ] === 'ALL' ) {
parser . suggestAggregateFunctions ( ) ;
parser . suggestAnalyticFunctions ( ) ;
}
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 - 2 ] ) {
keywords . push ( { value : 'ALL' , weight : 2 } ) ;
keywords . push ( { value : 'DISTINCT' , weight : 2 } ) ;
}
if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] ) {
keywords . push ( { value : 'STRAIGHT_JOIN' , weight : 1 } ) ;
}
parser . suggestKeywords ( keywords ) ;
parser . suggestFunctions ( ) ;
parser . suggestColumns ( ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2975 :
2018-08-16 18:02:51 +08:00
var keywords = $$ [ $0 - 2 ] . suggestKeywords && ! $$ [ $0 - 1 ] ? parser . createWeightedKeywords ( $$ [ $0 - 2 ] . suggestKeywords , 2 ) : [ ] ;
if ( ! $$ [ $0 - 1 ] ) {
keywords = keywords . concat ( [ '[NOSHUFFLE]' , '[SHUFFLE]' , 'SELECT' , 'VALUES' ] )
} else {
keywords = keywords . concat ( [ 'SELECT' ] )
}
parser . suggestKeywords ( keywords ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2985 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] . owner = 'upsert' ;
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2988 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 3 ] ) {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
}
$$ [ $0 - 1 ] . owner = 'upsert' ;
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2990 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 1 ] . owner = 'upsert' ;
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
if ( parser . yy . result . suggestColumns ) {
parser . yy . result . suggestColumns . owner = 'upsert' ;
}
break ;
2018-12-29 11:47:29 +08:00
case 2991 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 2 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'PARTITION' ] } ;
}
break ;
2018-12-29 11:47:29 +08:00
case 2992 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'INTO' , 'OVERWRITE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 2994 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 4 ] ) {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
}
$$ [ $0 - 2 ] . owner = 'insert' ;
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3019 :
2018-08-16 18:02:51 +08:00
parser . suggestValueExpressionKeywords ( $$ [ $0 - 1 ] , [ { value : 'WHEN' , weight : 2 } ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3021 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 6 ] . alias = $$ [ $0 - 4 ] ;
parser . addTablePrimary ( $$ [ $0 - 6 ] ) ;
if ( $$ [ $0 - 2 ] . subQuery ) {
parser . addTablePrimary ( { subQueryAlias : $$ [ $0 ] } ) ;
} else {
$$ [ $0 - 2 ] . alias = $$ [ $0 ] ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3023 :
2018-08-16 18:02:51 +08:00
parser . suggestDatabases ( { appendDot : true } ) ;
parser . suggestTables ( ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3025 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'AS T USING' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3026 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
parser . suggestKeywords ( [ 'T USING' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3027 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 3 ] . alias = $$ [ $0 - 1 ] ;
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
parser . suggestKeywords ( [ 'USING' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3028 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 4 ] . alias = $$ [ $0 - 2 ] ;
parser . addTablePrimary ( $$ [ $0 - 4 ] ) ;
parser . suggestDatabases ( { appendDot : true } ) ;
parser . suggestTables ( ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3029 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 4 ] . alias = $$ [ $0 - 2 ] ;
parser . addTablePrimary ( $$ [ $0 - 4 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3030 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 5 ] . alias = $$ [ $0 - 3 ] ;
parser . addTablePrimary ( $$ [ $0 - 5 ] ) ;
parser . suggestKeywords ( [ 'AS S ON' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3031 :
2018-08-16 18:02:51 +08:00
$$ [ $0 - 6 ] . alias = $$ [ $0 - 4 ] ;
parser . addTablePrimary ( $$ [ $0 - 6 ] ) ;
parser . suggestKeywords ( [ 'S ON' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3040 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 ] . suggestThenKeywords ) {
parser . suggestKeywords ( [ 'DELETE' , 'INSERT VALUES' , 'UPDATE SET' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3041 : case 3043 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] . notPresent ) {
parser . suggestKeywords ( [ 'WHEN' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3042 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] . notPresent && $$ [ $0 ] . suggestThenKeywords ) {
var keywords = [ ] ;
if ( ! $$ [ $0 - 1 ] . isDelete ) {
keywords . push ( 'DELETE' ) ;
}
if ( ! $$ [ $0 - 1 ] . isInsert ) {
keywords . push ( 'INSERT VALUES' ) ;
}
if ( ! $$ [ $0 - 1 ] . isUpdate ) {
keywords . push ( 'UPDATE SET' ) ;
}
parser . suggestKeywords ( keywords ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3044 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] . notPresent && $$ [ $0 ] . suggestThenKeywords ) {
var keywords = [ ] ;
if ( ! $$ [ $0 - 2 ] . isDelete && ! $$ [ $0 - 1 ] . isDelete ) {
keywords . push ( 'DELETE' ) ;
}
if ( ! $$ [ $0 - 2 ] . isInsert && ! $$ [ $0 - 1 ] . isInsert ) {
keywords . push ( 'INSERT VALUES' ) ;
}
if ( ! $$ [ $0 - 2 ] . isUpdate && ! $$ [ $0 - 1 ] . isUpdate ) {
keywords . push ( 'UPDATE SET' ) ;
}
parser . suggestKeywords ( keywords ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3045 :
2018-08-16 18:02:51 +08:00
this . $ = { notPresent : ! ! $$ [ $0 - 4 ] , isDelete : $$ [ $0 ] . isDelete , isInsert : $$ [ $0 ] . isInsert , isUpdate : $$ [ $0 ] . isUpdate } ;
break ;
2018-12-29 11:47:29 +08:00
case 3046 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'NOT MATCHED' , 'MATCHED' ] ) ;
} else {
parser . suggestKeywords ( [ 'MATCHED' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3047 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'AND' , 'THEN' ] ) ;
} else {
parser . suggestValueExpressionKeywords ( $$ [ $0 - 1 ] , [ { value : 'THEN' , weight : 2 } ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3049 :
2018-08-16 18:02:51 +08:00
this . $ = { suggestThenKeywords : true } ;
break ;
2018-12-29 11:47:29 +08:00
case 3054 :
2018-08-16 18:02:51 +08:00
this . $ = { isUpdate : true } ;
break ;
2018-12-29 11:47:29 +08:00
case 3055 :
2018-08-16 18:02:51 +08:00
this . $ = { isDelete : true } ;
break ;
2018-12-29 11:47:29 +08:00
case 3056 :
2018-08-16 18:02:51 +08:00
this . $ = { isInsert : true } ;
break ;
2018-12-29 11:47:29 +08:00
case 3057 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SET' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3061 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'DATA LOCAL INPATH' , 'DATA INPATH' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'DATA INPATH' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3062 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) && ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'INPATH' , 'LOCAL INPATH' ] ) ;
} else {
parser . suggestKeywords ( [ 'INPATH' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3064 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'OVERWRITE INTO TABLE' , 'INTO TABLE' ] ) ;
} else {
parser . suggestKeywords ( [ 'INTO TABLE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3065 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'TABLE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3083 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 ] ) {
parser . suggestKeywords ( [ 'EXTERNAL TABLE' , 'FROM' , 'TABLE' ] ) ;
} else if ( ! $$ [ $0 ] . hasExternal ) {
parser . suggestKeywords ( [ 'EXTERNAL' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3084 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . suggestKeywords ) {
parser . suggestKeywords ( parser . createWeightedKeywords ( $$ [ $0 - 1 ] . suggestKeywords , 2 ) . concat ( [ 'FROM' ] ) ) ;
} else {
parser . suggestKeywords ( [ 'FROM' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3088 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'LOCATION' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3089 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 4 ] ) {
parser . suggestKeywords ( [ 'EXTERNAL TABLE' , 'TABLE' ] ) ;
} else if ( ! $$ [ $0 - 4 ] . hasExternal ) {
parser . suggestKeywords ( [ 'EXTERNAL' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3091 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 5 ] . suggestKeywords ) {
parser . suggestKeywords ( parser . createWeightedKeywords ( $$ [ $0 - 5 ] . suggestKeywords , 2 ) . concat ( [ 'FROM' ] ) ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3094 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
if ( ! $$ [ $0 ] ) {
this . $ = { hasExternal : true , suggestKeywords : [ 'PARTITION' ] } ;
} else {
this . $ = { hasExternal : true }
}
break ;
2018-12-29 11:47:29 +08:00
case 3095 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
if ( ! $$ [ $0 ] ) {
this . $ = { suggestKeywords : [ 'PARTITION' ] } ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3104 : case 3118 : case 3119 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 9 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3108 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ { weight : 2 , value : 'PARTITION' } , { weight : 1 , value : 'TO' } ] ) ;
} else {
parser . suggestKeywords ( [ 'TO' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3111 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 5 ] ) ;
parser . suggestKeywords ( [ 'FOR replication()' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3112 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 6 ] ) ;
parser . suggestKeywords ( [ 'replication()' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3115 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 5 ] ) ;
if ( ! $$ [ $0 - 4 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3116 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 10 ] ) ;
if ( ! $$ [ $0 - 9 ] ) {
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3134 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'NONE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3157 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'COLUMNS' , 'COMPACTIONS' , 'CONF' , 'CREATE TABLE' , 'CURRENT ROLES' , 'DATABASES' , 'FORMATTED' , 'FUNCTIONS' , 'GRANT' , 'INDEX' , 'INDEXES' , 'LOCKS' , 'PARTITIONS' , 'PRINCIPALS' , 'ROLE GRANT' , 'ROLES' , 'SCHEMAS' , 'TABLE EXTENDED' , 'TABLES' , 'TBLPROPERTIES' , 'TRANSACTIONS' , 'VIEWS' ] ) ;
} else if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'AGGREGATE FUNCTIONS' , 'ANALYTIC FUNCTIONS' , 'COLUMN STATS' , 'CREATE TABLE' , 'CURRENT ROLES' , 'DATABASES' , 'FILES IN' , 'FUNCTIONS' , 'GRANT ROLE' , 'PARTITIONS' , 'RANGE PARTITIONS' , 'ROLE GRANT GROUP' , 'ROLES' , 'SCHEMAS' , 'TABLE STATS' , 'TABLES' ] ) ;
} else {
parser . suggestKeywords ( [ 'COLUMNS' , 'DATABASES' , 'TABLES' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3158 :
2018-08-16 18:02:51 +08:00
// ROLES is considered a non-reserved keywords so we can't match it in ShowCurrentRolesStatement_EDIT
if ( $$ [ $0 ] . identifierChain && $$ [ $0 ] . identifierChain . length === 1 && $$ [ $0 ] . identifierChain [ 0 ] . name . toLowerCase ( ) === 'roles' ) {
parser . suggestKeywords ( [ 'CURRENT' ] ) ;
parser . yy . locations . pop ( ) ;
} else {
parser . addTablePrimary ( $$ [ $0 ] ) ;
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'COLUMN STATS' , 'CREATE TABLE' , 'FILES IN' , 'PARTITIONS' , 'RANGE PARTITIONS' , 'TABLE STATS' ] ) ;
}
}
break ;
2018-12-29 11:47:29 +08:00
case 3159 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'AGGREGATE FUNCTIONS' , 'ANALYTIC FUNCTIONS' , 'DATABASES' , 'FUNCTIONS' , 'SCHEMAS' , 'TABLES' ] ) ;
} else if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'DATABASES' , 'SCHEMAS' , 'TABLE EXTENDED' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3178 : case 3208 : case 3268 : case 3272 : case 3274 : case 3302 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( {
appendDot : true
} ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3182 : case 3183 : case 3187 : case 3188 : case 3247 : case 3248 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FROM' , 'IN' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3184 : case 3185 : case 3186 : case 3231 : case 3245 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3193 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'TABLE' , 'VIEW' ] ) ;
} else {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3194 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] . isView && parser . isImpala ( ) ) {
parser . suggestTables ( { onlyViews : true } ) ;
} else {
parser . suggestTables ( ) ;
}
parser . suggestDatabases ( {
appendDot : true
} ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3195 :
2018-08-16 18:02:51 +08:00
if ( parser . yy . result . suggestTables && $$ [ $0 - 1 ] . isView ) {
parser . yy . result . suggestTables . onlyViews = true ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3196 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
if ( parser . isImpala ( ) ) {
parser . suggestKeywords ( [ 'TABLE' , 'VIEW' ] ) ;
} else {
parser . suggestKeywords ( [ 'TABLE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3198 :
2018-08-16 18:02:51 +08:00
this . $ = { isView : true } ;
break ;
2018-12-29 11:47:29 +08:00
case 3201 : case 3202 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ROLES' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3205 : case 3299 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'LIKE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3212 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'IN' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3217 : case 3220 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'FUNCTIONS' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3218 : case 3221 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'AGGREGATE' , 'ANALYTICAL' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3219 : case 3308 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'IN' , 'LIKE' ] ) ;
} else {
parser . suggestKeywords ( [ 'LIKE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3222 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ { value : 'IN' , weight : 2 } , { value : 'LIKE' , weight : 1 } ] ) ;
} else {
parser . suggestKeywords ( [ 'LIKE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3230 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ALL' , 'TABLE' ] ) ;
parser . suggestTables ( ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3250 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( { identifierChain : [ { name : $$ [ $0 ] } ] } ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3256 :
2018-08-16 18:02:51 +08:00
parser . suggestTables ( ) ;
parser . suggestDatabases ( {
appendDot : true
} ) ;
parser . suggestKeywords ( [ 'DATABASE' , 'SCHEMA' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3258 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 1 ] ) ;
parser . suggestKeywords ( [ 'EXTENDED' , 'PARTITION' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3261 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 2 ] ) ;
parser . suggestKeywords ( [ 'EXTENDED' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3278 : case 3279 : case 3280 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'GRANT' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3281 : case 3282 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'ROLE' , 'USER' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3289 : case 3298 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'EXTENDED' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3292 :
2018-08-16 18:02:51 +08:00
if ( $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'LIKE' ] ) ;
} else {
parser . suggestKeywords ( [ 'FROM' , 'IN' , 'LIKE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3294 :
2018-08-16 18:02:51 +08:00
if ( parser . isHive ( ) ) {
parser . suggestKeywords ( [ 'EXTENDED' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3295 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'LIKE' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3296 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'PARTITION' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3303 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3310 :
2018-08-16 18:02:51 +08:00
parser . addTablePrimary ( $$ [ $0 - 3 ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3315 :
2018-08-16 18:02:51 +08:00
if ( ! $$ [ $0 - 1 ] && ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ { value : 'IN' , weight : 2 } , { value : 'FROM' , weight : 2 } , { value : 'LIKE' , weight : 1 } ] ) ;
} else if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'LIKE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3319 : case 3320 :
2018-08-16 18:02:51 +08:00
parser . addDatabaseLocation ( _$ [ $0 ] , [ { name : $$ [ $0 ] } ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3331 :
2018-08-16 18:02:51 +08:00
if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] && ! $$ [ $0 - 2 ] ) {
parser . suggestKeywords ( [ { value : 'FROM' , weight : 2 } , { value : 'WHERE' , weight : 1 } ] ) ;
} else if ( parser . isImpala ( ) && ! $$ [ $0 - 1 ] && $$ [ $0 - 2 ] ) {
var keywords = [ { value : 'FULL JOIN' , weight : 2 } , { value : 'FULL OUTER JOIN' , weight : 2 } , { value : 'JOIN' , weight : 2 } , { value : 'LEFT JOIN' , weight : 2 } , { value : 'LEFT OUTER JOIN' , weight : 2 } , { value : 'RIGHT JOIN' , weight : 2 } , { value : 'RIGHT OUTER JOIN' , weight : 2 } , { value : 'INNER JOIN' , weight : 2 } , { value : 'LEFT ANTI JOIN' , weight : 2 } , { value : 'LEFT SEMI JOIN' , weight : 2 } , { value : 'RIGHT ANTI JOIN' , weight : 2 } , { value : 'RIGHT SEMI JOIN' , weight : 2 } , { value : 'WHERE' , weight : 1 } ] ;
if ( $$ [ $0 - 2 ] . suggestJoinConditions ) {
parser . suggestJoinConditions ( $$ [ $0 - 2 ] . suggestJoinConditions ) ;
}
if ( $$ [ $0 - 2 ] . suggestJoins ) {
parser . suggestJoins ( $$ [ $0 - 2 ] . suggestJoins ) ;
}
if ( $$ [ $0 - 2 ] . suggestKeywords ) {
keywords = keywords . concat ( parser . createWeightedKeywords ( $$ [ $0 - 2 ] . suggestKeywords , 3 ) ) ;
}
parser . suggestKeywords ( keywords ) ;
} else if ( ! $$ [ $0 - 1 ] ) {
parser . suggestKeywords ( [ 'WHERE' ] ) ;
}
break ;
2018-12-29 11:47:29 +08:00
case 3332 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ 'SET' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3348 :
2018-08-16 18:02:51 +08:00
parser . suggestKeywords ( [ '=' ] ) ;
break ;
2018-12-29 11:47:29 +08:00
case 3359 :
2018-08-16 18:02:51 +08:00
if ( ! parser . yy . cursorFound ) {
parser . yy . result . useDatabase = $$ [ $0 ] ;
}
break ;
}
} ,
2018-12-29 11:47:29 +08:00
table : [ o ( $V0 , $V1 , { 3 : 1 , 4 : 2 } ) , { 1 : [ 3 ] } , o ( $V2 , $V3 , { 5 : 3 , 9 : 4 , 12 : 5 , 13 : 6 , 14 : 7 , 15 : 8 , 405 : 9 , 406 : 10 , 407 : 11 , 408 : 12 , 409 : 13 , 410 : 14 , 411 : 15 , 412 : 16 , 413 : 17 , 414 : 18 , 415 : 19 , 416 : 20 , 417 : 21 , 418 : 22 , 419 : 23 , 1119 : 24 , 1120 : 25 , 1121 : 26 , 1122 : 27 , 1123 : 28 , 1124 : 29 , 1125 : 30 , 572 : 31 , 17 : 32 , 564 : 35 , 565 : 36 , 802 : 37 , 803 : 38 , 804 : 39 , 805 : 40 , 806 : 41 , 807 : 42 , 808 : 43 , 925 : 48 , 926 : 49 , 927 : 50 , 928 : 51 , 929 : 52 , 930 : 53 , 931 : 54 , 1138 : 55 , 1139 : 56 , 1140 : 57 , 1141 : 58 , 1142 : 59 , 1143 : 60 , 1144 : 61 , 1145 : 62 , 1146 : 63 , 1252 : 70 , 1253 : 71 , 1254 : 72 , 1255 : 73 , 1256 : 74 , 1257 : 75 , 1258 : 76 , 1259 : 77 , 1260 : 78 , 1261 : 79 , 1262 : 80 , 1263 : 81 , 1264 : 82 , 1265 : 83 , 1266 : 84 , 1267 : 85 , 1268 : 86 , 1269 : 87 , 1270 : 88 , 1271 : 89 , 1308 : 90 , 1131 : 93 , 1191 : 94 , 1132 : 95 , 1192 : 96 , 1241 : 97 , 568 : 103 , 820 : 106 , 910 : 107 , 437 : 111 , 1056 : 112 , 1057 : 113 , 1058 : 114 , 1059 : 115 , 1155 : 117 , 1156 : 118 , 1272 : 120 , 1193 : 123 , 594 : 124 , 1210 : 127 , 1227 : 128 , 1212 : 139 , 1217 : 141 , 1218 : 142 , 25 : $V4 , 29 : $V5 , 57 : $V6 , 58 : $V7 , 73 : $V8 , 78 : $V9 , 79 : $Va , 96 : $Vb , 112 : $Vc , 130 : $Vd , 144 : $Ve , 162 : $Vf , 182 : $Vg , 218 : $Vh , 307 : $Vi , 339 : $Vj , 352 : $Vk , 438 : $Vl , 439 : $Vm , 440 : $Vn , 452 : $Vo , 569 : $Vp , 570 : $Vq , 571 : $Vr , 577 : $Vs , 760 : $Vt , 816 : $Vu , 859 : $Vv , 921 : $Vw , 922 : $Vx , 924 : $Vy , 1160 : $Vz , 1184 : $VA , 1185 : $VB , 1186 : $VC , 1187 : $VD , 1189 : $VE , 1207 : $VF , 1221 : $VG , 1246 : $VH , 1247 : $VI , 1273 : $VJ , 1309 : $VK } ) , { 6 : [ 1 , 145 ] , 10 : [ 1 , 146 ] } , o ( $V2 , [ 2 , 6 ] ) , o ( $V2 , [ 2 , 12 ] ) , o ( $V2 , [ 2 , 13 ] ) , o ( $V2 , [ 2 , 14 ] ) , { 12 : 147 , 13 : 148 , 14 : 149 , 17 : 32 , 25 : $V4 , 29 : $V5 , 58 : $V7 , 73 : $V8 , 78 : $V9 , 79 : $Va , 96 : $Vb , 112 : $Vc , 130 : $Vd , 144 : $Ve , 182 : $Vg , 218 : $Vh , 307 : $Vi , 339 : $Vj , 352 : $Vk , 405 : 9 , 406 : 10 , 407 : 11 , 408 : 12 , 409 : 13 , 410 : 14 , 411 : 15 , 412 : 16 , 413 : 17 , 414 : 18 , 415 : 19 , 416 : 20 , 417 : 21 , 418 : 22 , 419 : 23 , 437 : 111 , 438 : $Vl , 439 : $Vm , 440 : $Vn , 452 : $Vo , 564 : 35 , 565 : 36 , 568 : 103 , 569 : $Vp , 570 : $Vq , 571 : $Vr , 572 : 31 , 577 : $Vs , 594 : 124 , 760 : $Vt , 802 : 37 , 803 : 38 , 804 : 39 , 805 : 40 , 806 : 41 , 807 : 42 , 808 : 43 , 816 : $Vu , 820 : 106 , 859 : $Vv , 910 : 107 , 921 : $Vw , 922 : $Vx , 924 : $Vy , 925 : 48 , 926 : 49 , 927 : 50 , 928 : 51 , 929 : 52 , 930 : 53 , 931 : 54 , 1056 : 112 , 1057 : 113 , 1058 : 114 , 1059 : 115 , 1119 : 24 , 1120 : 25 , 1121 : 26 , 1122 : 27 , 1123 : 28 , 1124 : 29 , 1125 : 30 , 1131 : 93 , 1132 : 95 , 1138 : 55 , 1139 : 56 , 1140 : 57 , 1141 : 58 , 1142 : 59 , 1143 : 60 , 1144 : 61 , 1145 : 62 , 1146 : 63 , 1155 : 117 , 1156 : 118 , 1160 : $Vz , 1184 : $VA , 1185 : $VB , 1186 : $VC , 1187 : $VD , 1189 : $VE , 1191 : 94 , 1192 : 96 , 1193 : 123 , 1207 : $VF , 1210 : 127 , 1212 : 139 , 1217 : 141 , 1218 : 142 , 1221 : $VG , 1227 : 128 , 1241 : 97 , 1246 : $VH , 1247 : $VI , 1252 : 70 , 1253 : 71 , 1254 : 72 , 1255 : 73 , 1256 : 74 , 1257 : 75 , 1258 : 76 , 1259 : 77 , 1260 : 78 , 1261 : 79 , 1262 : 80 , 1263 : 81 , 1264 : 82 , 1265 : 83 , 1266 : 84 , 1267 : 85 , 1268 : 86 , 1269 : 87 , 1270 : 88 , 1271 : 89 , 1272 : 120 , 1273 : $VJ , 1308 : 90 , 1309 : $VK } , o ( $V2 , [ 2 , 515 ] ) , o ( $V2 , [ 2 , 516 ] ) , o ( $V2 , [ 2 , 517 ] ) , o ( $V2 , [ 2 , 518 ] ) , o ( $V2 , [ 2 , 519 ] ) , o ( $V2 , [ 2 , 520 ] ) , o ( $V2 , [ 2 , 521 ] ) , o ( $V2 , [ 2 , 522 ] ) , o ( $V2 , [ 2 , 523 ] ) , o ( $V2 , [ 2 , 524 ] ) , o ( $V2 , [ 2 , 525 ] ) , o ( $V2 , [ 2 , 526 ] ) , o ( $V2 , [ 2 , 527 ] ) , o ( $V2 , [ 2 , 528 ] ) , o ( $V2 , [ 2 , 529 ] ) , o ( $V2 , [ 2 , 2593 ] ) , o ( $V2 , [ 2 , 2594 ] ) , o ( $V2 , [ 2 , 2595 ] ) , o ( $V2 , [ 2 , 2596 ] ) , o ( $V2 , [ 2 , 2597 ] ) , o ( $V2 , [ 2 , 2598 ] ) , o ( $V2 , [ 2 , 2599 ] ) , o ( $VL , $VM , { 573 : 150 , 582 : 151 , 584 : 152 , 347 : $VN } ) , { 307 : $Vi , 398 : $VO , 572 : 154 , 577 : $Vs , 594 : 124 , 1131 : 156 , 1132 : 157 , 1184 : $VP , 1186 : $VC , 1193 : 123 , 1210 : 127 , 1212 : 139 , 1217 : 141 , 1218 : 142 , 1221 : $VG } , o ( $VQ , [ 2 , 171 ] , { 161 : 159 , 50 : [ 1 , 161 ] , 163 : [ 1 , 160 ] , 164 : [ 1 , 162 ] } ) , o ( $VQ , [ 2 , 168 ] ) , o ( $V2 , [ 2 , 823 ] ) , o ( $V2 , [ 2 , 824 ] ) , o ( $V2 , [ 2 , 1654 ] ) , o ( $V2 , [ 2 , 1655 ] ) , o ( $V2 , [ 2 , 1656 ] ) , o ( $V2 , [ 2 , 1657 ] ) , o ( $V2 , [ 2 , 1658 ] ) , o ( $V2 , [ 2 , 1659 ] ) , o ( $V2 , [ 2 , 1660 ] ) , { 193 : [ 1 , 163 ] } , { 24 : 171 , 25 : $VR , 26 : $VS , 27 : $VT , 28 : $VU , 29 : $VV , 30 : $VW , 31 : $VX , 32 : $VY , 33 : $VZ , 34 : $V _ , 35 : $V$ , 36 : $V01 , 37 : $V11 , 38 : $V21 , 39 : $V31 , 40 : $V41 , 41 : $V51 , 42 : $V61 , 43 : $V71 , 44 : $V81 , 45 : $V91 , 46 : $Va1 , 47 : $Vb1 , 48 : $Vc1 , 49 : $Vd1 , 50 : $Ve1 , 51 : $Vf1 , 52 : $Vg1 , 53 : $Vh1 , 54 : $Vi1 , 55 : $Vj1 , 56 : $Vk1 , 57 : $Vl1 , 58 : $Vm1 , 59 : $Vn1 , 60 : $Vo1 , 61 : $Vp1 , 62 : $Vq1 , 63 : $Vr1 , 64 : $Vs1 , 65 : $Vt1 , 66 : $Vu1 , 67 : $Vv1 , 68 : $Vw1 , 69 : $Vx1 , 70 : $Vy1 , 71 : $Vz1 , 72 : $VA1 , 73 : $VB1 , 74 : $VC1 , 75 : $VD1 , 76 : $VE1 , 77 : $VF1 , 78 : $VG1 , 79 : $VH1 , 80 : $VI1 , 81 : $VJ1 , 82 : $VK1 , 83 : $VL1 , 84 : $VM1 , 85 : $VN1 , 86 : $VO1 , 87 : $VP1 , 88 : $VQ1 , 89 : $VR1 , 90 : $VS1 , 91 : $VT1 , 92 : $VU1 , 93 : $VV1 , 94 : $VW1 , 95 : $VX1 , 96 : $VY1 , 97 : $VZ1 , 98 : $V _1 , 99 : $V$1 , 100 : $V02 , 101 : $V12 , 102 : $V22 , 103 : $V32 , 104 : $V42 , 105 : $V52 , 106 : $V62 , 107 : $V72 , 108 : $V82 , 109 : $V92 , 110 : $Va2 , 111 : $Vb2 , 112 : $Vc2 , 113 : $Vd2 , 114 : $Ve2 , 115 : $Vf2 , 116 : $Vg2 , 117 : $Vh2 , 118 : $Vi2 , 119 : $Vj2 , 120 : $Vk2 , 121 : $Vl2 , 122 : $Vm2 , 123 : $Vn2 , 124 : $Vo2 , 125 : $Vp2 , 126 : $Vq2 , 127 : $Vr2 , 128 : $Vs2 , 129 : $Vt2 , 130 : $Vu2 , 131 : $Vv2 , 132 : $Vw2 , 133 : $Vx2 , 134 : $Vy2 , 135 : $Vz2 , 136 : $VA2 , 137 : $VB2 , 138 : $VC2 , 139 : $VD2 , 140 : $VE2 , 141 : $VF2 , 142 : $VG2 , 143 : $VH2 , 144 : $VI2 , 145 : $VJ2 , 146 : $VK2 , 147 : $VL2 , 148 : $VM2 , 149 : $VN2
defaultActions : { 145 : [ 2 , 1 ] , 328 : [ 2 , 2811 ] , 329 : [ 2 , 2812 ] , 330 : [ 2 , 2813 ] , 331 : [ 2 , 2814 ] , 332 : [ 2 , 2815 ] , 333 : [ 2 , 2816 ] , 350 : [ 2 , 2729 ] , 363 : [ 2 , 3093 ] , 368 : [ 2 , 3336 ] , 369 : [ 2 , 3338 ] , 410 : [ 2 , 1897 ] , 411 : [ 2 , 1898 ] , 504 : [ 2 , 580 ] , 505 : [ 2 , 581 ] , 506 : [ 2 , 583 ] , 507 : [ 2 , 621 ] , 509 : [ 2 , 634 ] , 512 : [ 2 , 545 ] , 513 : [ 2 , 546 ] , 514 : [ 2 , 574 ] , 515 : [ 2 , 575 ] , 532 : [ 2 , 3003 ] , 533 : [ 2 , 3004 ] , 578 : [ 2 , 2817 ] , 585 : [ 2 , 2891 ] , 622 : [ 2 , 766 ] , 668 : [ 2 , 604 ] , 669 : [ 2 , 605 ] , 670 : [ 2 , 1904 ] , 671 : [ 2 , 1905 ] , 673 : [ 2 , 594 ] , 674 : [ 2 , 595 ] , 696 : [ 2 , 1840 ] , 697 : [ 2 , 1841 ] , 764 : [ 2 , 633 ] , 797 : [ 2 , 1399 ] , 798 : [ 2 , 1400 ] , 799 : [ 2 , 1401 ] , 800 : [ 2 , 1402 ] , 801 : [ 2 , 1403 ] , 802 : [ 2 , 1404 ] , 828 : [ 2 , 1533 ] , 829 : [ 2 , 1534 ] , 830 : [ 2 , 1535 ] , 831 : [ 2 , 1536 ] , 832 : [ 2 , 1537 ] , 833 : [ 2 , 1538 ] , 834 : [ 2 , 1539 ] , 835 : [ 2 , 1540 ] , 836 : [ 2 , 1541 ] , 837 : [ 2 , 1542 ] , 838 : [ 2 , 1543 ] , 839 : [ 2 , 1544 ] , 840 : [ 2 , 1545 ] , 841 : [ 2 , 1546 ] , 842 : [ 2 , 1547 ] , 843 : [ 2 , 1548 ] , 844 : [ 2 , 1549 ] , 845 : [ 2 , 1550 ] , 846 : [ 2 , 1551 ] , 847 : [ 2 , 1552 ] , 848 : [ 2 , 1553 ] , 849 : [ 2 , 1554 ] , 850 : [ 2 , 1555 ] , 903 : [ 2 , 2892 ] , 947 : [ 2 , 1356 ] , 948 : [ 2 , 1358 ] , 949 : [ 2 , 1360 ] , 950 : [ 2 , 1362 ] , 951 : [ 2 , 1364 ] , 952 : [ 2 , 1366 ] , 953 : [ 2 , 1368 ] , 954 : [ 2 , 1370 ] , 956 : [ 2 , 3080 ] , 957 : [ 2 , 3081 ] , 960 : [ 2 , 3095 ] , 965 : [ 2 , 3350 ] , 1107 : [ 2 , 561 ] , 1108 : [ 2 , 562 ] , 1109 : [ 2 , 563 ] , 1248 : [ 2 , 3094 ] , 1371 : [ 2 , 638 ] , 1429 : [ 2 , 1419 ] , 1434 : [ 2 , 1519 ] , 1435 : [ 2 , 1520 ] , 1436 : [ 2 , 1521 ] , 1437 : [ 2 , 1522 ] , 1438 : [ 2 , 1523 ] , 1439 : [ 2 , 1524 ] , 1440 : [ 2 , 1525 ] , 1441 : [ 2 , 1526 ] , 1442 : [ 2 , 1527 ] , 1494 : [ 2 , 3072 ] , 1495 : [ 2 , 3073 ] , 1520 : [ 2 , 2233 ] , 1593 : [ 2 , 1850 ] , 1595 : [ 2 , 1851 ] , 1612 : [ 2 , 2538 ] , 1672 : [ 2 , 1420 ] , 1745 : [ 2 , 606 ] , 1746 : [ 2 , 607 ] , 1774 : [ 2 , 2296 ] , 1780 : [ 2 , 2195 ] , 1808 : [ 2 , 2484 ] , 1813 : [ 2 , 2518 ] , 1814 : [ 2 , 2519 ] , 1815 : [ 2 , 2520 ] , 1862 : [ 2 , 3033 ] , 1920 : [ 2 , 2227 ] , 1928 : [ 2 , 598 ] , 1929 : [ 2 , 599 ] , 1973 : [ 2 , 1442 ] , 1974 : [ 2 , 1447 ] , 2019 : [ 2 , 2299 ] , 2028 : [ 2 , 2197 ] , 2039 : [ 2 , 2568 ] , 2070 : [ 2 , 3021 ] , 2071 : [ 2 , 3032 ] , 2083 : [ 2 , 584 ] , 2084 : [ 2 , 585 ] , 2138 : [ 2 , 2198 ] , 2151 : [ 2 , 2489 ] , 2175 : [ 2 , 1471 ] , 2176 : [ 2 , 1472 ] , 2177 : [ 2 , 1473 ] , 2200 : [ 2 , 2491 ] , 2211 : [ 2 , 1448 ] , 2215 : [ 2 , 1449 ] , 2262 : [ 2 , 1477 ] , 2263 : [ 2 , 1478 ] } ,
2018-08-16 18:02:51 +08:00
parseError : function parseError ( str , hash ) {
if ( hash . recoverable ) {
this . trace ( str ) ;
} else {
var error = new Error ( str ) ;
error . hash = hash ;
throw error ;
}
} ,
parse : function parse ( input ) {
var self = this ,
stack = [ 0 ] ,
tstack = [ ] , // token stack
vstack = [ null ] , // semantic value stack
lstack = [ ] , // location stack
table = this . table ,
yytext = '' ,
yylineno = 0 ,
yyleng = 0 ,
recovering = 0 ,
TERROR = 2 ,
EOF = 1 ;
var args = lstack . slice . call ( arguments , 1 ) ;
//this.reductionCount = this.shiftCount = 0;
var lexer = Object . create ( this . lexer ) ;
var sharedState = { yy : { } } ;
// copy state
for ( var k in this . yy ) {
if ( Object . prototype . hasOwnProperty . call ( this . yy , k ) ) {
sharedState . yy [ k ] = this . yy [ k ] ;
}
}
lexer . setInput ( input , sharedState . yy ) ;
sharedState . yy . lexer = lexer ;
sharedState . yy . parser = this ;
if ( typeof lexer . yylloc == 'undefined' ) {
lexer . yylloc = { } ;
}
var yyloc = lexer . yylloc ;
lstack . push ( yyloc ) ;
var ranges = lexer . options && lexer . options . ranges ;
if ( typeof sharedState . yy . parseError === 'function' ) {
this . parseError = sharedState . yy . parseError ;
} else {
this . parseError = Object . getPrototypeOf ( this ) . parseError ;
}
function popStack ( n ) {
stack . length = stack . length - 2 * n ;
vstack . length = vstack . length - n ;
lstack . length = lstack . length - n ;
}
_token _stack :
var lex = function ( ) {
var token ;
token = lexer . lex ( ) || EOF ;
// if token isn't its numeric value, convert
if ( typeof token !== 'number' ) {
token = self . symbols _ [ token ] || token ;
}
return token ;
}
var symbol , preErrorSymbol , state , action , a , r , yyval = { } , p , len , newState , expected ;
while ( true ) {
// retreive state number from top of stack
state = stack [ stack . length - 1 ] ;
// use default actions if available
if ( this . defaultActions [ state ] ) {
action = this . defaultActions [ state ] ;
} else {
if ( symbol === null || typeof symbol == 'undefined' ) {
symbol = lex ( ) ;
}
// read action for current state and first input
action = table [ state ] && table [ state ] [ symbol ] ;
}
_handle _error :
// handle parse error
if ( typeof action === 'undefined' || ! action . length || ! action [ 0 ] ) {
var error _rule _depth ;
var errStr = '' ;
// Return the rule stack depth where the nearest error rule can be found.
// Return FALSE when no error recovery rule was found.
function locateNearestErrorRecoveryRule ( state ) {
var stack _probe = stack . length - 1 ;
var depth = 0 ;
// try to recover from error
for ( ; ; ) {
// check for error recovery rule in this state
if ( ( TERROR . toString ( ) ) in table [ state ] ) {
return depth ;
}
if ( state === 0 || stack _probe < 2 ) {
return false ; // No suitable error recovery rule available.
}
stack _probe -= 2 ; // popStack(1): [symbol, action]
state = stack [ stack _probe ] ;
++ depth ;
}
}
if ( ! recovering ) {
// first see if there's any chance at hitting an error recovery rule:
error _rule _depth = locateNearestErrorRecoveryRule ( state ) ;
// Report error
expected = [ ] ;
for ( p in table [ state ] ) {
if ( this . terminals _ [ p ] && p > TERROR ) {
expected . push ( "'" + this . terminals _ [ p ] + "'" ) ;
}
}
if ( lexer . showPosition ) {
errStr = 'Parse error on line ' + ( yylineno + 1 ) + ":\n" + lexer . showPosition ( ) + "\nExpecting " + expected . join ( ', ' ) + ", got '" + ( this . terminals _ [ symbol ] || symbol ) + "'" ;
} else {
errStr = 'Parse error on line ' + ( yylineno + 1 ) + ": Unexpected " +
( symbol == EOF ? "end of input" :
( "'" + ( this . terminals _ [ symbol ] || symbol ) + "'" ) ) ;
}
this . parseError ( errStr , {
text : lexer . match ,
token : this . terminals _ [ symbol ] || symbol ,
line : lexer . yylineno ,
loc : lexer . yylloc , ruleId : stack . slice ( stack . length - 2 , stack . length ) . join ( ) ,
expected : expected ,
recoverable : ( error _rule _depth !== false )
} ) ;
} else if ( preErrorSymbol !== EOF ) {
error _rule _depth = locateNearestErrorRecoveryRule ( state ) ;
}
// just recovered from another error
if ( recovering == 3 ) {
if ( symbol === EOF || preErrorSymbol === EOF ) {
throw new Error ( errStr || 'Parsing halted while starting to recover from another error.' ) ;
}
// discard current lookahead and grab another
yyleng = lexer . yyleng ;
yytext = lexer . yytext ;
yylineno = lexer . yylineno ;
yyloc = lexer . yylloc ;
symbol = lex ( ) ;
}
// try to recover from error
if ( error _rule _depth === false ) {
throw new Error ( errStr || 'Parsing halted. No suitable error recovery rule available.' ) ;
}
popStack ( error _rule _depth ) ;
preErrorSymbol = ( symbol == TERROR ? null : symbol ) ; // save the lookahead token
symbol = TERROR ; // insert generic error symbol as new lookahead
state = stack [ stack . length - 1 ] ;
action = table [ state ] && table [ state ] [ TERROR ] ;
recovering = 3 ; // allow 3 real symbols to be shifted before reporting a new error
}
// this shouldn't happen, unless resolve defaults are off
if ( action [ 0 ] instanceof Array && action . length > 1 ) {
throw new Error ( 'Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol ) ;
}
switch ( action [ 0 ] ) {
case 1 : // shift
//this.shiftCount++;
stack . push ( symbol ) ;
vstack . push ( lexer . yytext ) ;
lstack . push ( lexer . yylloc ) ;
stack . push ( action [ 1 ] ) ; // push state
symbol = null ;
if ( ! preErrorSymbol ) { // normal execution/no error
yyleng = lexer . yyleng ;
yytext = lexer . yytext ;
yylineno = lexer . yylineno ;
yyloc = lexer . yylloc ;
if ( recovering > 0 ) {
recovering -- ;
}
} else {
// error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol ;
preErrorSymbol = null ;
}
break ;
case 2 :
// reduce
//this.reductionCount++;
len = this . productions _ [ action [ 1 ] ] [ 1 ] ;
// perform semantic action
yyval . $ = vstack [ vstack . length - len ] ; // default to $$ = $1
// default location, uses first token for firsts, last for lasts
yyval . _$ = {
first _line : lstack [ lstack . length - ( len || 1 ) ] . first _line ,
last _line : lstack [ lstack . length - 1 ] . last _line ,
first _column : lstack [ lstack . length - ( len || 1 ) ] . first _column ,
last _column : lstack [ lstack . length - 1 ] . last _column
} ;
if ( ranges ) {
yyval . _$ . range = [ lstack [ lstack . length - ( len || 1 ) ] . range [ 0 ] , lstack [ lstack . length - 1 ] . range [ 1 ] ] ;
}
r = this . performAction . apply ( yyval , [ yytext , yyleng , yylineno , sharedState . yy , action [ 1 ] , vstack , lstack ] . concat ( args ) ) ;
if ( typeof r !== 'undefined' ) {
return r ;
}
// pop off stack
if ( len ) {
stack = stack . slice ( 0 , - 1 * len * 2 ) ;
vstack = vstack . slice ( 0 , - 1 * len ) ;
lstack = lstack . slice ( 0 , - 1 * len ) ;
}
stack . push ( this . productions _ [ action [ 1 ] ] [ 0 ] ) ; // push nonterminal (reduce)
vstack . push ( yyval . $ ) ;
lstack . push ( yyval . _$ ) ;
// goto new state = table[STATE][NONTERMINAL]
newState = table [ stack [ stack . length - 2 ] ] [ stack [ stack . length - 1 ] ] ;
stack . push ( newState ) ;
break ;
case 3 :
// accept
return true ;
}
}
return true ;
} } ;
SqlParseSupport . initSyntaxParser ( parser ) ;
/* generated by jison-lex 0.3.4 */
var lexer = ( function ( ) {
var lexer = ( {
EOF : 1 ,
parseError : function parseError ( str , hash ) {
if ( this . yy . parser ) {
this . yy . parser . parseError ( str , hash ) ;
} else {
throw new Error ( str ) ;
}
} ,
// resets the lexer, sets new input
setInput : function ( input , yy ) {
this . yy = yy || this . yy || { } ;
this . _input = input ;
this . _more = this . _backtrack = this . done = false ;
this . yylineno = this . yyleng = 0 ;
this . yytext = this . matched = this . match = '' ;
this . conditionStack = [ 'INITIAL' ] ;
this . yylloc = {
first _line : 1 ,
first _column : 0 ,
last _line : 1 ,
last _column : 0
} ;
if ( this . options . ranges ) {
this . yylloc . range = [ 0 , 0 ] ;
}
this . offset = 0 ;
return this ;
} ,
// consumes and returns one char from the input
input : function ( ) {
var ch = this . _input [ 0 ] ;
this . yytext += ch ;
this . yyleng ++ ;
this . offset ++ ;
this . match += ch ;
this . matched += ch ;
var lines = ch . match ( /(?:\r\n?|\n).*/g ) ;
if ( lines ) {
this . yylineno ++ ;
this . yylloc . last _line ++ ;
} else {
this . yylloc . last _column ++ ;
}
if ( this . options . ranges ) {
this . yylloc . range [ 1 ] ++ ;
}
this . _input = this . _input . slice ( 1 ) ;
return ch ;
} ,
// unshifts one char (or a string) into the input
unput : function ( ch ) {
var len = ch . length ;
var lines = ch . split ( /(?:\r\n?|\n)/g ) ;
this . _input = ch + this . _input ;
this . yytext = this . yytext . substr ( 0 , this . yytext . length - len ) ;
//this.yyleng -= len;
this . offset -= len ;
var oldLines = this . match . split ( /(?:\r\n?|\n)/g ) ;
this . match = this . match . substr ( 0 , this . match . length - 1 ) ;
this . matched = this . matched . substr ( 0 , this . matched . length - 1 ) ;
if ( lines . length - 1 ) {
this . yylineno -= lines . length - 1 ;
}
var r = this . yylloc . range ;
this . yylloc = {
first _line : this . yylloc . first _line ,
last _line : this . yylineno + 1 ,
first _column : this . yylloc . first _column ,
last _column : lines ?
( lines . length === oldLines . length ? this . yylloc . first _column : 0 )
+ oldLines [ oldLines . length - lines . length ] . length - lines [ 0 ] . length :
this . yylloc . first _column - len
} ;
if ( this . options . ranges ) {
this . yylloc . range = [ r [ 0 ] , r [ 0 ] + this . yyleng - len ] ;
}
this . yyleng = this . yytext . length ;
return this ;
} ,
// When called from action, caches matched text and appends it on next action
more : function ( ) {
this . _more = true ;
return this ;
} ,
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject : function ( ) {
if ( this . options . backtrack _lexer ) {
this . _backtrack = true ;
} else {
return this . parseError ( 'Lexical error on line ' + ( this . yylineno + 1 ) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this . showPosition ( ) , {
text : "" ,
token : null ,
line : this . yylineno
} ) ;
}
return this ;
} ,
// retain first n characters of the match
less : function ( n ) {
this . unput ( this . match . slice ( n ) ) ;
} ,
// displays already matched input, i.e. for error messages
pastInput : function ( ) {
var past = this . matched . substr ( 0 , this . matched . length - this . match . length ) ;
return ( past . length > 20 ? '...' : '' ) + past . substr ( - 20 ) . replace ( /\n/g , "" ) ;
} ,
// displays upcoming input, i.e. for error messages
upcomingInput : function ( ) {
var next = this . match ;
if ( next . length < 20 ) {
next += this . _input . substr ( 0 , 20 - next . length ) ;
}
return ( next . substr ( 0 , 20 ) + ( next . length > 20 ? '...' : '' ) ) . replace ( /\n/g , "" ) ;
} ,
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition : function ( ) {
var pre = this . pastInput ( ) ;
var c = new Array ( pre . length + 1 ) . join ( "-" ) ;
return pre + this . upcomingInput ( ) + "\n" + c + "^" ;
} ,
// test the lexed token: return FALSE when not a match, otherwise return token
test _match : function ( match , indexed _rule ) {
var token ,
lines ,
backup ;
if ( this . options . backtrack _lexer ) {
// save context
backup = {
yylineno : this . yylineno ,
yylloc : {
first _line : this . yylloc . first _line ,
last _line : this . last _line ,
first _column : this . yylloc . first _column ,
last _column : this . yylloc . last _column
} ,
yytext : this . yytext ,
match : this . match ,
matches : this . matches ,
matched : this . matched ,
yyleng : this . yyleng ,
offset : this . offset ,
_more : this . _more ,
_input : this . _input ,
yy : this . yy ,
conditionStack : this . conditionStack . slice ( 0 ) ,
done : this . done
} ;
if ( this . options . ranges ) {
backup . yylloc . range = this . yylloc . range . slice ( 0 ) ;
}
}
lines = match [ 0 ] . match ( /(?:\r\n?|\n).*/g ) ;
if ( lines ) {
this . yylineno += lines . length ;
}
this . yylloc = {
first _line : this . yylloc . last _line ,
last _line : this . yylineno + 1 ,
first _column : this . yylloc . last _column ,
last _column : lines ?
lines [ lines . length - 1 ] . length - lines [ lines . length - 1 ] . match ( /\r?\n?/ ) [ 0 ] . length :
this . yylloc . last _column + match [ 0 ] . length
} ;
this . yytext += match [ 0 ] ;
this . match += match [ 0 ] ;
this . matches = match ;
this . yyleng = this . yytext . length ;
if ( this . options . ranges ) {
this . yylloc . range = [ this . offset , this . offset += this . yyleng ] ;
}
this . _more = false ;
this . _backtrack = false ;
this . _input = this . _input . slice ( match [ 0 ] . length ) ;
this . matched += match [ 0 ] ;
token = this . performAction . call ( this , this . yy , this , indexed _rule , this . conditionStack [ this . conditionStack . length - 1 ] ) ;
if ( this . done && this . _input ) {
this . done = false ;
}
if ( token ) {
return token ;
} else if ( this . _backtrack ) {
// recover context
for ( var k in backup ) {
this [ k ] = backup [ k ] ;
}
return false ; // rule action called reject() implying the next rule should be tested instead.
}
return false ;
} ,
// return next match in input
next : function ( ) {
if ( this . done ) {
return this . EOF ;
}
if ( ! this . _input ) {
this . done = true ;
}
var token ,
match ,
tempMatch ,
index ;
if ( ! this . _more ) {
this . yytext = '' ;
this . match = '' ;
}
var rules = this . _currentRules ( ) ;
for ( var i = 0 ; i < rules . length ; i ++ ) {
tempMatch = this . _input . match ( this . rules [ rules [ i ] ] ) ;
if ( tempMatch && ( ! match || tempMatch [ 0 ] . length > match [ 0 ] . length ) ) {
match = tempMatch ;
index = i ;
if ( this . options . backtrack _lexer ) {
token = this . test _match ( tempMatch , rules [ i ] ) ;
if ( token !== false ) {
return token ;
} else if ( this . _backtrack ) {
match = false ;
continue ; // rule action called reject() implying a rule MISmatch.
} else {
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false ;
}
} else if ( ! this . options . flex ) {
break ;
}
}
}
if ( match ) {
token = this . test _match ( match , rules [ index ] ) ;
if ( token !== false ) {
return token ;
}
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false ;
}
if ( this . _input === "" ) {
return this . EOF ;
} else {
return this . parseError ( 'Lexical error on line ' + ( this . yylineno + 1 ) + '. Unrecognized text.\n' + this . showPosition ( ) , {
text : "" ,
token : null ,
line : this . yylineno
} ) ;
}
} ,
// return next match that has a token
lex : function lex ( ) {
var r = this . next ( ) ;
if ( r ) {
return r ;
} else {
return this . lex ( ) ;
}
} ,
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin : function begin ( condition ) {
this . conditionStack . push ( condition ) ;
} ,
// pop the previously active lexer condition state off the condition stack
popState : function popState ( ) {
var n = this . conditionStack . length - 1 ;
if ( n > 0 ) {
return this . conditionStack . pop ( ) ;
} else {
return this . conditionStack [ 0 ] ;
}
} ,
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules : function _currentRules ( ) {
if ( this . conditionStack . length && this . conditionStack [ this . conditionStack . length - 1 ] ) {
return this . conditions [ this . conditionStack [ this . conditionStack . length - 1 ] ] . rules ;
} else {
return this . conditions [ "INITIAL" ] . rules ;
}
} ,
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState : function topState ( n ) {
n = this . conditionStack . length - 1 - Math . abs ( n || 0 ) ;
if ( n >= 0 ) {
return this . conditionStack [ n ] ;
} else {
return "INITIAL" ;
}
} ,
// alias for begin(condition)
pushState : function pushState ( condition ) {
this . begin ( condition ) ;
} ,
// return the number of states currently on the stack
stateStackSize : function stateStackSize ( ) {
return this . conditionStack . length ;
} ,
options : { "case-insensitive" : true , "flex" : true } ,
performAction : function anonymous ( yy , yy _ , $avoiding _name _collisions , YY _START ) {
var YYSTATE = YY _START ;
switch ( $avoiding _name _collisions ) {
case 0 : /* skip whitespace */
break ;
case 1 : /* skip comments */
break ;
case 2 : /* skip comments */
break ;
case 3 : parser . yy . partialCursor = false ; parser . yy . cursorFound = yy _ . yylloc ; return 18 ;
break ;
2018-09-26 17:21:26 +08:00
case 4 : parser . yy . partialCursor = true ; parser . yy . cursorFound = yy _ . yylloc ; return 441 ;
2018-08-16 18:02:51 +08:00
break ;
case 5 : return 166 ;
break ;
2018-09-26 17:21:26 +08:00
case 6 : return 285 ;
2018-08-16 18:02:51 +08:00
break ;
case 7 : return 167 ;
break ;
case 8 : return 163 ;
break ;
case 9 : return 168 ;
break ;
case 10 : return 169 ;
break ;
2018-12-10 16:10:37 +08:00
case 11 : return 850 ;
2018-08-16 18:02:51 +08:00
break ;
case 12 : return 171 ;
break ;
case 13 : return 172 ;
break ;
2018-09-26 17:21:26 +08:00
case 14 : parser . determineCase ( yy _ . yytext ) ; return 439 ;
2018-08-16 18:02:51 +08:00
break ;
case 15 : return 173 ;
break ;
case 16 : return 174 ;
break ;
case 17 : return 175 ;
break ;
2018-12-10 16:10:37 +08:00
case 18 : parser . determineCase ( yy _ . yytext ) ; return 1160 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 19 : parser . determineCase ( yy _ . yytext ) ; return 570 ;
2018-08-16 18:02:51 +08:00
break ;
case 20 : return 164 ;
break ;
case 21 : return 178 ;
break ;
case 22 : return 179 ;
break ;
case 23 : return 180 ;
break ;
case 24 : return 181 ;
break ;
case 25 : return 182 ;
break ;
case 26 : return 183 ;
break ;
2018-12-10 16:10:37 +08:00
case 27 : parser . determineCase ( yy _ . yytext ) ; return 1247 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 28 : parser . determineCase ( yy _ . yytext ) ; return 1184 ;
2018-08-16 18:02:51 +08:00
break ;
case 29 : return 184 ;
break ;
case 30 : return 185 ;
break ;
case 31 : return 187 ;
break ;
2018-09-26 17:21:26 +08:00
case 32 : return 321 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 33 : return 198 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 34 : return 199 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 35 : return 200 ;
2018-08-16 18:02:51 +08:00
break ;
case 36 : return 189 ;
break ;
case 37 : return 190 ;
break ;
2018-12-10 16:10:37 +08:00
case 38 : return 1187 ;
2018-08-16 18:02:51 +08:00
break ;
case 39 : return 191 ;
break ;
case 40 : return 193 ;
break ;
case 41 : return 124 ;
break ;
case 42 : return 131 ;
break ;
2018-09-26 17:21:26 +08:00
case 43 : return 204 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 44 : return 205 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 45 : return 951 ;
2018-08-16 18:02:51 +08:00
break ;
case 46 : parser . determineCase ( yy _ . yytext ) ; return 25 ;
break ;
case 47 : return 26 ;
break ;
case 48 : return 27 ;
break ;
case 49 : return 28 ;
break ;
case 50 : parser . determineCase ( yy _ . yytext ) ; return 29 ;
break ;
case 51 : return 30 ;
break ;
case 52 : return 194 ;
break ;
case 53 : return 31 ;
break ;
case 54 : return 32 ;
break ;
case 55 : return 33 ;
break ;
case 56 : return 34 ;
break ;
case 57 : return 35 ;
break ;
case 58 : return 170 ;
break ;
case 59 : return 36 ;
break ;
case 60 : return 37 ;
break ;
case 61 : return 38 ;
break ;
case 62 : return 39 ;
break ;
case 63 : return 40 ;
break ;
case 64 : return 41 ;
break ;
case 65 : return 42 ;
break ;
case 66 : return 43 ;
break ;
case 67 : return 44 ;
break ;
case 68 : return 45 ;
break ;
case 69 : return 134 ;
break ;
2018-09-26 17:21:26 +08:00
case 70 : return 369 ;
2018-08-16 18:02:51 +08:00
break ;
case 71 : return 46 ;
break ;
case 72 : return 47 ;
break ;
case 73 : return 48 ;
break ;
case 74 : return 49 ;
break ;
case 75 : return 50 ;
break ;
2018-09-26 17:21:26 +08:00
case 76 : return 571 ;
2018-08-16 18:02:51 +08:00
break ;
case 77 : this . begin ( 'hdfs' ) ; return 51 ;
break ;
case 78 : return 52 ;
break ;
case 79 : return 176 ;
break ;
case 80 : return 53 ;
break ;
case 81 : return 55 ;
break ;
case 82 : return 54 ;
break ;
case 83 : return 56 ;
break ;
case 84 : parser . determineCase ( yy _ . yytext ) ; return 57 ;
break ;
case 85 : parser . determineCase ( yy _ . yytext ) ; return 58 ;
break ;
case 86 : return 59 ;
break ;
case 87 : return 60 ;
break ;
case 88 : return 61 ;
break ;
case 89 : return 62 ;
break ;
case 90 : return 63 ;
break ;
2018-09-26 17:21:26 +08:00
case 91 : return 195 ;
2018-08-16 18:02:51 +08:00
break ;
case 92 : return 181 ;
break ;
case 93 : return 64 ;
break ;
case 94 : return 135 ;
break ;
case 95 : return 68 ;
break ;
2018-09-26 17:21:26 +08:00
case 96 : return 196 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 97 : return 197 ;
2018-08-16 18:02:51 +08:00
break ;
case 98 : this . begin ( 'hdfs' ) ; return 65 ;
break ;
case 99 : return 66 ;
break ;
case 100 : return 69 ;
break ;
case 101 : return 67 ;
break ;
case 102 : return 70 ;
break ;
case 103 : return 71 ;
break ;
case 104 : return 72 ;
break ;
case 105 : parser . determineCase ( yy _ . yytext ) ; return 73 ;
break ;
case 106 : this . begin ( 'hdfs' ) ; return 74 ;
break ;
case 107 : return 186 ;
break ;
case 108 : return 75 ;
break ;
case 109 : return 76 ;
break ;
case 110 : return 78 ;
break ;
case 111 : return 77 ;
break ;
case 112 : return 136 ;
break ;
case 113 : return 137 ;
break ;
case 114 : return 79 ;
break ;
case 115 : return 98 ;
break ;
case 116 : return 80 ;
break ;
case 117 : return 81 ;
break ;
case 118 : return 82 ;
break ;
case 119 : return 83 ;
break ;
case 120 : return 84 ;
break ;
case 121 : return 85 ;
break ;
case 122 : return 86 ;
break ;
2018-12-10 16:10:37 +08:00
case 123 : this . begin ( 'hdfs' ) ; return 1201 ;
2018-08-16 18:02:51 +08:00
break ;
case 124 : return 87 ;
break ;
case 125 : return 88 ;
break ;
case 126 : return 89 ;
break ;
case 127 : return 90 ;
break ;
case 128 : return 91 ;
break ;
case 129 : return 92 ;
break ;
case 130 : return 93 ;
break ;
case 131 : return 138 ;
break ;
case 132 : return 94 ;
break ;
case 133 : return 95 ;
break ;
case 134 : parser . determineCase ( yy _ . yytext ) ; return 96 ;
break ;
case 135 : return 97 ;
break ;
case 136 : return 99 ;
break ;
case 137 : return 100 ;
break ;
case 138 : return 101 ;
break ;
case 139 : return 102 ;
break ;
case 140 : return 103 ;
break ;
case 141 : return 104 ;
break ;
case 142 : return 105 ;
break ;
case 143 : return 106 ;
break ;
case 144 : return 139 ;
break ;
2018-09-26 17:21:26 +08:00
case 145 : return 201 ;
2018-08-16 18:02:51 +08:00
break ;
case 146 : return 107 ;
break ;
case 147 : return 108 ;
break ;
case 148 : return 109 ;
break ;
case 149 : return 110 ;
break ;
case 150 : return 111 ;
break ;
case 151 : parser . determineCase ( yy _ . yytext ) ; return 112 ;
break ;
case 152 : return 192 ;
break ;
case 153 : return 113 ;
break ;
2018-12-10 16:10:37 +08:00
case 154 : return 847 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 155 : return 653 ;
2018-08-16 18:02:51 +08:00
break ;
case 156 : return 114 ;
break ;
case 157 : return 115 ;
break ;
case 158 : return 116 ;
break ;
2018-09-26 17:21:26 +08:00
case 159 : return 202 ;
2018-08-16 18:02:51 +08:00
break ;
case 160 : return 117 ;
break ;
case 161 : return 118 ;
break ;
case 162 : return 119 ;
break ;
2018-09-26 17:21:26 +08:00
case 163 : return 203 ;
2018-08-16 18:02:51 +08:00
break ;
case 164 : return 120 ;
break ;
case 165 : return 121 ;
break ;
case 166 : return 122 ;
break ;
case 167 : return 123 ;
break ;
case 168 : return 125 ;
break ;
case 169 : return 126 ;
break ;
case 170 : return 127 ;
break ;
case 171 : return 128 ;
break ;
case 172 : return 129 ;
break ;
case 173 : parser . determineCase ( yy _ . yytext ) ; return 130 ;
break ;
case 174 : return 132 ;
break ;
case 175 : return 133 ;
break ;
case 176 : return 140 ;
break ;
2018-09-26 17:21:26 +08:00
case 177 : return 206 ;
2018-08-16 18:02:51 +08:00
break ;
case 178 : return 141 ;
break ;
2018-09-26 17:21:26 +08:00
case 179 : return 207 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 180 : return 208 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 181 : return 209 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 182 : return 899 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 183 : return 210 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 184 : return 211 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 185 : return 212 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 186 : return 213 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 187 : return 897 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 188 : return 214 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 189 : return 215 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 190 : return 889 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 191 : parser . determineCase ( yy _ . yytext ) ; return 452 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 192 : parser . determineCase ( yy _ . yytext ) ; return 924 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 193 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'CREATE' , yy _ . yylloc , yy . lexer . upcomingInput ( ) ) ; return 440 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 194 : return 216 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 195 : return 217 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 196 : return 218 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 197 : return 219 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 198 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'DESCRIBE' , yy _ . yylloc ) ; return 569 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 199 : return 220 ;
2018-08-16 18:02:51 +08:00
break ;
case 200 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'EXPLAIN' , yy _ . yylloc ) ; return 162 ;
break ;
2018-09-26 17:21:26 +08:00
case 201 : return 222 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 202 : return 221 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 203 : return 223 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 204 : return 898 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 205 : return 224 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 206 : return 225 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 207 : return 226 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 208 : return 227 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 209 : return 228 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 210 : return 229 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 211 : return 230 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 212 : return 231 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 213 : return 232 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 214 : return 233 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 215 : return 234 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 216 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'INSERT' , yy _ . yylloc ) ; return 1186 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 217 : return 236 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 218 : return 235 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 219 : return 237 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 220 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'INVALIDATE' , yy _ . yylloc , yy . lexer . upcomingInput ( ) ) ; return 922 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 221 : this . begin ( 'hdfs' ) ; return 238 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 222 : return 239 ;
2018-08-16 18:02:51 +08:00
break ;
case 223 : return 155 ;
break ;
2018-09-26 17:21:26 +08:00
case 224 : return 240 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 225 : return 241 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 226 : this . begin ( 'hdfs' ) ; return 969 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 227 : return 242 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 228 : return 243 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 229 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'LOAD' , yy _ . yylloc , yy . lexer . upcomingInput ( ) ) ; return 1246 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 230 : this . begin ( 'hdfs' ) ; return 244 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 231 : return 245 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 232 : return 923 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 233 : return 246 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 234 : return 660 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 235 : return 1034 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 236 : return 1224 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 237 : return 268 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 238 : return 269 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 239 : return 247 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 240 : return 248 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 241 : return 249 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 242 : return 270 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 243 : return 250 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 244 : return 251 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 245 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'REFRESH' , yy _ . yylloc ) ; return 921 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 246 : return 901 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 247 : return 252 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 248 : return 759 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 249 : return 253 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 250 : return 254 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 251 : return 255 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 252 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'REVOKE' , yy _ . yylloc ) ; return 1189 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 253 : return 271 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 254 : return 272 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 255 : return 256 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 256 : return 257 ;
2018-08-16 18:02:51 +08:00
break ;
case 257 : return 149 ;
break ;
2018-09-26 17:21:26 +08:00
case 258 : return 258 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 259 : return 259 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 260 : return 274 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 261 : return 260 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 262 : return 261 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 263 : return 262 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 264 : return 263 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 265 : return 264 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 266 : return 275 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 267 : return 276 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 268 : return 277 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 269 : return 543 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 270 : return 278 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 271 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'UPSERT' , yy _ . yylloc ) ; return 1221 ;
2018-08-16 18:02:51 +08:00
break ;
case 272 : return 148 ;
break ;
2018-09-26 17:21:26 +08:00
case 273 : return 265 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 274 : return 823 ;
2018-08-16 18:02:51 +08:00
break ;
case 275 : return 142 ;
break ;
2018-09-26 17:21:26 +08:00
case 276 : return 266 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 277 : return 285 ;
2018-08-16 18:02:51 +08:00
break ;
case 278 : return 151 ;
break ;
case 279 : return 152 ;
break ;
case 280 : return 143 ;
break ;
case 281 : return 153 ;
break ;
case 282 : return 154 ;
break ;
case 283 : return 144 ;
break ;
2018-09-26 17:21:26 +08:00
case 284 : return 321 ;
2018-08-16 18:02:51 +08:00
break ;
case 285 : return 145 ;
break ;
case 286 : return 146 ;
break ;
case 287 : return 147 ;
break ;
case 288 : return 118 ;
break ;
case 289 : return 150 ;
break ;
2018-09-26 17:21:26 +08:00
case 290 : return 279 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 291 : return 267 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 292 : return 273 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 293 : return 280 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 294 : return 281 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 295 : return 282 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 296 : return 283 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 297 : this . popState ( ) ; return 665 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 298 : return 284 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 299 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'ALTER' , yy _ . yylloc , yy . lexer . upcomingInput ( ) ) ; return 816 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 300 : return 385 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 301 : return 286 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 302 : return 287 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 303 : this . begin ( 'between' ) ; return 288 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 304 : return 289 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 305 : return 290 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 306 : return 291 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 307 : return 292 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 308 : return 293 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 309 : parser . determineCase ( yy _ . yytext ) ; return 438 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 310 : return 294 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 311 : return 295 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 312 : return 296 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 313 : return 297 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 314 : return 298 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 315 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 316 : return 299 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 317 : return 300 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 318 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'DROP' , yy _ . yylloc , yy . lexer . upcomingInput ( ) ) ; return 859 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 319 : return 301 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 320 : return 302 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 321 : parser . yy . correlatedSubQuery = true ; return 303 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 322 : return 304 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 323 : return 305 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 324 : return 306 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 325 : parser . determineCase ( yy _ . yytext ) ; return 307 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 326 : return 308 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 327 : return 309 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 328 : return 310 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 329 : return 311 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 330 : return 312 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 331 : return 313 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 332 : return 1207 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 333 : return 314 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 334 : return 315 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 335 : return 316 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 336 : return 317 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 337 : return 318 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 338 : return 319 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 339 : return 320 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 340 : return 322 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 341 : return 323 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 342 : return 324 ;
2018-08-16 18:02:51 +08:00
break ;
case 343 : return 157 ;
break ;
2018-09-26 17:21:26 +08:00
case 344 : return 386 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 345 : return 325 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 346 : return 326 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 347 : return 328 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 348 : return 329 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 349 : return 330 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 350 : return 331 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 351 : return 332 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 352 : return 333 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 353 : return 334 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 354 : return 335 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 355 : return 336 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 356 : return 337 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 357 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'SELECT' , yy _ . yylloc ) ; return 577 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 358 : return 338 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 359 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'SET' , yy _ . yylloc ) ; return 339 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 360 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'SHOW' , yy _ . yylloc ) ; return 1273 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 361 : return 340 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 362 : return 341 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 363 : return 342 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 364 : return 343 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 365 : return 344 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 366 : return 345 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 367 : return 827 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 368 : return 346 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 369 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'TRUNCATE' , yy _ . yylloc , yy . lexer . upcomingInput ( ) ) ; return 760 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 370 : return 782 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 371 : parser . determineCase ( yy _ . yytext ) ; return 1185 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 372 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'USE' , yy _ . yylloc ) ; return 1309 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 373 : return 347 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 374 : return 1095 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 375 : return 349 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 376 : return 348 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 377 : return 350 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 378 : return 351 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 379 : parser . determineCase ( yy _ . yytext ) ; parser . addStatementTypeLocation ( 'WITH' , yy _ . yylloc ) ; return 352 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 380 : return 327 ;
2018-08-16 18:02:51 +08:00
break ;
case 381 : return 156 ;
break ;
2018-09-26 17:21:26 +08:00
case 382 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'avg' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 353 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 383 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'cast' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 354 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 384 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'count' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 355 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 385 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'max' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 356 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 386 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'min' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 357 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 387 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'stddev_pop' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 358 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 388 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'stddev_samp' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 359 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 389 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'sum' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 360 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 390 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'variance' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 361 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 391 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'var_pop' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 362 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 392 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'var_samp' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 363 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 393 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'collect_set' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 364 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 394 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'collect_list' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 365 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 395 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'corr' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 366 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 396 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'covar_pop' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 367 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 397 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'covar_samp' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 368 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 398 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'extract' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 791 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 399 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'histogram_numeric' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 370 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 400 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'ntile' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 371 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 401 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'percentile' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 372 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 402 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'percentile_approx' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 373 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 403 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'appx_median' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 374 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 404 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'extract' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 375 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 405 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'group_concat' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 376 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 406 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'ndv' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 377 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 407 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'stddev' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 378 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 408 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'variance_pop' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 379 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 409 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'variance_samp' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 380 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 410 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'cume_dist' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 411 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'dense_rank' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 412 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'first_value' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 413 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'lag' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 414 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'last_value' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 415 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'lead' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 416 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'rank' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 417 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'row_number' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 418 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'cume_dist' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 419 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'percent_rank' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 420 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'ntile' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 421 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'percent_rank' ; parser . addFunctionLocation ( yy _ . yylloc , yy _ . yytext ) ; return 381 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 422 : yy . lexer . unput ( '(' ) ; yy _ . yytext = 'system' ; return 724 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 423 : return 382 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 424 : return 382 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 425 : return 383 ;
2018-08-16 18:02:51 +08:00
break ;
case 426 : return 159 ;
break ;
case 427 : parser . yy . cursorFound = true ; return 18 ;
break ;
2018-09-26 17:21:26 +08:00
case 428 : parser . yy . cursorFound = true ; return 441 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 429 : return 384 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 430 : parser . addFileLocation ( yy _ . yylloc , yy _ . yytext ) ; return 786 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 431 : this . popState ( ) ; return 787 ;
2018-08-16 18:02:51 +08:00
break ;
case 432 : return 6 ;
break ;
2018-09-26 17:21:26 +08:00
case 433 : return 385 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 434 : return 386 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 435 : return 387 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 436 : return 388 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 437 : return 389 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 438 : return 390 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 439 : return 390 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 440 : return 390 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 441 : return 390 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 442 : return 390 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 443 : return 391 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 444 : return 392 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 445 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 446 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 447 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 448 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 449 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 450 : return 393 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 451 : return 394 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 452 : return 395 ;
2018-08-16 18:02:51 +08:00
break ;
2018-12-10 16:10:37 +08:00
case 453 : return 1000 ;
2018-08-16 18:02:51 +08:00
break ;
case 454 : return 10 ;
break ;
2018-09-26 17:21:26 +08:00
case 455 : return 396 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 456 : return 397 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 457 : return 398 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 458 : return 399 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 459 : return 400 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 460 : return 401 ;
2018-08-16 18:02:51 +08:00
break ;
case 461 : return 160 ;
break ;
2018-09-26 17:21:26 +08:00
case 462 : this . begin ( 'backtickedValue' ) ; return 402 ;
2018-08-16 18:02:51 +08:00
break ;
case 463 :
if ( parser . handleQuotedValueWithCursor ( this , yy _ . yytext , yy _ . yylloc , '`' ) ) {
2018-09-26 17:21:26 +08:00
return 471 ;
2018-08-16 18:02:51 +08:00
}
2018-09-26 17:21:26 +08:00
return 469 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 464 : this . popState ( ) ; return 402 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 465 : this . begin ( 'singleQuotedValue' ) ; return 403 ;
2018-08-16 18:02:51 +08:00
break ;
case 466 :
if ( parser . handleQuotedValueWithCursor ( this , yy _ . yytext , yy _ . yylloc , '\'' ) ) {
2018-09-26 17:21:26 +08:00
return 471 ;
2018-08-16 18:02:51 +08:00
}
2018-09-26 17:21:26 +08:00
return 469 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 467 : this . popState ( ) ; return 403 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 468 : this . begin ( 'doubleQuotedValue' ) ; return 404 ;
2018-08-16 18:02:51 +08:00
break ;
case 469 :
if ( parser . handleQuotedValueWithCursor ( this , yy _ . yytext , yy _ . yylloc , '"' ) ) {
2018-09-26 17:21:26 +08:00
return 471 ;
2018-08-16 18:02:51 +08:00
}
2018-09-26 17:21:26 +08:00
return 469 ;
2018-08-16 18:02:51 +08:00
break ;
2018-09-26 17:21:26 +08:00
case 470 : this . popState ( ) ; return 404 ;
2018-08-16 18:02:51 +08:00
break ;
case 471 : return 6 ;
break ;
case 472 : /* To prevent console logging of unknown chars */
break ;
case 473 :
break ;
case 474 :
break ;
case 475 :
break ;
case 476 :
break ;
case 477 :
break ;
case 478 :
break ;
case 479 :
break ;
case 480 : console . log ( yy _ . yytext ) ;
break ;
}
} ,
2018-11-30 13:40:48 +08:00
rules : [ /^(?:\s)/i , /^(?:--.*)/i , /^(?:[\/][*][^*]*[*]+([^\/*][^*]*[*]+)*[\/])/i , /^(?:\u2020)/i , /^(?:\u2021)/i , /^(?:ALL)/i , /^(?:ARRAY)/i , /^(?:AS)/i , /^(?:AUTHORIZATION)/i , /^(?:BINARY)/i , /^(?:CACHE)/i , /^(?:COLUMN)/i , /^(?:CONF)/i , /^(?:CONSTRAINT)/i , /^(?:CREATE)/i , /^(?:CUBE)/i , /^(?:CURRENT)/i , /^(?:DATE)/i , /^(?:DELETE)/i , /^(?:DESCRIBE)/i , /^(?:EXTENDED)/i , /^(?:EXTERNAL)/i , /^(?:FOR)/i , /^(?:FOREIGN)/i , /^(?:FUNCTION)/i , /^(?:GRANT)/i , /^(?:GROUPING)/i , /^(?:IMPORT)/i , /^(?:INSERT)/i , /^(?:LATERAL)/i , /^(?:LOCAL)/i , /^(?:MACRO)/i , /^(?:MAP)/i , /^(?:NONE)/i , /^(?:OF)/i , /^(?:OUT)/i , /^(?:PRIMARY)/i , /^(?:REFERENCES)/i , /^(?:REVOKE)/i , /^(?:ROLLUP)/i , /^(?:TABLE)/i , /^(?:TIMESTAMP)/i , /^(?:USER)/i , /^(?:USING)/i , /^(?:VIEWS)/i , /^(?:LIFECYCLE)/i , /^(?:ABORT)/i , /^(?:ADD)/i , /^(?:ADMIN)/i , /^(?:AFTER)/i , /^(?:ANALYZE)/i , /^(?:ARCHIVE)/i , /^(?:ASC)/i , /^(?:AVRO)/i , /^(?:BUCKET)/i , /^(?:BUCKETS)/i , /^(?:CASCADE)/i , /^(?:CHANGE)/i , /^(?:CLUSTER)/i , /^(?:CLUSTERED)/i , /^(?:COLLECTION)/i , /^(?:COLUMNS)/i , /^(?:COMMENT)/i , /^(?:COMPACT)/i , /^(?:COMPACTIONS)/i , /^(?:COMPUTE)/i , /^(?:CONCATENATE)/i , /^(?:DATA)/i , /^(?:DATABASES)/i , /^(?:DAY)/i , /^(?:DAYOFWEEK)/i , /^(?:DBPROPERTIES)/i , /^(?:DEFERRED)/i , /^(?:DEFINED)/i , /^(?:DELIMITED)/i , /^(?:DEPENDENCY)/i , /^(?:DESC)/i , /^(?:DIRECTORY)/i , /^(?:DISABLE)/i , /^(?:DISTRIBUTE)/i , /^(?:DOUBLE\s+PRECISION)/i , /^(?:ESCAPED)/i , /^(?:ENABLE)/i , /^(?:EXCHANGE)/i , /^(?:EXPLAIN)/i , /^(?:EXPORT)/i , /^(?:FIELDS)/i , /^(?:FILE)/i , /^(?:FILEFORMAT)/i , /^(?:FIRST)/i , /^(?:FORMAT)/i , /^(?:FORMATTED)/i , /^(?:FUNCTION)/i , /^(?:FUNCTIONS)/i , /^(?:HOUR)/i , /^(?:IDXPROPERTIES)/i , /^(?:INDEX)/i , /^(?:INDEXES)/i , /^(?:INPATH)/i , /^(?:INPUTFORMAT)/i , /^(?:ITEMS)/i , /^(?:JAR)/i , /^(?:KEY)/i , /^(?:KEYS)/i , /^(?:LINES)/i , /^(?:LOAD)/i , /^(?:LOCATION)/i , /^(?:LOCK)/i , /^(?:LOCKS)/i , /^(?:MATCHED)/i , /^(?:MERGE)/i , /^(?:METADATA)/i , /^(?:MINUTE)/i , /^(?:MONTH)/i , /^(?:MSCK)/i , /^(?:NORELY)/i , /^(?:NOSCAN)/i , /^(?:NOVALIDATE)/i , /^(?:NO_DROP)/i , /^(?:OFFLINE)/i , /^(?:ORC)/i , /^(?:OUTPUTFORMAT)/i , /^(?:OVERWRITE)/i , /^(?:OVERWRITE\s+DIRECTORY)/i , /^(?:OWNER)/i , /^(?:PARQUET)/i , /^(?:PARTITIONED)/i , /^(?:PARTITIONS)/i , /^(?:PERCENT)/i , /^(?:PRIVILEGES)/i , /^(?:PURGE)/i , /^(?:QUARTER)/i , /^(?:RCFILE)/i , /^(?:REBUILD)/i , /^(?:RELOAD)/i , /^(?:RELY)/i , /^(?:REPAIR)/i , /^(?:REPLICATION)/i , /^(?:RECOVER)/i , /^(?:RENAME)/i , /^(?:REPLACE)/i , /^(?:RESTRICT)/i , /^(?:ROLE)/i , /^(?:ROLES)/i , /^(?:SECOND)/i , /^(?:SCHEMA)/i , /^(?:SCHEMAS)/i , /^(?:SEQUENCEFILE)/i , /^(?:SERDE)/i , /^(?:SERDEPROPERTIES)/i , /^(?:SETS)/i , /^(?:SHOW)/i , /^(?:SHOW_DATABASE)/i , /^(?:SKEWED)/i , /^(?:SKEWED LOCATION)/i , /^(?:SORT)/i , /^(?:SORTED)/i , /^(?:STATISTICS)/i , /^(?:STORED)/i , /^(?:STORED\s+AS\s+DIRECTORIES)/i , /^(?:STRING)/i , /^(?:STRUCT)/i , /^(?:TABLES)/i , /^(?:TABLESAMPLE)/i , /^(?:TBLPROPERTIES)/i , /^(?:TEMPORARY)/i , /^(?:TERMINATED)/i , /^(?:TEXTFILE)/i , /^(?:TINYINT)/i , /^(?:TOUCH)/i , /^(?:TRANSACTIONS)/i , /^(?:UNARCHIVE)/i , /^(?:UNIONTYPE)/i , /^(?:USE)/i , /^(?:VIEW)/i , /^(?:WAIT)/i , /^(?:WEEK)/i , /^(?:WINDOW)/i , /^(?:YEAR)/i , /^(?:\.)/i , /^(?:\[)/i , /^(?:\])/i , /^(?:ADD)/i , /^(?:AGGREGATE)/i , /^(?:AVRO)/i , /^(?:CACHED)/i , /^(?:CASCADE)/i , /^(?:CHANGE)/i , /^(?:CLOSE_FN)/i , /^(?:COLUMN)/i , /^(?:COLUMNS)/i , /^(?:COMMENT)/i , /^(?:COMPUTE)/i , /^(?:CREATE)/i , /^(?:DATA)/i , /^(?:DATABASES)/i , /^(?:DELETE)/i , /^(?:DELIMITED)/i , /^(?:DESCRIBE)/i , /^(?:ESCAPED)/i , /^(?:EXPLAIN)/i , /^(?:EXTERNAL)/i , /^(?:EXTENDED)/i , /^(?:FIELDS)/i , /^(?:FILEFORMAT)/i , /^(?:FILES)/i , /^(?:FINALIZE_FN)/i , /^(?:FIRST)/i , /^(?:FORMAT)/i , /^(?:FORMATTED)/i , /^(?:FUNCTION)/i , /^(?:FUNCTIONS)/i , /^(?:GROUP)/i , /^(?:HASH)/i , /^(?:ILIKE)/i , /^(?:INCREMENTAL)/i , /^(?:INSERT)/i , /^(?:INTERVAL)/i , /^(?:INTERMEDIATE)/i , /^(?:INIT_FN)/i , /^(?:INVALIDATE)/i , /^(?:INPATH)/i , /^(?:IREGEXP)/i , /^(?:KEY)/i , /^(?:KUDU)/i , /^(?:LAST)/i , /^(?:LIKE\s+PARQUET)/i , /^(?:LIMIT)/i , /^(?:LINES)/i , /^(?:LOAD)/i , /^(?:LOCATION)/i , /^(?:MERGE_FN)/i , /^(?:METADATA)/i , /^(?:NULLS)/i , /^(?:OFFSET)/i , /^(?:ORC)/i , /^(?:OVERWRITE)/i , /^(?:PARQUET)/i , /^(?:PARTITIONED)/i , /^(?:PARTITIONS)/i , /^(?:PREPARE_FN)/i , /^(?:PRIMARY)/i , /^(?:RCFILE)/i , /^(?:RANGE)/i , /^(?:REAL)/i , /^(?:REFRESH)/i , /^(?:RENAME)/i , /^(?:REPEATABLE)/i , /^(?:REPLACE)/i , /^(?:REPLICATION)/i , /^(?:RESTRICT)/i , /^(?:RETURNS)/i , /^(?:REVOKE)/i , /^(?:SEQUENCEFILE)/i , / ^ ( ? : S E R D E P
2018-08-16 18:02:51 +08:00
conditions : { "hdfs" : { "rules" : [ 427 , 428 , 429 , 430 , 431 , 432 , 476 ] , "inclusive" : false } , "doubleQuotedValue" : { "rules" : [ 469 , 470 , 479 ] , "inclusive" : false } , "singleQuotedValue" : { "rules" : [ 466 , 467 , 478 ] , "inclusive" : false } , "backtickedValue" : { "rules" : [ 463 , 464 , 477 ] , "inclusive" : false } , "between" : { "rules" : [ 0 , 1 , 2 , 3 , 4 , 297 , 298 , 299 , 300 , 301 , 302 , 303 , 304 , 305 , 306 , 307 , 308 , 309 , 310 , 311 , 312 , 313 , 314 , 315 , 316 , 317 , 318 , 319 , 320 , 321 , 322 , 323 , 324 , 325 , 326 , 327 , 328 , 329 , 330 , 331 , 332 , 333 , 334 , 335 , 336 , 337 , 338 , 339 , 340 , 341 , 342 , 343 , 344 , 345 , 346 , 347 , 348 , 349 , 350 , 351 , 352 , 353 , 354 , 355 , 356 , 357 , 358 , 359 , 360 , 361 , 362 , 363 , 364 , 365 , 366 , 367 , 368 , 369 , 370 , 371 , 372 , 373 , 374 , 375 , 376 , 377 , 378 , 379 , 380 , 381 , 382 , 383 , 384 , 385 , 386 , 387 , 388 , 389 , 390 , 391 , 392 , 410 , 411 , 412 , 413 , 414 , 415 , 416 , 417 , 423 , 424 , 425 , 426 , 433 , 434 , 435 , 436 , 437 , 438 , 439 , 440 , 441 , 442 , 443 , 444 , 445 , 446 , 447 , 448 , 449 , 450 , 451 , 452 , 453 , 454 , 455 , 456 , 457 , 458 , 459 , 460 , 461 , 462 , 465 , 468 , 471 , 472 , 473 , 480 ] , "inclusive" : true } , "hive" : { "rules" : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 101 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 118 , 119 , 120 , 121 , 122 , 123 , 124 , 125 , 126 , 127 , 128 , 129 , 130 , 131 , 132 , 133 , 134 , 135 , 136 , 137 , 138 , 139 , 140 , 141 , 142 , 143 , 144 , 145 , 146 , 147 , 148 , 149 , 150 , 151 , 152 , 153 , 154 , 155 , 156 , 157 , 158 , 159 , 160 , 161 , 162 , 163 , 164 , 165 , 166 , 167 , 168 , 169 , 170 , 171 , 172 , 173 , 174 , 175 , 176 , 177 , 178 , 179 , 180 , 181 , 298 , 299 , 300 , 301 , 302 , 303 , 304 , 305 , 306 , 307 , 308 , 309 , 310 , 311 , 312 , 313 , 314 , 315 , 316 , 317 , 318 , 319 , 320 , 321 , 322 , 323 , 324 , 325 , 326 , 327 , 328 , 329 , 330 , 331 , 332 , 333 , 334 , 335 , 336 , 337 , 338 , 339 , 340 , 341 , 342 , 343 , 344 , 345 , 346 , 347 , 348 , 349 , 350 , 351 , 352 , 353 , 354 , 355 , 356 , 357 , 358 , 359 , 360 , 361 , 362 , 363 , 364 , 365 , 366 , 367 , 368 , 369 , 370 , 371 , 372 , 373 , 374 , 375 , 376 , 377 , 378 , 379 , 380 , 381 , 382 , 383 , 384 , 385 , 386 , 387 , 388 , 389 , 390 , 391 , 392 , 393 , 394 , 395 , 396 , 397 , 398 , 399 , 400 , 401 , 402 , 410 , 411 , 412 , 413 , 414 , 415 , 416 , 417 , 418 , 419 , 423 , 424 , 425 , 426 , 433 , 434 , 435 , 436 , 437 , 438 , 439 , 440 , 441 , 442 , 443 , 444 , 445 , 446 , 447 , 448 , 449 , 450 , 451 , 452 , 453 , 454 , 455 , 456 , 457 , 458 , 459 , 460 , 461 , 462 , 465 , 468 , 471 , 472 , 474 , 480 ] , "inclusive" : true } , "impala" : { "rules" : [ 0 , 1 , 2 , 3 , 4 , 182 , 183 , 184 , 185 , 186 , 187 , 188 , 189 , 190 , 191 , 192 , 193 , 194 , 195 , 196 , 197 , 198 , 199 , 200 , 201 , 202 , 203 , 204 , 205 , 206 , 207 , 208 , 209 , 210 , 211 , 212 , 213 , 214 , 215 , 216 , 217 , 218 , 219 , 220 , 221 , 222 , 223 , 224 , 225 , 226 , 227 , 228 , 229 , 230 , 231 , 232 , 233 , 234 , 235 , 236 , 237 , 238 , 239 , 240 , 241 , 242 , 243 , 244 , 245 , 246 , 247 , 248 , 249 , 250 , 251 , 252 , 253 , 254 , 255 , 256 , 257 , 258 , 259 , 260 , 261 , 262 , 263 , 264 , 265 , 266 , 267 , 268 , 269 , 270 , 271 , 272 , 273 , 274 , 275 , 276 , 277 , 278 , 279 , 280 , 281 , 282 , 283 , 284 , 285 , 286 , 287 , 288 , 289 , 290 , 291 , 292 , 293 , 294 , 295 , 296 , 298 , 299 , 300 , 301 , 302 , 303 , 304 , 305 , 306 , 307 , 308 , 309 , 310 , 311 , 312 , 313 , 314 , 315 , 316 , 317 , 318 , 319 , 320 , 321 , 322 , 323 , 324 , 325 , 326 , 327 , 328 , 329 , 330 , 331 , 332 , 333 , 334 , 335 , 336 , 337 , 338 , 339 , 340 , 341 , 342 , 343 , 344 , 345 , 346 , 347 , 348 , 349 , 350 , 351 , 352 , 353 , 354 , 355 , 356 , 357 , 358 , 359 , 360 , 361 , 362 , 363 , 364 , 365 , 366 , 367 , 368 , 369 , 370 , 371 , 372 , 373 , 374 , 375 , 376 , 377 , 378 , 379 , 380 , 381 , 382 , 383 , 384 , 385 , 386 , 387 , 388 , 389 , 390 , 391 , 392 , 403 , 404 , 405 , 406 , 407 , 408 , 409 , 410 , 411 , 412 , 413 , 414 , 415 , 416 , 417 , 420 , 421 , 422 , 423 , 424 , 425 , 426 , 433 , 434 , 435 , 436 , 437 , 438 , 439 , 440 , 441 , 442 , 443 , 444 , 445 , 446 , 447 , 448 , 449 , 450 , 451 , 452 , 453 , 454 , 455 , 456 , 457 , 458 , 459 , 460 , 461 , 462 , 465 , 468 , 471 , 472 , 475 , 480 ] , "inclusive" : true } , "INITIAL" : { "rules" : [ 0 , 1 , 2 , 3 , 4 , 298 , 299 , 300 , 301 , 302 , 303 , 304 , 305 , 306 , 307 , 308 , 309 , 310 , 311 , 312 , 313 , 314 , 315 , 316 , 317 , 318 , 319 , 320 , 321 , 322 , 323 , 324 , 325 , 326 , 327 , 328 , 329 , 330 , 331 , 332 , 333 , 334 , 335 , 336 , 337 , 338 , 339 , 340 , 341 , 342 , 343 , 344 , 345 , 346 , 347 , 348 , 349 , 350 , 351 , 352 , 353 , 354 , 355 , 356 , 357 , 358 , 359 , 360 , 361 , 362 , 363 , 364 , 365 , 366 , 367 , 368 , 369 , 370 , 371 , 372 , 373 , 374 , 375 , 376 , 377 , 378 , 379 , 380 , 381 , 382 , 383 , 384 , 385 , 386 , 387 , 388 , 389 , 390 , 391 , 392 , 410 , 411 , 412 , 413 , 414 , 415 , 416 , 417 , 423 , 424 , 425 , 426 , 433 , 434 , 435 , 436 , 437 , 438 , 439 , 440 , 441 , 442 , 443 , 444 , 445 , 446 , 447 , 448 , 449 , 450 , 451 , 452 , 453 , 454 , 455 , 456 , 457 , 458 , 459 , 460 , 461 , 462 , 465 , 468 , 471 , 472 , 480 ] , "inclusive" : true } }
} ) ;
return lexer ;
} ) ( ) ;
parser . lexer = lexer ;
function Parser ( ) {
this . yy = { } ;
}
Parser . prototype = parser ; parser . Parser = Parser ;
return new Parser ;
} ) ( ) ;
if ( typeof require !== 'undefined' && typeof exports !== 'undefined' ) {
exports . parser = sqlSyntaxParser ;
exports . Parser = sqlSyntaxParser . Parser ;
exports . parse = function ( ) { return sqlSyntaxParser . parse . apply ( sqlSyntaxParser , arguments ) ; } ;
exports . main = function commonjsMain ( args ) {
if ( ! args [ 1 ] ) {
console . log ( 'Usage: ' + args [ 0 ] + ' FILE' ) ;
process . exit ( 1 ) ;
}
var source = require ( 'fs' ) . readFileSync ( require ( 'path' ) . normalize ( args [ 1 ] ) , "utf8" ) ;
return exports . parser . parse ( source ) ;
} ;
if ( typeof module !== 'undefined' && require . main === module ) {
exports . main ( process . argv . slice ( 1 ) ) ;
}
}