dt-sql-parser
Version:
SQL Parsers for BigData, built with antlr4
1,242 lines (1,241 loc) • 1.73 MB
JavaScript
// Generated from dt-sql-parser/src/grammar/hive/HiveSqlParser.g4 by ANTLR 4.13.1
// @ts-nocheck
import * as antlr from "antlr4ng";
import { SQLParserBase } from '../SQLParserBase';
export class HiveSqlParser extends SQLParserBase {
get grammarFileName() { return "HiveSqlParser.g4"; }
get literalNames() { return HiveSqlParser.literalNames; }
get symbolicNames() { return HiveSqlParser.symbolicNames; }
get ruleNames() { return HiveSqlParser.ruleNames; }
get serializedATN() { return HiveSqlParser._serializedATN; }
createFailedPredicateException(predicate, message) {
return new antlr.FailedPredicateException(this, predicate, message);
}
constructor(input) {
super(input);
this.interpreter = new antlr.ParserATNSimulator(this, HiveSqlParser._ATN, HiveSqlParser.decisionsToDFA, new antlr.PredictionContextCache());
}
program() {
let localContext = new ProgramContext(this.context, this.state);
this.enterRule(localContext, 0, HiveSqlParser.RULE_program);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 699;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1538) !== 0) || _la === 48 || _la === 58 || ((((_la - 86)) & ~0x1F) === 0 && ((1 << (_la - 86)) & 540050201) !== 0) || ((((_la - 119)) & ~0x1F) === 0 && ((1 << (_la - 119)) & 17825795) !== 0) || ((((_la - 153)) & ~0x1F) === 0 && ((1 << (_la - 153)) & 8388865) !== 0) || ((((_la - 187)) & ~0x1F) === 0 && ((1 << (_la - 187)) & 33622025) !== 0) || ((((_la - 249)) & ~0x1F) === 0 && ((1 << (_la - 249)) & 810024961) !== 0) || ((((_la - 283)) & ~0x1F) === 0 && ((1 << (_la - 283)) & 35717185) !== 0) || _la === 318 || ((((_la - 351)) & ~0x1F) === 0 && ((1 << (_la - 351)) & 8537089) !== 0) || _la === 387 || _la === 399) {
{
{
this.state = 696;
this.statement();
}
}
this.state = 701;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
this.state = 702;
this.match(HiveSqlParser.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;
}
statement() {
let localContext = new StatementContext(this.context, this.state);
this.enterRule(localContext, 2, HiveSqlParser.RULE_statement);
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 706;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case HiveSqlParser.KW_EXPLAIN:
{
this.state = 704;
this.explainStatement();
}
break;
case HiveSqlParser.KW_ABORT:
case HiveSqlParser.KW_ALTER:
case HiveSqlParser.KW_ANALYZE:
case HiveSqlParser.KW_COMMIT:
case HiveSqlParser.KW_CREATE:
case HiveSqlParser.KW_DELETE:
case HiveSqlParser.KW_DESC:
case HiveSqlParser.KW_DESCRIBE:
case HiveSqlParser.KW_DISABLE:
case HiveSqlParser.KW_DISABLED:
case HiveSqlParser.KW_DROP:
case HiveSqlParser.KW_ENABLE:
case HiveSqlParser.KW_ENABLED:
case HiveSqlParser.KW_EXECUTE:
case HiveSqlParser.KW_EXPORT:
case HiveSqlParser.KW_FROM:
case HiveSqlParser.KW_GRANT:
case HiveSqlParser.KW_IMPORT:
case HiveSqlParser.KW_INSERT:
case HiveSqlParser.KW_KILL:
case HiveSqlParser.KW_LOAD:
case HiveSqlParser.KW_LOCK:
case HiveSqlParser.KW_MAP:
case HiveSqlParser.KW_MERGE:
case HiveSqlParser.KW_MSCK:
case HiveSqlParser.KW_PREPARE:
case HiveSqlParser.KW_REDUCE:
case HiveSqlParser.KW_RELOAD:
case HiveSqlParser.KW_REPL:
case HiveSqlParser.KW_REPLACE:
case HiveSqlParser.KW_REVOKE:
case HiveSqlParser.KW_ROLLBACK:
case HiveSqlParser.KW_SELECT:
case HiveSqlParser.KW_SET:
case HiveSqlParser.KW_SHOW:
case HiveSqlParser.KW_START:
case HiveSqlParser.KW_TRUNCATE:
case HiveSqlParser.KW_UNLOCK:
case HiveSqlParser.KW_UPDATE:
case HiveSqlParser.KW_USE:
case HiveSqlParser.KW_VALUES:
case HiveSqlParser.KW_WITH:
case HiveSqlParser.LPAREN:
{
this.state = 705;
this.execStatement();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
this.state = 709;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 2, this.context)) {
case 1:
{
this.state = 708;
this.match(HiveSqlParser.SEMICOLON);
}
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;
}
explainStatement() {
let localContext = new ExplainStatementContext(this.context, this.state);
this.enterRule(localContext, 4, HiveSqlParser.RULE_explainStatement);
try {
let alternative;
this.enterOuterAlt(localContext, 1);
{
this.state = 711;
this.match(HiveSqlParser.KW_EXPLAIN);
this.state = 721;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case HiveSqlParser.KW_ABORT:
case HiveSqlParser.KW_ALTER:
case HiveSqlParser.KW_ANALYZE:
case HiveSqlParser.KW_AST:
case HiveSqlParser.KW_AUTHORIZATION:
case HiveSqlParser.KW_CBO:
case HiveSqlParser.KW_COMMIT:
case HiveSqlParser.KW_CREATE:
case HiveSqlParser.KW_DDL:
case HiveSqlParser.KW_DEBUG:
case HiveSqlParser.KW_DELETE:
case HiveSqlParser.KW_DEPENDENCY:
case HiveSqlParser.KW_DESC:
case HiveSqlParser.KW_DESCRIBE:
case HiveSqlParser.KW_DISABLE:
case HiveSqlParser.KW_DISABLED:
case HiveSqlParser.KW_DROP:
case HiveSqlParser.KW_ENABLE:
case HiveSqlParser.KW_ENABLED:
case HiveSqlParser.KW_EXECUTE:
case HiveSqlParser.KW_EXPORT:
case HiveSqlParser.KW_EXTENDED:
case HiveSqlParser.KW_FORMATTED:
case HiveSqlParser.KW_FROM:
case HiveSqlParser.KW_GRANT:
case HiveSqlParser.KW_IMPORT:
case HiveSqlParser.KW_INSERT:
case HiveSqlParser.KW_KILL:
case HiveSqlParser.KW_LOAD:
case HiveSqlParser.KW_LOCK:
case HiveSqlParser.KW_LOCKS:
case HiveSqlParser.KW_LOGICAL:
case HiveSqlParser.KW_MAP:
case HiveSqlParser.KW_MERGE:
case HiveSqlParser.KW_MSCK:
case HiveSqlParser.KW_PREPARE:
case HiveSqlParser.KW_REDUCE:
case HiveSqlParser.KW_RELOAD:
case HiveSqlParser.KW_REOPTIMIZATION:
case HiveSqlParser.KW_REPL:
case HiveSqlParser.KW_REPLACE:
case HiveSqlParser.KW_REVOKE:
case HiveSqlParser.KW_ROLLBACK:
case HiveSqlParser.KW_SELECT:
case HiveSqlParser.KW_SET:
case HiveSqlParser.KW_SHOW:
case HiveSqlParser.KW_START:
case HiveSqlParser.KW_TRUNCATE:
case HiveSqlParser.KW_UNLOCK:
case HiveSqlParser.KW_UPDATE:
case HiveSqlParser.KW_USE:
case HiveSqlParser.KW_VALUES:
case HiveSqlParser.KW_VECTORIZATION:
case HiveSqlParser.KW_WITH:
case HiveSqlParser.LPAREN:
{
this.state = 715;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 3, this.context);
while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
if (alternative === 1) {
{
{
this.state = 712;
this.explainOption();
}
}
}
this.state = 717;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 3, this.context);
}
this.state = 718;
this.execStatement();
}
break;
case HiveSqlParser.KW_REWRITE:
{
this.state = 719;
this.match(HiveSqlParser.KW_REWRITE);
this.state = 720;
this.queryStatementExpression();
}
break;
default:
throw new antlr.NoViableAltException(this);
}
}
}
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;
}
explainOption() {
let localContext = new ExplainOptionContext(this.context, this.state);
this.enterRule(localContext, 6, HiveSqlParser.RULE_explainOption);
let _la;
try {
this.state = 745;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case HiveSqlParser.KW_EXTENDED:
this.enterOuterAlt(localContext, 1);
{
this.state = 723;
this.match(HiveSqlParser.KW_EXTENDED);
}
break;
case HiveSqlParser.KW_FORMATTED:
this.enterOuterAlt(localContext, 2);
{
this.state = 724;
this.match(HiveSqlParser.KW_FORMATTED);
}
break;
case HiveSqlParser.KW_DEPENDENCY:
this.enterOuterAlt(localContext, 3);
{
this.state = 725;
this.match(HiveSqlParser.KW_DEPENDENCY);
}
break;
case HiveSqlParser.KW_CBO:
this.enterOuterAlt(localContext, 4);
{
this.state = 726;
this.match(HiveSqlParser.KW_CBO);
this.state = 728;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 57 || _la === 172) {
{
this.state = 727;
_la = this.tokenStream.LA(1);
if (!(_la === 57 || _la === 172)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
}
}
}
break;
case HiveSqlParser.KW_LOGICAL:
this.enterOuterAlt(localContext, 5);
{
this.state = 730;
this.match(HiveSqlParser.KW_LOGICAL);
}
break;
case HiveSqlParser.KW_AUTHORIZATION:
this.enterOuterAlt(localContext, 6);
{
this.state = 731;
this.match(HiveSqlParser.KW_AUTHORIZATION);
}
break;
case HiveSqlParser.KW_ANALYZE:
this.enterOuterAlt(localContext, 7);
{
this.state = 732;
this.match(HiveSqlParser.KW_ANALYZE);
}
break;
case HiveSqlParser.KW_REOPTIMIZATION:
this.enterOuterAlt(localContext, 8);
{
this.state = 733;
this.match(HiveSqlParser.KW_REOPTIMIZATION);
}
break;
case HiveSqlParser.KW_LOCKS:
this.enterOuterAlt(localContext, 9);
{
this.state = 734;
this.match(HiveSqlParser.KW_LOCKS);
}
break;
case HiveSqlParser.KW_AST:
this.enterOuterAlt(localContext, 10);
{
this.state = 735;
this.match(HiveSqlParser.KW_AST);
}
break;
case HiveSqlParser.KW_VECTORIZATION:
this.enterOuterAlt(localContext, 11);
{
this.state = 736;
this.match(HiveSqlParser.KW_VECTORIZATION);
this.state = 738;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 225) {
{
this.state = 737;
this.match(HiveSqlParser.KW_ONLY);
}
}
this.state = 741;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 91 || _la === 121 || _la === 226 || _la === 325) {
{
this.state = 740;
this.vectorizationDetail();
}
}
}
break;
case HiveSqlParser.KW_DEBUG:
this.enterOuterAlt(localContext, 12);
{
this.state = 743;
this.match(HiveSqlParser.KW_DEBUG);
}
break;
case HiveSqlParser.KW_DDL:
this.enterOuterAlt(localContext, 13);
{
this.state = 744;
this.match(HiveSqlParser.KW_DDL);
}
break;
default:
throw new antlr.NoViableAltException(this);
}
}
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;
}
vectorizationDetail() {
let localContext = new VectorizationDetailContext(this.context, this.state);
this.enterRule(localContext, 8, HiveSqlParser.RULE_vectorizationDetail);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 747;
_la = this.tokenStream.LA(1);
if (!(_la === 91 || _la === 121 || _la === 226 || _la === 325)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
}
}
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;
}
execStatement() {
let localContext = new ExecStatementContext(this.context, this.state);
this.enterRule(localContext, 10, HiveSqlParser.RULE_execStatement);
let _la;
try {
let alternative;
this.state = 820;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 17, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 749;
this.queryStatementExpression();
}
break;
case 2:
this.enterOuterAlt(localContext, 2);
{
this.state = 750;
this.loadStatement();
}
break;
case 3:
this.enterOuterAlt(localContext, 3);
{
this.state = 751;
this.exportStatement();
}
break;
case 4:
this.enterOuterAlt(localContext, 4);
{
this.state = 752;
this.importStatement();
}
break;
case 5:
this.enterOuterAlt(localContext, 5);
{
this.state = 753;
this.replDumpStatement();
}
break;
case 6:
this.enterOuterAlt(localContext, 6);
{
this.state = 754;
this.replLoadStatement();
}
break;
case 7:
this.enterOuterAlt(localContext, 7);
{
this.state = 755;
this.match(HiveSqlParser.KW_REPL);
this.state = 756;
this.match(HiveSqlParser.KW_STATUS);
this.state = 757;
localContext._dbName = this.dbSchemaName();
this.state = 760;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) {
case 1:
{
this.state = 758;
this.match(HiveSqlParser.KW_WITH);
this.state = 759;
localContext._replConf = this.keyValueProperties();
}
break;
}
}
break;
case 8:
this.enterOuterAlt(localContext, 8);
{
this.state = 762;
this.ddlStatement();
}
break;
case 9:
this.enterOuterAlt(localContext, 9);
{
this.state = 763;
this.match(HiveSqlParser.KW_DELETE);
this.state = 764;
this.match(HiveSqlParser.KW_FROM);
this.state = 765;
this.tableName();
this.state = 767;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 384) {
{
this.state = 766;
this.whereClause();
}
}
}
break;
case 10:
this.enterOuterAlt(localContext, 10);
{
this.state = 769;
this.match(HiveSqlParser.KW_UPDATE);
this.state = 770;
this.tableName();
this.state = 771;
this.setColumnsClause();
this.state = 773;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 384) {
{
this.state = 772;
this.whereClause();
}
}
}
break;
case 11:
this.enterOuterAlt(localContext, 11);
{
this.state = 775;
this.sqlTransactionStatement();
}
break;
case 12:
this.enterOuterAlt(localContext, 12);
{
this.state = 776;
this.match(HiveSqlParser.KW_MERGE);
this.state = 778;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 436) {
{
this.state = 777;
this.match(HiveSqlParser.QUERY_HINT);
}
}
this.state = 780;
this.match(HiveSqlParser.KW_INTO);
this.state = 781;
this.tableName();
this.state = 786;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 3252585854) !== 0) || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & 94072755) !== 0) || ((((_la - 66)) & ~0x1F) === 0 && ((1 << (_la - 66)) & 3203280837) !== 0) || ((((_la - 98)) & ~0x1F) === 0 && ((1 << (_la - 98)) & 3774298979) !== 0) || ((((_la - 130)) & ~0x1F) === 0 && ((1 << (_la - 130)) & 1985876353) !== 0) || ((((_la - 168)) & ~0x1F) === 0 && ((1 << (_la - 168)) & 3152987127) !== 0) || ((((_la - 200)) & ~0x1F) === 0 && ((1 << (_la - 200)) & 215407575) !== 0) || ((((_la - 232)) & ~0x1F) === 0 && ((1 << (_la - 232)) & 1859156443) !== 0) || ((((_la - 265)) & ~0x1F) === 0 && ((1 << (_la - 265)) & 4039901127) !== 0) || ((((_la - 297)) & ~0x1F) === 0 && ((1 << (_la - 297)) & 3755917179) !== 0) || ((((_la - 330)) & ~0x1F) === 0 && ((1 << (_la - 330)) & 3402225181) !== 0) || ((((_la - 362)) & ~0x1F) === 0 && ((1 << (_la - 362)) & 4238323319) !== 0) || _la === 394 || _la === 432) {
{
this.state = 783;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 17) {
{
this.state = 782;
this.match(HiveSqlParser.KW_AS);
}
}
this.state = 785;
this.id_();
}
}
this.state = 788;
this.match(HiveSqlParser.KW_USING);
this.state = 789;
this.joinSourcePart();
this.state = 790;
this.match(HiveSqlParser.KW_ON);
this.state = 791;
this.expression();
this.state = 792;
this.whenClauses();
}
break;
case 13:
this.enterOuterAlt(localContext, 13);
{
this.state = 794;
this.match(HiveSqlParser.KW_PREPARE);
this.state = 795;
this.id_();
this.state = 796;
this.match(HiveSqlParser.KW_FROM);
this.state = 797;
this.queryStatementExpression();
}
break;
case 14:
this.enterOuterAlt(localContext, 14);
{
this.state = 799;
this.match(HiveSqlParser.KW_EXECUTE);
this.state = 800;
this.id_();
this.state = 801;
this.match(HiveSqlParser.KW_USING);
this.state = 802;
this.constantList();
}
break;
case 15:
this.enterOuterAlt(localContext, 15);
{
this.state = 804;
this.match(HiveSqlParser.KW_SET);
this.state = 805;
this.configPropertiesItem();
this.state = 810;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 395 || _la === 396) {
{
{
this.state = 806;
_la = this.tokenStream.LA(1);
if (!(_la === 395 || _la === 396)) {
this.errorHandler.recoverInline(this);
}
else {
this.errorHandler.reportMatch(this);
this.consume();
}
this.state = 807;
this.configPropertiesItem();
}
}
this.state = 812;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
this.state = 813;
this.match(HiveSqlParser.EQUAL);
this.state = 817;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 16, this.context);
while (alternative !== 1 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) {
if (alternative === 1 + 1) {
{
{
this.state = 814;
this.matchWildcard();
}
}
}
this.state = 819;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 16, this.context);
}
}
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;
}
loadStatement() {
let localContext = new LoadStatementContext(this.context, this.state);
this.enterRule(localContext, 12, HiveSqlParser.RULE_loadStatement);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 822;
this.match(HiveSqlParser.KW_LOAD);
this.state = 823;
this.match(HiveSqlParser.KW_DATA);
this.state = 825;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 188) {
{
this.state = 824;
this.match(HiveSqlParser.KW_LOCAL);
}
}
this.state = 827;
this.match(HiveSqlParser.KW_INPATH);
this.state = 828;
this.match(HiveSqlParser.StringLiteral);
this.state = 830;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 235) {
{
this.state = 829;
this.match(HiveSqlParser.KW_OVERWRITE);
}
}
this.state = 832;
this.match(HiveSqlParser.KW_INTO);
this.state = 833;
this.match(HiveSqlParser.KW_TABLE);
this.state = 834;
this.tableOrPartition();
this.state = 836;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 160) {
{
this.state = 835;
this.inputFileFormat();
}
}
}
}
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;
}
replicationClause() {
let localContext = new ReplicationClauseContext(this.context, this.state);
this.enterRule(localContext, 14, HiveSqlParser.RULE_replicationClause);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 838;
this.match(HiveSqlParser.KW_FOR);
this.state = 840;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 204) {
{
this.state = 839;
this.match(HiveSqlParser.KW_METADATA);
}
}
this.state = 842;
this.match(HiveSqlParser.KW_REPLICATION);
this.state = 843;
this.match(HiveSqlParser.LPAREN);
this.state = 844;
this.match(HiveSqlParser.StringLiteral);
this.state = 845;
this.match(HiveSqlParser.RPAREN);
}
}
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;
}
exportStatement() {
let localContext = new ExportStatementContext(this.context, this.state);
this.enterRule(localContext, 16, HiveSqlParser.RULE_exportStatement);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 847;
this.match(HiveSqlParser.KW_EXPORT);
this.state = 848;
this.match(HiveSqlParser.KW_TABLE);
this.state = 849;
this.tableOrPartition();
this.state = 850;
this.match(HiveSqlParser.KW_TO);
this.state = 851;
this.match(HiveSqlParser.StringLiteral);
this.state = 853;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 134) {
{
this.state = 852;
this.replicationClause();
}
}
}
}
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;
}
importStatement() {
let localContext = new ImportStatementContext(this.context, this.state);
this.enterRule(localContext, 18, HiveSqlParser.RULE_importStatement);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 855;
this.match(HiveSqlParser.KW_IMPORT);
this.state = 861;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 123 || _la === 329) {
{
this.state = 857;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 123) {
{
this.state = 856;
this.match(HiveSqlParser.KW_EXTERNAL);
}
}
this.state = 859;
this.match(HiveSqlParser.KW_TABLE);
this.state = 860;
this.tableOrPartition();
}
}
this.state = 863;
this.match(HiveSqlParser.KW_FROM);
this.state = 864;
localContext._path = this.match(HiveSqlParser.StringLiteral);
this.state = 866;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 189) {
{
this.state = 865;
this.locationPath();
}
}
}
}
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;
}
replDumpStatement() {
let localContext = new ReplDumpStatementContext(this.context, this.state);
this.enterRule(localContext, 20, HiveSqlParser.RULE_replDumpStatement);
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 868;
this.match(HiveSqlParser.KW_REPL);
this.state = 869;
this.match(HiveSqlParser.KW_DUMP);
this.state = 870;
localContext._dbPolicy = this.replDbPolicy();
this.state = 873;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 26, this.context)) {
case 1:
{
this.state = 871;
this.match(HiveSqlParser.KW_REPLACE);
this.state = 872;
localContext._oldDbPolicy = this.replDbPolicy();
}
break;
}
this.state = 877;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 27, this.context)) {
case 1:
{
this.state = 875;
this.match(HiveSqlParser.KW_WITH);
this.state = 876;
localContext._replConf = this.keyValueProperties();
}
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;
}
replDbPolicy() {
let localContext = new ReplDbPolicyContext(this.context, this.state);
this.enterRule(localContext, 22, HiveSqlParser.RULE_replDbPolicy);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 879;
localContext._dbName = this.dbSchemaName();
this.state = 882;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 395) {
{
this.state = 880;
this.match(HiveSqlParser.DOT);
this.state = 881;
localContext._tablePolicy = this.replTableLevelPolicy();
}
}
}
}
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;
}
replLoadStatement() {
let localContext = new ReplLoadStatementContext(this.context, this.state);
this.enterRule(localContext, 24, HiveSqlParser.RULE_replLoadStatement);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 884;
this.match(HiveSqlParser.KW_REPL);
this.state = 885;
this.match(HiveSqlParser.KW_LOAD);
this.state = 886;
localContext._sourceDbPolicy = this.replDbPolicy();
this.state = 889;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 166) {
{
this.state = 887;
this.match(HiveSqlParser.KW_INTO);
this.state = 888;
localContext._dbName = this.dbSchemaName();
}
}
this.state = 893;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 30, this.context)) {
case 1:
{
this.state = 891;
this.match(HiveSqlParser.KW_WITH);
this.state = 892;
localContext._replConf = this.keyValueProperties();
}
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;
}
replTableLevelPolicy() {
let localContext = new ReplTableLevelPolicyContext(this.context, this.state);
this.enterRule(localContext, 26, HiveSqlParser.RULE_replTableLevelPolicy);
let _la;
try {
this.enterOuterAlt(localContext, 1);
{
this.state = 895;
localContext._replTablesIncludeList = this.match(HiveSqlParser.StringLiteral);
this.state = 898;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 395) {
{
this.state = 896;
this.match(HiveSqlParser.DOT);
this.state = 897;
localContext._replTablesExcludeList = this.match(HiveSqlParser.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;
}
ddlStatement() {
let localContext = new DdlStatementContext(this.context, this.state);
this.enterRule(localContext, 28, HiveSqlParser.RULE_ddlStatement);
let _la;
try {
this.state = 958;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 34, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 900;
this.createDatabaseStatement();
}
break;
case 2:
this.enterOuterAlt(localContext, 2);
{
this.state = 901;
this.switchDatabaseStatement();
}
break;
case 3:
this.enterOuterAlt(localContext, 3);
{
this.state = 902;
this.dropDatabaseStatement();
}
break;
case 4:
this.enterOuterAlt(localContext, 4);
{
this.state = 903;
this.createTableStatement();
}
break;
case 5:
this.enterOuterAlt(localContext, 5);
{
this.state = 904;
this.dropTableStatement();
}
break;
case 6:
this.enterOuterAlt(localContext, 6);
{
this.state = 905;
this.truncateTableStatement();
}
break;
case 7:
this.enterOuterAlt(localContext, 7);
{
this.state = 906;
this.alterStatement();
}
break;
case 8:
this.enterOuterAlt(localContext, 8);
{
this.state = 907;
this.descStatement();
}
break;
case 9:
this.enterOuterAlt(localContext, 9);
{
this.state = 908;
this.showStatement();
}
break;
case 10:
this.enterOuterAlt(localContext, 10);
{
this.state = 909;
this.metastoreCheck();
}
break;
case 11:
this.enterOuterAlt(localContext, 11);
{
this.state = 910;
this.createViewStatement();
}
break;
case 12:
this.enterOuterAlt(localContext, 12);
{
this.state = 911;
this.createMaterializedViewStatement();
}
break;
case 13:
this.enterOuterAlt(localContext, 13);
{
this.state = 912;
this.createScheduledQueryStatement();
}
break;
case 14:
this.enterOuterAlt(localContext, 14);
{
this.state = 913;
this.alterScheduledQueryStatement();
}
break;
case 15:
this.enterOuterAlt(localContext, 15);
{
this.state = 914;
this.dropScheduledQueryStatement();
}
break;
case 16:
this.enterOuterAlt(localContext, 16);
{
this.state = 915;
this.dropViewStatement();
}
break;
case 17:
this.enterOuterAlt(localContext, 17);
{
this.state = 916;
this.dropMaterializedViewStatement();
}
break;
case 18:
this.enterOuterAlt(localContext, 18);
{
this.state = 917;