feat: hiveSQL support create/drop/alter index grammar
This commit is contained in:
parent
28de63e1f0
commit
ebd9a1ed85
@ -21,11 +21,11 @@ options
|
|||||||
tokenVocab=HiveSqlLexer;
|
tokenVocab=HiveSqlLexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
program : statement EOF;
|
program : statement* EOF;
|
||||||
|
|
||||||
// starting rule
|
// starting rule
|
||||||
statement
|
statement
|
||||||
: (explainStatement | execStatement) SEMICOLON? EOF
|
: (explainStatement | execStatement) SEMICOLON?
|
||||||
;
|
;
|
||||||
|
|
||||||
explainStatement
|
explainStatement
|
||||||
@ -160,6 +160,8 @@ ddlStatement
|
|||||||
| dropFunctionStatement
|
| dropFunctionStatement
|
||||||
| reloadFunctionsStatement
|
| reloadFunctionsStatement
|
||||||
| dropMacroStatement
|
| dropMacroStatement
|
||||||
|
| createIndexStatement
|
||||||
|
| dropIndexStatement
|
||||||
| analyzeStatement
|
| analyzeStatement
|
||||||
| lockStatement
|
| lockStatement
|
||||||
| unlockStatement
|
| unlockStatement
|
||||||
@ -540,6 +542,20 @@ dropMacroStatement
|
|||||||
: KW_DROP KW_TEMPORARY KW_MACRO ifExists? Identifier
|
: KW_DROP KW_TEMPORARY KW_MACRO ifExists? Identifier
|
||||||
;
|
;
|
||||||
|
|
||||||
|
createIndexStatement
|
||||||
|
: KW_CREATE KW_INDEX id_ KW_ON KW_TABLE tableName columnParenthesesList KW_AS indextype=StringLiteral
|
||||||
|
(KW_WITH KW_DEFERRED KW_REBUILD)?
|
||||||
|
(KW_IDXPROPERTIES tableProperties)?
|
||||||
|
(KW_IN KW_TABLE tableName)?
|
||||||
|
(KW_PARTITIONED KW_BY columnParenthesesList)?
|
||||||
|
(tableRowFormat? tableFileFormat)?
|
||||||
|
(KW_LOCATION locn=StringLiteral)?
|
||||||
|
tablePropertiesPrefixed?
|
||||||
|
tableComment?;
|
||||||
|
|
||||||
|
dropIndexStatement
|
||||||
|
: KW_DROP KW_INDEX ifExists? id_ KW_ON tableName;
|
||||||
|
|
||||||
createViewStatement
|
createViewStatement
|
||||||
: KW_CREATE orReplace? KW_VIEW ifNotExists? name=tableName
|
: KW_CREATE orReplace? KW_VIEW ifNotExists? name=tableName
|
||||||
(LPAREN columnNameCommentList RPAREN)? tableComment? viewPartition?
|
(LPAREN columnNameCommentList RPAREN)? tableComment? viewPartition?
|
||||||
@ -1314,6 +1330,7 @@ alterStatement
|
|||||||
| KW_MATERIALIZED KW_VIEW tableNameTree=tableName alterMaterializedViewStatementSuffix
|
| KW_MATERIALIZED KW_VIEW tableNameTree=tableName alterMaterializedViewStatementSuffix
|
||||||
| db_schema alterDatabaseStatementSuffix
|
| db_schema alterDatabaseStatementSuffix
|
||||||
| KW_DATACONNECTOR alterDataConnectorStatementSuffix
|
| KW_DATACONNECTOR alterDataConnectorStatementSuffix
|
||||||
|
| KW_INDEX alterIndexStatementSuffix
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -1570,6 +1587,11 @@ alterStatementSuffixExecute
|
|||||||
) RPAREN
|
) RPAREN
|
||||||
;
|
;
|
||||||
|
|
||||||
|
alterIndexStatementSuffix
|
||||||
|
: id_ KW_ON tableName
|
||||||
|
partitionSpec?
|
||||||
|
KW_REBUILD;
|
||||||
|
|
||||||
fileFormat
|
fileFormat
|
||||||
: KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral KW_SERDE serdeCls=StringLiteral
|
: KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral KW_SERDE serdeCls=StringLiteral
|
||||||
(KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral)?
|
(KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral)?
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -90,6 +90,8 @@ import { DropFunctionStatementContext } from "./HiveSqlParser";
|
|||||||
import { ReloadFunctionsStatementContext } from "./HiveSqlParser";
|
import { ReloadFunctionsStatementContext } from "./HiveSqlParser";
|
||||||
import { CreateMacroStatementContext } from "./HiveSqlParser";
|
import { CreateMacroStatementContext } from "./HiveSqlParser";
|
||||||
import { DropMacroStatementContext } from "./HiveSqlParser";
|
import { DropMacroStatementContext } from "./HiveSqlParser";
|
||||||
|
import { CreateIndexStatementContext } from "./HiveSqlParser";
|
||||||
|
import { DropIndexStatementContext } from "./HiveSqlParser";
|
||||||
import { CreateViewStatementContext } from "./HiveSqlParser";
|
import { CreateViewStatementContext } from "./HiveSqlParser";
|
||||||
import { ViewPartitionContext } from "./HiveSqlParser";
|
import { ViewPartitionContext } from "./HiveSqlParser";
|
||||||
import { ViewOrganizationContext } from "./HiveSqlParser";
|
import { ViewOrganizationContext } from "./HiveSqlParser";
|
||||||
@ -289,6 +291,7 @@ import { AlterStatementSuffixCompactContext } from "./HiveSqlParser";
|
|||||||
import { AlterStatementSuffixSetOwnerContext } from "./HiveSqlParser";
|
import { AlterStatementSuffixSetOwnerContext } from "./HiveSqlParser";
|
||||||
import { AlterStatementSuffixSetPartSpecContext } from "./HiveSqlParser";
|
import { AlterStatementSuffixSetPartSpecContext } from "./HiveSqlParser";
|
||||||
import { AlterStatementSuffixExecuteContext } from "./HiveSqlParser";
|
import { AlterStatementSuffixExecuteContext } from "./HiveSqlParser";
|
||||||
|
import { AlterIndexStatementSuffixContext } from "./HiveSqlParser";
|
||||||
import { FileFormatContext } from "./HiveSqlParser";
|
import { FileFormatContext } from "./HiveSqlParser";
|
||||||
import { AlterDataConnectorStatementSuffixContext } from "./HiveSqlParser";
|
import { AlterDataConnectorStatementSuffixContext } from "./HiveSqlParser";
|
||||||
import { AlterDataConnectorSuffixPropertiesContext } from "./HiveSqlParser";
|
import { AlterDataConnectorSuffixPropertiesContext } from "./HiveSqlParser";
|
||||||
@ -1466,6 +1469,28 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitDropMacroStatement?: (ctx: DropMacroStatementContext) => void;
|
exitDropMacroStatement?: (ctx: DropMacroStatementContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `HiveSqlParser.createIndexStatement`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterCreateIndexStatement?: (ctx: CreateIndexStatementContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `HiveSqlParser.createIndexStatement`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitCreateIndexStatement?: (ctx: CreateIndexStatementContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `HiveSqlParser.dropIndexStatement`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterDropIndexStatement?: (ctx: DropIndexStatementContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `HiveSqlParser.dropIndexStatement`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitDropIndexStatement?: (ctx: DropIndexStatementContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `HiveSqlParser.createViewStatement`.
|
* Enter a parse tree produced by `HiveSqlParser.createViewStatement`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -3655,6 +3680,17 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitAlterStatementSuffixExecute?: (ctx: AlterStatementSuffixExecuteContext) => void;
|
exitAlterStatementSuffixExecute?: (ctx: AlterStatementSuffixExecuteContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `HiveSqlParser.alterIndexStatementSuffix`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterAlterIndexStatementSuffix?: (ctx: AlterIndexStatementSuffixContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `HiveSqlParser.alterIndexStatementSuffix`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitAlterIndexStatementSuffix?: (ctx: AlterIndexStatementSuffixContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `HiveSqlParser.fileFormat`.
|
* Enter a parse tree produced by `HiveSqlParser.fileFormat`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -90,6 +90,8 @@ import { DropFunctionStatementContext } from "./HiveSqlParser";
|
|||||||
import { ReloadFunctionsStatementContext } from "./HiveSqlParser";
|
import { ReloadFunctionsStatementContext } from "./HiveSqlParser";
|
||||||
import { CreateMacroStatementContext } from "./HiveSqlParser";
|
import { CreateMacroStatementContext } from "./HiveSqlParser";
|
||||||
import { DropMacroStatementContext } from "./HiveSqlParser";
|
import { DropMacroStatementContext } from "./HiveSqlParser";
|
||||||
|
import { CreateIndexStatementContext } from "./HiveSqlParser";
|
||||||
|
import { DropIndexStatementContext } from "./HiveSqlParser";
|
||||||
import { CreateViewStatementContext } from "./HiveSqlParser";
|
import { CreateViewStatementContext } from "./HiveSqlParser";
|
||||||
import { ViewPartitionContext } from "./HiveSqlParser";
|
import { ViewPartitionContext } from "./HiveSqlParser";
|
||||||
import { ViewOrganizationContext } from "./HiveSqlParser";
|
import { ViewOrganizationContext } from "./HiveSqlParser";
|
||||||
@ -289,6 +291,7 @@ import { AlterStatementSuffixCompactContext } from "./HiveSqlParser";
|
|||||||
import { AlterStatementSuffixSetOwnerContext } from "./HiveSqlParser";
|
import { AlterStatementSuffixSetOwnerContext } from "./HiveSqlParser";
|
||||||
import { AlterStatementSuffixSetPartSpecContext } from "./HiveSqlParser";
|
import { AlterStatementSuffixSetPartSpecContext } from "./HiveSqlParser";
|
||||||
import { AlterStatementSuffixExecuteContext } from "./HiveSqlParser";
|
import { AlterStatementSuffixExecuteContext } from "./HiveSqlParser";
|
||||||
|
import { AlterIndexStatementSuffixContext } from "./HiveSqlParser";
|
||||||
import { FileFormatContext } from "./HiveSqlParser";
|
import { FileFormatContext } from "./HiveSqlParser";
|
||||||
import { AlterDataConnectorStatementSuffixContext } from "./HiveSqlParser";
|
import { AlterDataConnectorStatementSuffixContext } from "./HiveSqlParser";
|
||||||
import { AlterDataConnectorSuffixPropertiesContext } from "./HiveSqlParser";
|
import { AlterDataConnectorSuffixPropertiesContext } from "./HiveSqlParser";
|
||||||
@ -1121,6 +1124,20 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitDropMacroStatement?: (ctx: DropMacroStatementContext) => Result;
|
visitDropMacroStatement?: (ctx: DropMacroStatementContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `HiveSqlParser.createIndexStatement`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitCreateIndexStatement?: (ctx: CreateIndexStatementContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `HiveSqlParser.dropIndexStatement`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitDropIndexStatement?: (ctx: DropIndexStatementContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `HiveSqlParser.createViewStatement`.
|
* Visit a parse tree produced by `HiveSqlParser.createViewStatement`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -2514,6 +2531,13 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitAlterStatementSuffixExecute?: (ctx: AlterStatementSuffixExecuteContext) => Result;
|
visitAlterStatementSuffixExecute?: (ctx: AlterStatementSuffixExecuteContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `HiveSqlParser.alterIndexStatementSuffix`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitAlterIndexStatementSuffix?: (ctx: AlterIndexStatementSuffixContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `HiveSqlParser.fileFormat`.
|
* Visit a parse tree produced by `HiveSqlParser.fileFormat`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
Loading…
Reference in New Issue
Block a user