dt-sql-parser
Version:
SQL Parsers for BigData, built with antlr4
1,052 lines • 1.41 MB
JavaScript
// Generated from dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.13.1
// @ts-nocheck
import * as antlr from "antlr4ng";
import { SQLParserBase } from '../SQLParserBase';
export class SparkSqlParser extends SQLParserBase {
get grammarFileName() { return "SparkSqlParser.g4"; }
get literalNames() { return SparkSqlParser.literalNames; }
get symbolicNames() { return SparkSqlParser.symbolicNames; }
get ruleNames() { return SparkSqlParser.ruleNames; }
get serializedATN() { return SparkSqlParser._serializedATN; }
createFailedPredicateException(predicate, message) {
return new antlr.FailedPredicateException(this, predicate, message);
}
constructor(input) {
super(input);
this.interpreter = new antlr.ParserATNSimulator(this, SparkSqlParser._ATN, SparkSqlParser.decisionsToDFA, new antlr.PredictionContextCache());
}
program() {
let localContext = new ProgramContext(this.context, this.state);
this.enterRule(localContext, 0, SparkSqlParser.RULE_program);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 403;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 10500) !== 0) || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & 67896321) !== 0) || ((((_la - 81)) & ~0x1F) === 0 && ((1 << (_la - 81)) & 100696297) !== 0) || ((((_la - 123)) & ~0x1F) === 0 && ((1 << (_la - 123)) & 16842817) !== 0) || ((((_la - 167)) & ~0x1F) === 0 && ((1 << (_la - 167)) & 2102291) !== 0) || _la === 205 || ((((_la - 238)) & ~0x1F) === 0 && ((1 << (_la - 238)) & 2181171413) !== 0) || ((((_la - 273)) & ~0x1F) === 0 && ((1 << (_la - 273)) & 1048833) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 536949281) !== 0)) {
{
{
this.state = 400;
this.singleStatement();
}
}
this.state = 405;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
this.state = 406;
this.match(SparkSqlParser.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, SparkSqlParser.RULE_singleStatement);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 408;
this.statement();
this.state = 410;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 1) {
{
this.state = 409;
this.match(SparkSqlParser.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;
}
statement() {
let localContext = new StatementContext(this.context, this.state);
this.enterRule(localContext, 4, SparkSqlParser.RULE_statement);
let _la;
try {
let alternative;
this.state = 1337;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 144, this.context)) {
case 1:
localContext = new StatementDefaultContext(localContext);
this.enterOuterAlt(localContext, 1);
{
this.state = 412;
this.query();
}
break;
case 2:
localContext = new DmlStatementContext(localContext);
this.enterOuterAlt(localContext, 2);
{
this.state = 414;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 346) {
{
this.state = 413;
this.ctes();
}
}
this.state = 416;
this.dmlStatementNoWith();
}
break;
case 3:
localContext = new UseNamespaceContext(localContext);
this.enterOuterAlt(localContext, 3);
{
this.state = 417;
this.match(SparkSqlParser.KW_USE);
this.state = 419;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 3, this.context)) {
case 1:
{
this.state = 418;
this.namespace();
}
break;
}
this.state = 421;
this.namespaceName();
}
break;
case 4:
localContext = new SetCatalogContext(localContext);
this.enterOuterAlt(localContext, 4);
{
this.state = 422;
this.match(SparkSqlParser.KW_SET);
this.state = 423;
this.match(SparkSqlParser.KW_CATALOG);
this.state = 426;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 4, this.context)) {
case 1:
{
this.state = 424;
this.identifier();
}
break;
case 2:
{
this.state = 425;
this.stringLit();
}
break;
}
}
break;
case 5:
localContext = new CreateNamespaceContext(localContext);
this.enterOuterAlt(localContext, 5);
{
this.state = 428;
this.match(SparkSqlParser.KW_CREATE);
this.state = 429;
this.namespace();
this.state = 431;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 5, this.context)) {
case 1:
{
this.state = 430;
this.ifNotExists();
}
break;
}
this.state = 433;
this.namespaceNameCreate();
this.state = 441;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 7, this.context);
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
if (alternative === 1) {
{
this.state = 439;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case SparkSqlParser.KW_COMMENT:
{
this.state = 434;
this.commentSpec();
}
break;
case SparkSqlParser.KW_LOCATION:
{
this.state = 435;
this.locationSpec();
}
break;
case SparkSqlParser.KW_WITH:
{
{
this.state = 436;
this.match(SparkSqlParser.KW_WITH);
this.state = 437;
_la = this.tokenStream.LA(1);
if (!(_la === 78 || _la === 229)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 438;
this.propertyList();
}
}
break;
default:
throw new antlr.NoViableAltException(this);
}
}
}
this.state = 443;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 7, this.context);
}
}
break;
case 6:
localContext = new SetNamespacePropertiesContext(localContext);
this.enterOuterAlt(localContext, 6);
{
this.state = 444;
this.match(SparkSqlParser.KW_ALTER);
this.state = 445;
this.namespace();
this.state = 446;
this.namespaceName();
this.state = 447;
this.match(SparkSqlParser.KW_SET);
this.state = 448;
_la = this.tokenStream.LA(1);
if (!(_la === 78 || _la === 229)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 449;
this.propertyList();
}
break;
case 7:
localContext = new SetNamespaceLocationContext(localContext);
this.enterOuterAlt(localContext, 7);
{
this.state = 451;
this.match(SparkSqlParser.KW_ALTER);
this.state = 452;
this.namespace();
this.state = 453;
this.namespaceName();
this.state = 454;
this.match(SparkSqlParser.KW_SET);
this.state = 455;
this.locationSpec();
}
break;
case 8:
localContext = new DropNamespaceContext(localContext);
this.enterOuterAlt(localContext, 8);
{
this.state = 457;
this.match(SparkSqlParser.KW_DROP);
this.state = 458;
this.namespace();
this.state = 460;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 8, this.context)) {
case 1:
{
this.state = 459;
this.ifExists();
}
break;
}
this.state = 462;
this.namespaceName();
this.state = 464;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 34 || _la === 247) {
{
this.state = 463;
_la = this.tokenStream.LA(1);
if (!(_la === 34 || _la === 247)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
}
}
}
break;
case 9:
localContext = new ShowNamespacesContext(localContext);
this.enterOuterAlt(localContext, 9);
{
this.state = 466;
this.match(SparkSqlParser.KW_SHOW);
this.state = 467;
this.namespaces();
this.state = 470;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 10, this.context)) {
case 1:
{
this.state = 468;
_la = this.tokenStream.LA(1);
if (!(_la === 123 || _la === 140)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 469;
this.multipartIdentifier();
}
break;
}
this.state = 476;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 163 || _la === 377 || _la === 378) {
{
this.state = 473;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 163) {
{
this.state = 472;
this.match(SparkSqlParser.KW_LIKE);
}
}
this.state = 475;
localContext._pattern = this.stringLit();
}
}
}
break;
case 10:
localContext = new CreateTableContext(localContext);
this.enterOuterAlt(localContext, 10);
{
this.state = 478;
this.createTableHeader();
this.state = 483;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 13, this.context)) {
case 1:
{
this.state = 479;
this.match(SparkSqlParser.LEFT_PAREN);
this.state = 480;
this.createOrReplaceTableColTypeList();
this.state = 481;
this.match(SparkSqlParser.RIGHT_PAREN);
}
break;
}
this.state = 486;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 332) {
{
this.state = 485;
this.tableProvider();
}
}
this.state = 488;
this.createTableClauses();
this.state = 493;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 16, this.context)) {
case 1:
{
this.state = 490;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 20) {
{
this.state = 489;
this.match(SparkSqlParser.KW_AS);
}
}
this.state = 492;
this.query();
}
break;
}
}
break;
case 11:
localContext = new CreateTableLikeContext(localContext);
this.enterOuterAlt(localContext, 11);
{
this.state = 495;
this.match(SparkSqlParser.KW_CREATE);
this.state = 496;
this.match(SparkSqlParser.KW_TABLE);
this.state = 498;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 17, this.context)) {
case 1:
{
this.state = 497;
this.ifNotExists();
}
break;
}
this.state = 500;
localContext._target = this.tableNameCreate();
this.state = 501;
this.match(SparkSqlParser.KW_LIKE);
this.state = 502;
localContext._source = this.tableName();
this.state = 512;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 162 || _la === 170 || _la === 257 || _la === 283 || _la === 297 || _la === 332) {
{
this.state = 510;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case SparkSqlParser.KW_USING:
{
this.state = 503;
this.tableProvider();
}
break;
case SparkSqlParser.KW_ROW:
{
this.state = 504;
this.rowFormat();
}
break;
case SparkSqlParser.KW_STORED:
{
this.state = 505;
this.createFileFormat();
}
break;
case SparkSqlParser.KW_LOCATION:
{
this.state = 506;
this.locationSpec();
}
break;
case SparkSqlParser.KW_TBLPROPERTIES:
{
{
this.state = 507;
this.match(SparkSqlParser.KW_TBLPROPERTIES);
this.state = 508;
localContext._tableProps = this.propertyList();
}
}
break;
case SparkSqlParser.KW_LIFECYCLE:
{
this.state = 509;
this.tableLifecycle();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
}
this.state = 514;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
}
break;
case 12:
localContext = new ReplaceTableContext(localContext);
this.enterOuterAlt(localContext, 12);
{
this.state = 515;
this.replaceTableHeader();
this.state = 520;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 20, this.context)) {
case 1:
{
this.state = 516;
this.match(SparkSqlParser.LEFT_PAREN);
this.state = 517;
this.createOrReplaceTableColTypeList();
this.state = 518;
this.match(SparkSqlParser.RIGHT_PAREN);
}
break;
}
this.state = 523;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 332) {
{
this.state = 522;
this.tableProvider();
}
}
this.state = 525;
this.createTableClauses();
this.state = 530;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 23, this.context)) {
case 1:
{
this.state = 527;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 20) {
{
this.state = 526;
this.match(SparkSqlParser.KW_AS);
}
}
this.state = 529;
this.query();
}
break;
}
}
break;
case 13:
localContext = new AnalyzeContext(localContext);
this.enterOuterAlt(localContext, 13);
{
this.state = 532;
this.match(SparkSqlParser.KW_ANALYZE);
this.state = 533;
this.match(SparkSqlParser.KW_TABLE);
this.state = 534;
this.tableName();
this.state = 536;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 217) {
{
this.state = 535;
this.partitionSpec();
}
}
this.state = 538;
this.match(SparkSqlParser.KW_COMPUTE);
this.state = 539;
this.match(SparkSqlParser.KW_STATISTICS);
this.state = 547;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 25, this.context)) {
case 1:
{
this.state = 540;
this.match(SparkSqlParser.KW_NOSCAN);
}
break;
case 2:
{
this.state = 541;
this.match(SparkSqlParser.KW_FOR);
this.state = 542;
this.match(SparkSqlParser.KW_COLUMNS);
this.state = 543;
this.columnNameSeq();
}
break;
case 3:
{
this.state = 544;
this.match(SparkSqlParser.KW_FOR);
this.state = 545;
this.match(SparkSqlParser.KW_ALL);
this.state = 546;
this.match(SparkSqlParser.KW_COLUMNS);
}
break;
}
}
break;
case 14:
localContext = new AnalyzeTablesContext(localContext);
this.enterOuterAlt(localContext, 14);
{
this.state = 549;
this.match(SparkSqlParser.KW_ANALYZE);
this.state = 550;
this.match(SparkSqlParser.KW_TABLES);
this.state = 553;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 123 || _la === 140) {
{
this.state = 551;
_la = this.tokenStream.LA(1);
if (!(_la === 123 || _la === 140)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 552;
this.namespaceName();
}
}
this.state = 555;
this.match(SparkSqlParser.KW_COMPUTE);
this.state = 556;
this.match(SparkSqlParser.KW_STATISTICS);
this.state = 558;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 196) {
{
this.state = 557;
this.match(SparkSqlParser.KW_NOSCAN);
}
}
}
break;
case 15:
localContext = new AlterTableAddColumnContext(localContext);
this.enterOuterAlt(localContext, 15);
{
this.state = 560;
this.match(SparkSqlParser.KW_ALTER);
this.state = 561;
this.match(SparkSqlParser.KW_TABLE);
this.state = 562;
this.tableName();
this.state = 563;
this.match(SparkSqlParser.KW_ADD);
this.state = 564;
this.match(SparkSqlParser.KW_COLUMN);
this.state = 565;
this.qualifiedColTypeWithPositionForAdd();
}
break;
case 16:
localContext = new AlterTableAddColumnsContext(localContext);
this.enterOuterAlt(localContext, 16);
{
this.state = 567;
this.match(SparkSqlParser.KW_ALTER);
this.state = 568;
this.match(SparkSqlParser.KW_TABLE);
this.state = 569;
this.tableName();
this.state = 570;
this.match(SparkSqlParser.KW_ADD);
this.state = 571;
this.match(SparkSqlParser.KW_COLUMNS);
this.state = 572;
this.match(SparkSqlParser.LEFT_PAREN);
this.state = 573;
this.qualifiedColTypeWithPositionSeqForAdd();
this.state = 574;
this.match(SparkSqlParser.RIGHT_PAREN);
}
break;
case 17:
localContext = new RenameTableColumnContext(localContext);
this.enterOuterAlt(localContext, 17);
{
this.state = 576;
this.match(SparkSqlParser.KW_ALTER);
this.state = 577;
this.match(SparkSqlParser.KW_TABLE);
this.state = 578;
localContext._table = this.tableName();
this.state = 579;
this.match(SparkSqlParser.KW_RENAME);
this.state = 580;
this.match(SparkSqlParser.KW_COLUMN);
this.state = 581;
this.columnName();
this.state = 582;
this.match(SparkSqlParser.KW_TO);
this.state = 583;
this.columnNameCreate();
}
break;
case 18:
localContext = new AlterTableDropColumnContext(localContext);
this.enterOuterAlt(localContext, 18);
{
this.state = 585;
this.match(SparkSqlParser.KW_ALTER);
this.state = 586;
this.match(SparkSqlParser.KW_TABLE);
this.state = 587;
this.tableName();
this.state = 588;
this.match(SparkSqlParser.KW_DROP);
this.state = 589;
this.match(SparkSqlParser.KW_COLUMN);
this.state = 591;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 28, this.context)) {
case 1:
{
this.state = 590;
this.ifExists();
}
break;
}
this.state = 593;
this.columnName();
}
break;
case 19:
localContext = new DropTableColumnsContext(localContext);
this.enterOuterAlt(localContext, 19);
{
this.state = 595;
this.match(SparkSqlParser.KW_ALTER);
this.state = 596;
this.match(SparkSqlParser.KW_TABLE);
this.state = 597;
this.tableName();
this.state = 598;
this.match(SparkSqlParser.KW_DROP);
this.state = 599;
this.match(SparkSqlParser.KW_COLUMNS);
this.state = 601;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 137) {
{
this.state = 600;
this.ifExists();
}
}
this.state = 603;
this.match(SparkSqlParser.LEFT_PAREN);
this.state = 604;
this.columnNameSeq();
this.state = 605;
this.match(SparkSqlParser.RIGHT_PAREN);
}
break;
case 20:
localContext = new RenameTableContext(localContext);
this.enterOuterAlt(localContext, 20);
{
this.state = 607;
this.match(SparkSqlParser.KW_ALTER);
this.state = 612;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case SparkSqlParser.KW_TABLE:
{
this.state = 608;
this.match(SparkSqlParser.KW_TABLE);
this.state = 609;
this.tableName();
}
break;
case SparkSqlParser.KW_VIEW:
{
this.state = 610;
this.match(SparkSqlParser.KW_VIEW);
this.state = 611;
this.viewName();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
this.state = 614;
this.match(SparkSqlParser.KW_RENAME);
this.state = 615;
this.match(SparkSqlParser.KW_TO);
this.state = 616;
this.multipartIdentifier();
}
break;
case 21:
localContext = new SetTablePropertiesContext(localContext);
this.enterOuterAlt(localContext, 21);
{
this.state = 618;
this.match(SparkSqlParser.KW_ALTER);
this.state = 623;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case SparkSqlParser.KW_TABLE:
{
this.state = 619;
this.match(SparkSqlParser.KW_TABLE);
this.state = 620;
this.tableName();
}
break;
case SparkSqlParser.KW_VIEW:
{
this.state = 621;
this.match(SparkSqlParser.KW_VIEW);
this.state = 622;
this.viewName();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
this.state = 625;
this.match(SparkSqlParser.KW_SET);
this.state = 626;
this.match(SparkSqlParser.KW_TBLPROPERTIES);
this.state = 627;
this.propertyList();
}
break;
case 22:
localContext = new UnsetTablePropertiesContext(localContext);
this.enterOuterAlt(localContext, 22);
{
this.state = 629;
this.match(SparkSqlParser.KW_ALTER);
this.state = 634;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case SparkSqlParser.KW_TABLE:
{
this.state = 630;
this.match(SparkSqlParser.KW_TABLE);
this.state = 631;
this.tableName();
}
break;
case SparkSqlParser.KW_VIEW:
{
this.state = 632;
this.match(SparkSqlParser.KW_VIEW);
this.state = 633;
this.viewName();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
this.state = 636;
this.match(SparkSqlParser.KW_UNSET);
this.state = 637;
this.match(SparkSqlParser.KW_TBLPROPERTIES);
this.state = 639;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 137) {
{
this.state = 638;
this.ifExists();
}
}
this.state = 641;
this.propertyList();
}
break;
case 23:
localContext = new AlterTableAlterColumnContext(localContext);
this.enterOuterAlt(localContext, 23);
{
this.state = 643;
this.match(SparkSqlParser.KW_ALTER);
this.state = 644;
this.match(SparkSqlParser.KW_TABLE);
this.state = 645;
localContext._table = this.tableName();
this.state = 646;
_la = this.tokenStream.LA(1);
if (!(_la === 11 || _la === 39)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 648;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 34, this.context)) {
case 1:
{
this.state = 647;
this.match(SparkSqlParser.KW_COLUMN);
}
break;
}
this.state = 650;
localContext._column = this.columnName();
this.state = 652;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 35, this.context)) {
case 1:
{
this.state = 651;
this.alterColumnAction();
}
break;
}
}
break;
case 24:
localContext = new HiveChangeColumnContext(localContext);
this.enterOuterAlt(localContext, 24);
{
this.state = 654;
this.match(SparkSqlParser.KW_ALTER);
this.state = 655;
this.match(SparkSqlParser.KW_TABLE);
this.state = 656;
localContext._table = this.tableName();
this.state = 658;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 217) {
{
this.state = 657;
this.partitionSpec();
}
}
this.state = 660;
this.match(SparkSqlParser.KW_CHANGE);
this.state = 662;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 37, this.context)) {
case 1:
{
this.state = 661;
this.match(SparkSqlParser.KW_COLUMN);
}
break;
}
this.state = 664;
localContext._colName = this.columnName();
this.state = 665;
this.columnType();
this.state = 667;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 9 || _la === 116) {
{
this.state = 666;
this.colPosition();
}
}
}
break;
case 25:
localContext = new HiveReplaceColumnsContext(localContext);
this.enterOuterAlt(localContext, 25);
{
this.state = 669;
this.match(SparkSqlParser.KW_ALTER);
this.state = 670;
this.match(SparkSqlParser.KW_TABLE);
this.state = 671;
localContext._table = this.tableName();
this.state = 673;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 217) {
{
this.state = 672;
this.partitionSpec();
}
}
this.state = 675;
this.match(SparkSqlParser.KW_REPLACE);
this.state = 676;
this.match(SparkSqlParser.KW_COLUMNS);
this.state = 677;
this.match(SparkSqlParser.LEFT_PAREN);
this.state = 678;
this.qualifiedColTypeWithPositionSeqForReplace();
this.state = 679;
this.match(SparkSqlParser.RIGHT_PAREN);
}
break;
case 26:
localContext = new SetTableSerDeContext(localContext);
this.enterOuterAlt(localContext, 26);
{
this.state = 681;
this.match(SparkSqlParser.KW_ALTER);
this.state = 682;
this.match(SparkSqlParser.KW_TABLE);
this.state = 683;
this.tableName();
this.state = 685;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 217) {
{
this.state = 684;
this.partitionSpec();
}
}
this.state = 687;
this.match(SparkSqlParser.KW_SET);
this.state = 688;
this.match(SparkSqlParser.KW_SERDE);
this.state = 689;
this.stringLit();
this.state = 693;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 41, this.context)) {
case 1:
{
this.state = 690;
this.match(SparkSqlParser.KW_WITH);
this.state = 691;
this.match(SparkSqlParser.KW_SERDEPROPERTIES);
this.state = 692;
this.propertyList();
}
break;
}
}
break;
case 27:
l