dt-sql-parser
Version:
SQL Parsers for BigData, built with antlr4
1,274 lines (1,273 loc) • 938 kB
JavaScript
// Generated from dt-sql-parser/src/grammar/impala/ImpalaSqlParser.g4 by ANTLR 4.13.1
// @ts-nocheck
import * as antlr from "antlr4ng";
import { SQLParserBase } from '../SQLParserBase';
export class ImpalaSqlParser extends SQLParserBase {
get grammarFileName() { return "ImpalaSqlParser.g4"; }
get literalNames() { return ImpalaSqlParser.literalNames; }
get symbolicNames() { return ImpalaSqlParser.symbolicNames; }
get ruleNames() { return ImpalaSqlParser.ruleNames; }
get serializedATN() { return ImpalaSqlParser._serializedATN; }
createFailedPredicateException(predicate, message) {
return new antlr.FailedPredicateException(this, predicate, message);
}
constructor(input) {
super(input);
this.interpreter = new antlr.ParserATNSimulator(this, ImpalaSqlParser._ATN, ImpalaSqlParser.decisionsToDFA, new antlr.PredictionContextCache());
}
program() {
let localContext = new ProgramContext(this.context, this.state);
this.enterRule(localContext, 0, ImpalaSqlParser.RULE_program);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 381;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 4 || ((((_la - 34)) & ~0x1F) === 0 && ((1 << (_la - 34)) & 22085645) !== 0) || _la === 67 || _la === 86 || ((((_la - 99)) & ~0x1F) === 0 && ((1 << (_la - 99)) & 524545) !== 0) || ((((_la - 161)) & ~0x1F) === 0 && ((1 << (_la - 161)) & 134520835) !== 0) || ((((_la - 196)) & ~0x1F) === 0 && ((1 << (_la - 196)) & 1083521) !== 0) || _la === 264 || _la === 265) {
{
{
this.state = 378;
this.singleStatement();
}
}
this.state = 383;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
this.state = 384;
this.match(ImpalaSqlParser.EOF);
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
singleStatement() {
let localContext = new SingleStatementContext(this.context, this.state);
this.enterRule(localContext, 2, ImpalaSqlParser.RULE_singleStatement);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 386;
this.sqlStatement();
this.state = 388;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 262) {
{
this.state = 387;
this.match(ImpalaSqlParser.SEMICOLON);
}
}
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
sqlStatement() {
let localContext = new SqlStatementContext(this.context, this.state);
this.enterRule(localContext, 4, ImpalaSqlParser.RULE_sqlStatement);
try {
this.state = 412;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 2, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 390;
this.queryStatement();
}
break;
case 2:
this.enterOuterAlt(localContext, 2);
{
this.state = 391;
this.useStatement();
}
break;
case 3:
this.enterOuterAlt(localContext, 3);
{
this.state = 392;
this.createStatement();
}
break;
case 4:
this.enterOuterAlt(localContext, 4);
{
this.state = 393;
this.alterStatement();
}
break;
case 5:
this.enterOuterAlt(localContext, 5);
{
this.state = 394;
this.truncateTableStatement();
}
break;
case 6:
this.enterOuterAlt(localContext, 6);
{
this.state = 395;
this.describeStatement();
}
break;
case 7:
this.enterOuterAlt(localContext, 7);
{
this.state = 396;
this.computeStatement();
}
break;
case 8:
this.enterOuterAlt(localContext, 8);
{
this.state = 397;
this.dropStatement();
}
break;
case 9:
this.enterOuterAlt(localContext, 9);
{
this.state = 398;
this.grantStatement();
}
break;
case 10:
this.enterOuterAlt(localContext, 10);
{
this.state = 399;
this.revokeStatement();
}
break;
case 11:
this.enterOuterAlt(localContext, 11);
{
this.state = 400;
this.insertStatement();
}
break;
case 12:
this.enterOuterAlt(localContext, 12);
{
this.state = 401;
this.deleteStatement();
}
break;
case 13:
this.enterOuterAlt(localContext, 13);
{
this.state = 402;
this.updateStatement();
}
break;
case 14:
this.enterOuterAlt(localContext, 14);
{
this.state = 403;
this.upsertStatement();
}
break;
case 15:
this.enterOuterAlt(localContext, 15);
{
this.state = 404;
this.showStatement();
}
break;
case 16:
this.enterOuterAlt(localContext, 16);
{
this.state = 405;
this.addCommentStatement();
}
break;
case 17:
this.enterOuterAlt(localContext, 17);
{
this.state = 406;
this.explainStatement();
}
break;
case 18:
this.enterOuterAlt(localContext, 18);
{
this.state = 407;
this.setStatement();
}
break;
case 19:
this.enterOuterAlt(localContext, 19);
{
this.state = 408;
this.shutdownStatement();
}
break;
case 20:
this.enterOuterAlt(localContext, 20);
{
this.state = 409;
this.invalidateMetaStatement();
}
break;
case 21:
this.enterOuterAlt(localContext, 21);
{
this.state = 410;
this.loadDataStatement();
}
break;
case 22:
this.enterOuterAlt(localContext, 22);
{
this.state = 411;
this.refreshStatement();
}
break;
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
useStatement() {
let localContext = new UseStatementContext(this.context, this.state);
this.enterRule(localContext, 6, ImpalaSqlParser.RULE_useStatement);
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 414;
this.match(ImpalaSqlParser.KW_USE);
this.state = 415;
this.databaseNamePath();
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createStatement() {
let localContext = new CreateStatementContext(this.context, this.state);
this.enterRule(localContext, 8, ImpalaSqlParser.RULE_createStatement);
try {
this.state = 425;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 3, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 417;
this.createSchema();
}
break;
case 2:
this.enterOuterAlt(localContext, 2);
{
this.state = 418;
this.createRole();
}
break;
case 3:
this.enterOuterAlt(localContext, 3);
{
this.state = 419;
this.createAggregateFunction();
}
break;
case 4:
this.enterOuterAlt(localContext, 4);
{
this.state = 420;
this.createFunction();
}
break;
case 5:
this.enterOuterAlt(localContext, 5);
{
this.state = 421;
this.createView();
}
break;
case 6:
this.enterOuterAlt(localContext, 6);
{
this.state = 422;
this.createKuduTableAsSelect();
}
break;
case 7:
this.enterOuterAlt(localContext, 7);
{
this.state = 423;
this.createTableLike();
}
break;
case 8:
this.enterOuterAlt(localContext, 8);
{
this.state = 424;
this.createTableSelect();
}
break;
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createTableSelect() {
let localContext = new CreateTableSelectContext(this.context, this.state);
this.enterRule(localContext, 10, ImpalaSqlParser.RULE_createTableSelect);
let _la;
try {
let alternative;
this.enterOuterAlt(localContext, 1);
{
this.state = 427;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 429;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 19) {
{
this.state = 428;
this.match(ImpalaSqlParser.KW_EXTERNAL);
}
}
this.state = 431;
this.match(ImpalaSqlParser.KW_TABLE);
this.state = 433;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 432;
this.ifNotExists();
}
}
this.state = 435;
this.tableNameCreate();
this.state = 451;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 8, this.context)) {
case 1:
{
this.state = 436;
this.match(ImpalaSqlParser.LPAREN);
this.state = 437;
this.columnDefinition();
this.state = 442;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 6, this.context);
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
if (alternative === 1) {
{
{
this.state = 438;
this.match(ImpalaSqlParser.COMMA);
this.state = 439;
this.columnDefinition();
}
}
}
this.state = 444;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 6, this.context);
}
this.state = 447;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 263) {
{
this.state = 445;
this.match(ImpalaSqlParser.COMMA);
this.state = 446;
this.constraintSpecification();
}
}
this.state = 449;
this.match(ImpalaSqlParser.RPAREN);
}
break;
}
this.state = 459;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 17) {
{
this.state = 453;
this.match(ImpalaSqlParser.KW_PARTITIONED);
this.state = 454;
this.match(ImpalaSqlParser.KW_BY);
this.state = 457;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) {
case 1:
{
this.state = 455;
this.columnAliases();
}
break;
case 2:
{
this.state = 456;
this.partitionedBy();
}
break;
}
}
}
this.state = 461;
this.createCommonItem();
this.state = 464;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 9) {
{
this.state = 462;
this.match(ImpalaSqlParser.KW_AS);
this.state = 463;
this.queryStatement();
}
}
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createTableLike() {
let localContext = new CreateTableLikeContext(this.context, this.state);
this.enterRule(localContext, 12, ImpalaSqlParser.RULE_createTableLike);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 466;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 468;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 19) {
{
this.state = 467;
this.match(ImpalaSqlParser.KW_EXTERNAL);
}
}
this.state = 470;
this.match(ImpalaSqlParser.KW_TABLE);
this.state = 472;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 471;
this.ifNotExists();
}
}
this.state = 474;
this.tableNameCreate();
this.state = 475;
this.match(ImpalaSqlParser.KW_LIKE);
this.state = 479;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case ImpalaSqlParser.KW_BERNOULLI:
case ImpalaSqlParser.KW_CURRENT_TIMESTAMP:
case ImpalaSqlParser.KW_CURRENT_USER:
case ImpalaSqlParser.KW_DAY:
case ImpalaSqlParser.KW_DAYS:
case ImpalaSqlParser.KW_EXCLUDING:
case ImpalaSqlParser.KW_EXTRACT:
case ImpalaSqlParser.KW_HOUR:
case ImpalaSqlParser.KW_INCLUDING:
case ImpalaSqlParser.KW_KEY:
case ImpalaSqlParser.KW_LOCALTIME:
case ImpalaSqlParser.KW_MINUTE:
case ImpalaSqlParser.KW_MINUTES:
case ImpalaSqlParser.KW_MONTH:
case ImpalaSqlParser.KW_MONTHS:
case ImpalaSqlParser.KW_NFC:
case ImpalaSqlParser.KW_NFD:
case ImpalaSqlParser.KW_NFKC:
case ImpalaSqlParser.KW_NFKD:
case ImpalaSqlParser.KW_OPTION:
case ImpalaSqlParser.KW_ORDINALITY:
case ImpalaSqlParser.KW_PRIVILEGES:
case ImpalaSqlParser.KW_PROPERTIES:
case ImpalaSqlParser.KW_SECOND:
case ImpalaSqlParser.KW_SECONDS:
case ImpalaSqlParser.KW_SHUTDOWN:
case ImpalaSqlParser.KW_SUBSTRING:
case ImpalaSqlParser.KW_SYSTEM:
case ImpalaSqlParser.KW_TRY_CAST:
case ImpalaSqlParser.KW_USER:
case ImpalaSqlParser.KW_VIEWS:
case ImpalaSqlParser.KW_YEAR:
case ImpalaSqlParser.KW_ORC:
case ImpalaSqlParser.KW_DATE:
case ImpalaSqlParser.STRING:
case ImpalaSqlParser.IDENTIFIER:
case ImpalaSqlParser.DIGIT_IDENTIFIER:
case ImpalaSqlParser.BACKQUOTED_IDENTIFIER:
{
this.state = 476;
this.tableNamePath();
}
break;
case ImpalaSqlParser.KW_PARQUET:
{
this.state = 477;
this.match(ImpalaSqlParser.KW_PARQUET);
this.state = 478;
localContext._parquet = this.stringLiteral();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
this.state = 484;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 17) {
{
this.state = 481;
this.match(ImpalaSqlParser.KW_PARTITIONED);
this.state = 482;
this.match(ImpalaSqlParser.KW_BY);
this.state = 483;
this.partitionedBy();
}
}
this.state = 486;
this.createCommonItem();
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createKuduTableAsSelect() {
let localContext = new CreateKuduTableAsSelectContext(this.context, this.state);
this.enterRule(localContext, 14, ImpalaSqlParser.RULE_createKuduTableAsSelect);
let _la;
try {
let alternative;
this.enterOuterAlt(localContext, 1);
{
this.state = 488;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 490;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 19) {
{
this.state = 489;
this.match(ImpalaSqlParser.KW_EXTERNAL);
}
}
this.state = 492;
this.match(ImpalaSqlParser.KW_TABLE);
this.state = 494;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 493;
this.ifNotExists();
}
}
this.state = 496;
this.tableNameCreate();
this.state = 514;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 265) {
{
this.state = 497;
this.match(ImpalaSqlParser.LPAREN);
this.state = 498;
this.kuduTableElement();
this.state = 503;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 18, this.context);
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
if (alternative === 1) {
{
{
this.state = 499;
this.match(ImpalaSqlParser.COMMA);
this.state = 500;
this.kuduTableElement();
}
}
}
this.state = 505;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 18, this.context);
}
this.state = 510;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 263) {
{
this.state = 506;
this.match(ImpalaSqlParser.COMMA);
this.state = 507;
this.match(ImpalaSqlParser.KW_PRIMARY);
this.state = 508;
this.match(ImpalaSqlParser.KW_KEY);
this.state = 509;
this.columnAliases();
}
}
this.state = 512;
this.match(ImpalaSqlParser.RPAREN);
}
}
this.state = 521;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 150) {
{
this.state = 516;
this.match(ImpalaSqlParser.KW_PRIMARY);
this.state = 517;
this.match(ImpalaSqlParser.KW_KEY);
this.state = 519;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 265) {
{
this.state = 518;
this.columnAliases();
}
}
}
}
this.state = 526;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 145) {
{
this.state = 523;
this.match(ImpalaSqlParser.KW_PARTITION);
this.state = 524;
this.match(ImpalaSqlParser.KW_BY);
this.state = 525;
this.kuduPartitionClause();
}
}
this.state = 529;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 34) {
{
this.state = 528;
this.commentClause();
}
}
this.state = 531;
this.match(ImpalaSqlParser.KW_STORED);
this.state = 532;
this.match(ImpalaSqlParser.KW_AS);
this.state = 533;
this.match(ImpalaSqlParser.KW_KUDU);
this.state = 536;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 25) {
{
this.state = 534;
this.match(ImpalaSqlParser.KW_TBLPROPERTIES);
this.state = 535;
localContext._tblProp = this.properties();
}
}
this.state = 540;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 9) {
{
this.state = 538;
this.match(ImpalaSqlParser.KW_AS);
this.state = 539;
this.queryStatement();
}
}
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createView() {
let localContext = new CreateViewContext(this.context, this.state);
this.enterRule(localContext, 16, ImpalaSqlParser.RULE_createView);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 542;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 543;
this.match(ImpalaSqlParser.KW_VIEW);
this.state = 545;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 544;
this.ifNotExists();
}
}
this.state = 547;
this.viewNameCreate();
this.state = 549;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 265) {
{
this.state = 548;
this.viewColumns();
}
}
this.state = 552;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 34) {
{
this.state = 551;
this.commentClause();
}
}
this.state = 556;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 25) {
{
this.state = 554;
this.match(ImpalaSqlParser.KW_TBLPROPERTIES);
this.state = 555;
localContext._tblProp = this.properties();
}
}
this.state = 558;
this.match(ImpalaSqlParser.KW_AS);
this.state = 559;
this.queryStatement();
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createSchema() {
let localContext = new CreateSchemaContext(this.context, this.state);
this.enterRule(localContext, 18, ImpalaSqlParser.RULE_createSchema);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 561;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 562;
_la = this.tokenStream.LA(1);
if (!(_la === 46 || _la === 170)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 564;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 563;
this.ifNotExists();
}
}
this.state = 566;
this.databaseNameCreate();
this.state = 568;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 32, this.context)) {
case 1:
{
this.state = 567;
this.commentClause();
}
break;
}
this.state = 572;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 24) {
{
this.state = 570;
this.match(ImpalaSqlParser.KW_LOCATION);
this.state = 571;
localContext._location = this.stringLiteral();
}
}
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createRole() {
let localContext = new CreateRoleContext(this.context, this.state);
this.enterRule(localContext, 20, ImpalaSqlParser.RULE_createRole);
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 574;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 575;
this.match(ImpalaSqlParser.KW_ROLE);
this.state = 576;
localContext._name = this.identifier();
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createAggregateFunction() {
let localContext = new CreateAggregateFunctionContext(this.context, this.state);
this.enterRule(localContext, 22, ImpalaSqlParser.RULE_createAggregateFunction);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 578;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 580;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 12) {
{
this.state = 579;
this.match(ImpalaSqlParser.KW_AGGREGATE);
}
}
this.state = 582;
this.match(ImpalaSqlParser.KW_FUNCTION);
this.state = 584;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 583;
this.ifNotExists();
}
}
this.state = 586;
this.functionNameCreate();
this.state = 599;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 265) {
{
this.state = 587;
this.match(ImpalaSqlParser.LPAREN);
this.state = 596;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 8 || _la === 14 || ((((_la - 43)) & ~0x1F) === 0 && ((1 << (_la - 43)) & 37748835) !== 0) || ((((_la - 91)) & ~0x1F) === 0 && ((1 << (_la - 91)) & 2416443409) !== 0) || ((((_la - 123)) & ~0x1F) === 0 && ((1 << (_la - 123)) & 1610760439) !== 0) || ((((_la - 172)) & ~0x1F) === 0 && ((1 << (_la - 172)) & 8401155) !== 0) || ((((_la - 204)) & ~0x1F) === 0 && ((1 << (_la - 204)) & 4286652929) !== 0) || ((((_la - 236)) & ~0x1F) === 0 && ((1 << (_la - 236)) & 511) !== 0) || ((((_la - 274)) & ~0x1F) === 0 && ((1 << (_la - 274)) & 7873) !== 0)) {
{
this.state = 588;
this.type_(0);
this.state = 593;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 263) {
{
{
this.state = 589;
this.match(ImpalaSqlParser.COMMA);
this.state = 590;
this.type_(0);
}
}
this.state = 595;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
}
}
this.state = 598;
this.match(ImpalaSqlParser.RPAREN);
}
}
this.state = 601;
this.match(ImpalaSqlParser.KW_RETURNS);
this.state = 602;
localContext._returnType = this.type_(0);
this.state = 605;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 102) {
{
this.state = 603;
this.match(ImpalaSqlParser.KW_INTERMEDIATE);
this.state = 604;
this.type_(0);
}
}
this.state = 607;
this.match(ImpalaSqlParser.KW_LOCATION);
this.state = 608;
this.match(ImpalaSqlParser.STRING);
this.state = 612;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 104) {
{
this.state = 609;
this.match(ImpalaSqlParser.KW_INIT_FN);
this.state = 610;
this.match(ImpalaSqlParser.EQ);
this.state = 611;
this.match(ImpalaSqlParser.STRING);
}
}
this.state = 614;
this.match(ImpalaSqlParser.KW_UPDATE_FN);
this.state = 615;
this.match(ImpalaSqlParser.EQ);
this.state = 616;
this.match(ImpalaSqlParser.STRING);
this.state = 617;
this.match(ImpalaSqlParser.KW_MERGE_FN);
this.state = 618;
this.match(ImpalaSqlParser.EQ);
this.state = 619;
this.match(ImpalaSqlParser.STRING);
this.state = 623;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 18) {
{
this.state = 620;
this.match(ImpalaSqlParser.KW_PREPARE_FN);
this.state = 621;
this.match(ImpalaSqlParser.EQ);
this.state = 622;
this.match(ImpalaSqlParser.STRING);
}
}
this.state = 628;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 20) {
{
this.state = 625;
this.match(ImpalaSqlParser.KW_CLOSEFN);
this.state = 626;
this.match(ImpalaSqlParser.EQ);
this.state = 627;
this.match(ImpalaSqlParser.STRING);
}
}
this.state = 633;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 187) {
{
this.state = 630;
this.match(ImpalaSqlParser.KW_SERIALIZE_FN);
this.state = 631;
this.match(ImpalaSqlParser.EQ);
this.state = 632;
this.match(ImpalaSqlParser.STRING);
}
}
this.state = 638;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 76) {
{
this.state = 635;
this.match(ImpalaSqlParser.KW_FINALIZE_FN);
this.state = 636;
this.match(ImpalaSqlParser.EQ);
this.state = 637;
this.match(ImpalaSqlParser.STRING);
}
}
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
createFunction() {
let localContext = new CreateFunctionContext(this.context, this.state);
this.enterRule(localContext, 24, ImpalaSqlParser.RULE_createFunction);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 640;
this.match(ImpalaSqlParser.KW_CREATE);
this.state = 641;
this.match(ImpalaSqlParser.KW_FUNCTION);
this.state = 643;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 93) {
{
this.state = 642;
this.ifNotExists();
}
}
this.state = 645;
this.functionNameCreate();
this.state = 658;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 265) {
{
this.state = 646;
this.match(ImpalaSqlParser.LPAREN);
this.state = 655;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 8 || _la === 14 || ((((_la - 43)) & ~0x1F) === 0 && ((1 << (_la - 43)) & 37748835) !== 0) || ((((_la - 91)) & ~0x1F) === 0 && ((1 << (_la - 91)) & 2416443409) !== 0) || ((((_la - 123)) & ~0x1F) === 0 && ((1 << (_la - 123)) & 1610760439) !== 0) || ((((_la - 172)) & ~0x1F) === 0 && ((1 << (_la - 172)) & 8401155) !== 0) || ((((_la - 204)) & ~0x1F) === 0 && ((1 << (_la - 204)) & 4286652929) !== 0) || ((((_la - 236)) & ~0x1F) === 0 && ((1 << (_la - 236)) & 511) !== 0) || ((((_la - 274)) & ~0x1F) === 0 && ((1 << (_la - 274)) & 7873) !== 0)) {
{
this.state = 647;
this.type_(0);
this.state = 652;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 263) {
{
{
this.state = 648;
this.match(ImpalaSqlParser.COMMA);
this.state = 649;
this.type_(0);
}
}
this.state = 654;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
}
}
this.state = 657;
this.match(ImpalaSqlParser.RPAREN);
}
}
this.state = 662;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 160) {
{
this.state = 660;
this.match(ImpalaSqlParser.KW_RETURNS);
this.state = 661;
localContext._returnType = this.type_(0);
}
}
this.state = 664;
this.match(ImpalaSqlParser.KW_LOCATION);
this.state = 665;
this.match(ImpalaSqlParser.STRING);
this.state = 666;
this.match(ImpalaSqlParser.KW_SYMBOL);
this.state = 667;
this.match(ImpalaSqlParser.EQ);
this.state = 668;
localContext._symbol_ = this.stringLiteral();
}
}
catch (re) {
if (re instanceof antlr.RecognitionException) {
localContext.exception = re;
this.errorHandler.reportError(this, re);
this.errorHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return localContext;
}
alterStatement() {
let localContext = new AlterStatementContext(this.context, this.state);
this.enterRule(localContext, 26, ImpalaSqlParser.RULE_alterStatement);
try {
this.state = 688;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 50, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 670;
this.alterDatabase();
}
break;
case 2:
this.enterOuterAlt(localContext, 2);
{
this.state = 671;
this.alterUnSetOrSetViewTblProperties();
}
break;
case 3:
this.enterOuterAlt(localContext, 3);
{
this.state = 672;
this.renameTable();
}
break;
case 4:
this.enterOuterAlt(localContext, 4);
{
this.state = 673;
this.alterViewOwner();