Optimize/auto complete (#178)
* feat: optimize hive function name auto complete * feat: optimize flink rules that c3 prefer to * feat: optimize flink autoComplete * test: flink auto complete unit tests
This commit is contained in:
		@ -63,9 +63,9 @@ useModuleStatement
 | 
			
		||||
showStatememt
 | 
			
		||||
    : KW_SHOW (KW_CATALOGS | KW_DATABASES | KW_VIEWS | KW_JARS)
 | 
			
		||||
    | KW_SHOW KW_CURRENT (KW_CATALOG | KW_DATABASE)
 | 
			
		||||
    | KW_SHOW KW_TABLES (( KW_FROM | KW_IN ) tablePath)? likePredicate?
 | 
			
		||||
    | KW_SHOW KW_COLUMNS ( KW_FROM | KW_IN ) uid likePredicate?
 | 
			
		||||
    | KW_SHOW KW_CREATE (KW_TABLE | KW_VIEW) uid
 | 
			
		||||
    | KW_SHOW KW_TABLES (( KW_FROM | KW_IN ) databasePath)? likePredicate?
 | 
			
		||||
    | KW_SHOW KW_COLUMNS ( KW_FROM | KW_IN ) (viewPath| tablePath) likePredicate?
 | 
			
		||||
    | KW_SHOW KW_CREATE (KW_TABLE tablePath | KW_VIEW viewPath)
 | 
			
		||||
    | KW_SHOW KW_USER? KW_FUNCTIONS
 | 
			
		||||
    | KW_SHOW KW_FULL? KW_MODULES
 | 
			
		||||
    ;
 | 
			
		||||
@ -258,7 +258,7 @@ likeOption
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
createCatalog
 | 
			
		||||
    : KW_CREATE KW_CATALOG uid withOption
 | 
			
		||||
    : KW_CREATE KW_CATALOG catalogPathCreate withOption
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
createDatabase
 | 
			
		||||
@ -266,11 +266,11 @@ createDatabase
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
createView
 | 
			
		||||
    : KW_CREATE KW_TEMPORARY? KW_VIEW ifNotExists? uid columnNameList? commentSpec? KW_AS queryStatement
 | 
			
		||||
    : KW_CREATE KW_TEMPORARY? KW_VIEW ifNotExists? viewPathCreate columnNameList? commentSpec? KW_AS queryStatement
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
createFunction
 | 
			
		||||
    : KW_CREATE (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifNotExists? functionName KW_AS identifier (KW_LANGUAGE (KW_JAVA|KW_SCALA|KW_PYTHON))? usingClause?
 | 
			
		||||
    : KW_CREATE (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifNotExists? functionNameCreate KW_AS identifier (KW_LANGUAGE (KW_JAVA|KW_SCALA|KW_PYTHON))? usingClause?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
usingClause
 | 
			
		||||
@ -314,7 +314,7 @@ notForced
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
alertView
 | 
			
		||||
    : KW_ALTER KW_VIEW uid (renameDefinition | KW_AS queryStatement)
 | 
			
		||||
    : KW_ALTER KW_VIEW viewPath (renameDefinition | KW_AS queryStatement)
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
alterDatabase
 | 
			
		||||
@ -322,7 +322,7 @@ alterDatabase
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
alterFunction
 | 
			
		||||
    : KW_ALTER (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifExists? uid KW_AS identifier (KW_LANGUAGE (KW_JAVA|KW_SCALA|KW_PYTHON))? 
 | 
			
		||||
    : KW_ALTER (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifExists? functionName KW_AS identifier (KW_LANGUAGE (KW_JAVA|KW_SCALA|KW_PYTHON))?  // TODO
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -341,7 +341,7 @@ dropDatabase
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
dropView
 | 
			
		||||
    : KW_DROP KW_TEMPORARY? KW_VIEW ifExists? uid
 | 
			
		||||
    : KW_DROP KW_TEMPORARY? KW_VIEW ifExists? viewPath
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
dropFunction
 | 
			
		||||
@ -450,13 +450,12 @@ tableReference
 | 
			
		||||
 | 
			
		||||
tablePrimary
 | 
			
		||||
    : KW_TABLE? tablePath systemTimePeriod? (KW_AS? correlationName)?
 | 
			
		||||
    | viewPath systemTimePeriod? (KW_AS? correlationName)?
 | 
			
		||||
    | KW_LATERAL KW_TABLE LR_BRACKET functionName LR_BRACKET functionParam (COMMA functionParam)* RR_BRACKET RR_BRACKET
 | 
			
		||||
    | KW_LATERAL? LR_BRACKET queryStatement RR_BRACKET
 | 
			
		||||
    | KW_UNNEST LR_BRACKET expression RR_BRACKET
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
systemTimePeriod
 | 
			
		||||
    : KW_FOR KW_SYSTEM_TIME KW_AS KW_OF dateTimeExpression
 | 
			
		||||
    ;
 | 
			
		||||
@ -731,6 +730,10 @@ primaryExpression
 | 
			
		||||
    //   KW_FROM position=valueExpression (KW_FOR length=valueExpression)? ')'                          #overlay
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
functionNameCreate
 | 
			
		||||
    : uid
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
functionName
 | 
			
		||||
    : reservedKeywordsUsedAsFuncName
 | 
			
		||||
    | nonReservedKeywords
 | 
			
		||||
@ -827,23 +830,39 @@ whenClause
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
catalogPath
 | 
			
		||||
    : uid
 | 
			
		||||
    : identifier
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
catalogPathCreate
 | 
			
		||||
    : identifier
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
databasePath
 | 
			
		||||
    : uid
 | 
			
		||||
    : identifier (DOT identifier)?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
databasePathCreate
 | 
			
		||||
    : uid
 | 
			
		||||
    : identifier (DOT identifier)?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
tablePathCreate
 | 
			
		||||
    : uid
 | 
			
		||||
    : identifier (DOT identifier)?
 | 
			
		||||
    | identifier DOT identifier (DOT identifier)?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
tablePath
 | 
			
		||||
    : uid
 | 
			
		||||
    : identifier (DOT identifier)?
 | 
			
		||||
    | identifier DOT identifier (DOT identifier)?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
viewPath
 | 
			
		||||
    : identifier (DOT identifier)?
 | 
			
		||||
    | identifier DOT identifier (DOT identifier)?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
viewPathCreate
 | 
			
		||||
    : identifier (DOT identifier)?
 | 
			
		||||
    | identifier DOT identifier (DOT identifier)?
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
uid
 | 
			
		||||
 | 
			
		||||
@ -2177,25 +2177,29 @@ null_treatment
 | 
			
		||||
    | KW_IGNORE KW_NULLS
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
functionNameForDDL
 | 
			
		||||
    : functionNameForInvoke
 | 
			
		||||
functionNameCreate
 | 
			
		||||
    : functionIdentifier
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
functionNameForDDL // Function name use to DDL, such as drop function
 | 
			
		||||
    : userDefinedFuncName
 | 
			
		||||
    | StringLiteral
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
functionNameForInvoke
 | 
			
		||||
functionNameForInvoke // Function name used to invoke
 | 
			
		||||
    : userDefinedFuncName
 | 
			
		||||
    | sql11ReservedKeywordsUsedAsFunctionName
 | 
			
		||||
    | internalFunctionName
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
userDefinedFuncName // User Defined Function
 | 
			
		||||
    : functionIdentifier
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
internalFunctionName // Hive Internal Function
 | 
			
		||||
    : sql11ReservedKeywordsUsedAsFunctionName
 | 
			
		||||
    | sysFuncNames
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
userDefinedFuncName
 | 
			
		||||
    : functionIdentifier
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
functionNameCreate
 | 
			
		||||
    : functionIdentifier
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
castExpression
 | 
			
		||||
    : KW_CAST
 | 
			
		||||
    LPAREN
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -169,6 +169,7 @@ import { PredicateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { LikePredicateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { ValueExpressionContext } from "./FlinkSqlParser";
 | 
			
		||||
import { PrimaryExpressionContext } from "./FlinkSqlParser";
 | 
			
		||||
import { FunctionNameCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { FunctionNameContext } from "./FlinkSqlParser";
 | 
			
		||||
import { FunctionParamContext } from "./FlinkSqlParser";
 | 
			
		||||
import { DereferenceDefinitionContext } from "./FlinkSqlParser";
 | 
			
		||||
@ -191,10 +192,13 @@ import { UnquotedIdentifierContext } from "./FlinkSqlParser";
 | 
			
		||||
import { QuotedIdentifierContext } from "./FlinkSqlParser";
 | 
			
		||||
import { WhenClauseContext } from "./FlinkSqlParser";
 | 
			
		||||
import { CatalogPathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { CatalogPathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { DatabasePathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { DatabasePathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { TablePathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { TablePathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { ViewPathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { ViewPathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { UidContext } from "./FlinkSqlParser";
 | 
			
		||||
import { WithOptionContext } from "./FlinkSqlParser";
 | 
			
		||||
import { IfNotExistsContext } from "./FlinkSqlParser";
 | 
			
		||||
@ -2115,6 +2119,17 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
 | 
			
		||||
	 */
 | 
			
		||||
	exitPrimaryExpression?: (ctx: PrimaryExpressionContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.functionNameCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	enterFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Exit a parse tree produced by `FlinkSqlParser.functionNameCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	exitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.functionName`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
@ -2357,6 +2372,17 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
 | 
			
		||||
	 */
 | 
			
		||||
	exitCatalogPath?: (ctx: CatalogPathContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.catalogPathCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	enterCatalogPathCreate?: (ctx: CatalogPathCreateContext) => void;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Exit a parse tree produced by `FlinkSqlParser.catalogPathCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	exitCatalogPathCreate?: (ctx: CatalogPathCreateContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.databasePath`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
@ -2401,6 +2427,28 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
 | 
			
		||||
	 */
 | 
			
		||||
	exitTablePath?: (ctx: TablePathContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.viewPath`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	enterViewPath?: (ctx: ViewPathContext) => void;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Exit a parse tree produced by `FlinkSqlParser.viewPath`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	exitViewPath?: (ctx: ViewPathContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.viewPathCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	enterViewPathCreate?: (ctx: ViewPathCreateContext) => void;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Exit a parse tree produced by `FlinkSqlParser.viewPathCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	exitViewPathCreate?: (ctx: ViewPathCreateContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `FlinkSqlParser.uid`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
 | 
			
		||||
@ -169,6 +169,7 @@ import { PredicateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { LikePredicateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { ValueExpressionContext } from "./FlinkSqlParser";
 | 
			
		||||
import { PrimaryExpressionContext } from "./FlinkSqlParser";
 | 
			
		||||
import { FunctionNameCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { FunctionNameContext } from "./FlinkSqlParser";
 | 
			
		||||
import { FunctionParamContext } from "./FlinkSqlParser";
 | 
			
		||||
import { DereferenceDefinitionContext } from "./FlinkSqlParser";
 | 
			
		||||
@ -191,10 +192,13 @@ import { UnquotedIdentifierContext } from "./FlinkSqlParser";
 | 
			
		||||
import { QuotedIdentifierContext } from "./FlinkSqlParser";
 | 
			
		||||
import { WhenClauseContext } from "./FlinkSqlParser";
 | 
			
		||||
import { CatalogPathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { CatalogPathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { DatabasePathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { DatabasePathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { TablePathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { TablePathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { ViewPathContext } from "./FlinkSqlParser";
 | 
			
		||||
import { ViewPathCreateContext } from "./FlinkSqlParser";
 | 
			
		||||
import { UidContext } from "./FlinkSqlParser";
 | 
			
		||||
import { WithOptionContext } from "./FlinkSqlParser";
 | 
			
		||||
import { IfNotExistsContext } from "./FlinkSqlParser";
 | 
			
		||||
@ -1423,6 +1427,13 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
 | 
			
		||||
	 */
 | 
			
		||||
	visitPrimaryExpression?: (ctx: PrimaryExpressionContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.functionNameCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 * @return the visitor result
 | 
			
		||||
	 */
 | 
			
		||||
	visitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.functionName`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
@ -1577,6 +1588,13 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
 | 
			
		||||
	 */
 | 
			
		||||
	visitCatalogPath?: (ctx: CatalogPathContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.catalogPathCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 * @return the visitor result
 | 
			
		||||
	 */
 | 
			
		||||
	visitCatalogPathCreate?: (ctx: CatalogPathCreateContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.databasePath`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
@ -1605,6 +1623,20 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
 | 
			
		||||
	 */
 | 
			
		||||
	visitTablePath?: (ctx: TablePathContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.viewPath`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 * @return the visitor result
 | 
			
		||||
	 */
 | 
			
		||||
	visitViewPath?: (ctx: ViewPathContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.viewPathCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 * @return the visitor result
 | 
			
		||||
	 */
 | 
			
		||||
	visitViewPathCreate?: (ctx: ViewPathCreateContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `FlinkSqlParser.uid`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -393,10 +393,11 @@ import { SortByClauseContext } from "./HiveSqlParser";
 | 
			
		||||
import { TrimFunctionContext } from "./HiveSqlParser";
 | 
			
		||||
import { Function_Context } from "./HiveSqlParser";
 | 
			
		||||
import { Null_treatmentContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameCreateContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameForDDLContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameForInvokeContext } from "./HiveSqlParser";
 | 
			
		||||
import { UserDefinedFuncNameContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameCreateContext } from "./HiveSqlParser";
 | 
			
		||||
import { InternalFunctionNameContext } from "./HiveSqlParser";
 | 
			
		||||
import { CastExpressionContext } from "./HiveSqlParser";
 | 
			
		||||
import { CaseExpressionContext } from "./HiveSqlParser";
 | 
			
		||||
import { WhenExpressionContext } from "./HiveSqlParser";
 | 
			
		||||
@ -4820,6 +4821,17 @@ export interface HiveSqlParserListener extends ParseTreeListener {
 | 
			
		||||
	 */
 | 
			
		||||
	exitNull_treatment?: (ctx: Null_treatmentContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `HiveSqlParser.functionNameCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	enterFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Exit a parse tree produced by `HiveSqlParser.functionNameCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	exitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `HiveSqlParser.functionNameForDDL`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
@ -4854,15 +4866,15 @@ export interface HiveSqlParserListener extends ParseTreeListener {
 | 
			
		||||
	exitUserDefinedFuncName?: (ctx: UserDefinedFuncNameContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `HiveSqlParser.functionNameCreate`.
 | 
			
		||||
	 * Enter a parse tree produced by `HiveSqlParser.internalFunctionName`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	enterFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
 | 
			
		||||
	enterInternalFunctionName?: (ctx: InternalFunctionNameContext) => void;
 | 
			
		||||
	/**
 | 
			
		||||
	 * Exit a parse tree produced by `HiveSqlParser.functionNameCreate`.
 | 
			
		||||
	 * Exit a parse tree produced by `HiveSqlParser.internalFunctionName`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 */
 | 
			
		||||
	exitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
 | 
			
		||||
	exitInternalFunctionName?: (ctx: InternalFunctionNameContext) => void;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Enter a parse tree produced by `HiveSqlParser.castExpression`.
 | 
			
		||||
 | 
			
		||||
@ -393,10 +393,11 @@ import { SortByClauseContext } from "./HiveSqlParser";
 | 
			
		||||
import { TrimFunctionContext } from "./HiveSqlParser";
 | 
			
		||||
import { Function_Context } from "./HiveSqlParser";
 | 
			
		||||
import { Null_treatmentContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameCreateContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameForDDLContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameForInvokeContext } from "./HiveSqlParser";
 | 
			
		||||
import { UserDefinedFuncNameContext } from "./HiveSqlParser";
 | 
			
		||||
import { FunctionNameCreateContext } from "./HiveSqlParser";
 | 
			
		||||
import { InternalFunctionNameContext } from "./HiveSqlParser";
 | 
			
		||||
import { CastExpressionContext } from "./HiveSqlParser";
 | 
			
		||||
import { CaseExpressionContext } from "./HiveSqlParser";
 | 
			
		||||
import { WhenExpressionContext } from "./HiveSqlParser";
 | 
			
		||||
@ -3263,6 +3264,13 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
 | 
			
		||||
	 */
 | 
			
		||||
	visitNull_treatment?: (ctx: Null_treatmentContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `HiveSqlParser.functionNameCreate`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 * @return the visitor result
 | 
			
		||||
	 */
 | 
			
		||||
	visitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `HiveSqlParser.functionNameForDDL`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
@ -3285,11 +3293,11 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
 | 
			
		||||
	visitUserDefinedFuncName?: (ctx: UserDefinedFuncNameContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `HiveSqlParser.functionNameCreate`.
 | 
			
		||||
	 * Visit a parse tree produced by `HiveSqlParser.internalFunctionName`.
 | 
			
		||||
	 * @param ctx the parse tree
 | 
			
		||||
	 * @return the visitor result
 | 
			
		||||
	 */
 | 
			
		||||
	visitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => Result;
 | 
			
		||||
	visitInternalFunctionName?: (ctx: InternalFunctionNameContext) => Result;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Visit a parse tree produced by `HiveSqlParser.castExpression`.
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,8 @@ export interface CaretPosition {
 | 
			
		||||
export enum SyntaxContextType {
 | 
			
		||||
    /** catalog name */
 | 
			
		||||
    CATALOG = 'catalog',
 | 
			
		||||
    /** catalog name that will be created  */
 | 
			
		||||
    CATALOG_CREATE = 'catalogCreate',
 | 
			
		||||
    /** database name path, such as catalog.db */
 | 
			
		||||
    DATABASE = 'database',
 | 
			
		||||
    /** database name path that will be created  */
 | 
			
		||||
 | 
			
		||||
@ -23,11 +23,15 @@ export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected preferredRules = new Set([
 | 
			
		||||
        FlinkSqlParser.RULE_tablePath, // table name >> select / insert ...
 | 
			
		||||
        FlinkSqlParser.RULE_tablePathCreate, // table name >> create 
 | 
			
		||||
        FlinkSqlParser.RULE_databasePath, // database name >> show
 | 
			
		||||
        FlinkSqlParser.RULE_databasePathCreate, // database name >> create 
 | 
			
		||||
        FlinkSqlParser.RULE_catalogPath, // catalog name
 | 
			
		||||
        FlinkSqlParser.RULE_databasePath, // database name
 | 
			
		||||
        FlinkSqlParser.RULE_databasePathCreate, // database name that will be created
 | 
			
		||||
        FlinkSqlParser.RULE_tablePath, // table name
 | 
			
		||||
        FlinkSqlParser.RULE_tablePathCreate, // table name that will be created
 | 
			
		||||
        FlinkSqlParser.RULE_viewPath, // view name path
 | 
			
		||||
        FlinkSqlParser.RULE_viewPathCreate, // viewName that will be created
 | 
			
		||||
        FlinkSqlParser.RULE_functionName, // functionName
 | 
			
		||||
        FlinkSqlParser.RULE_functionNameCreate, // functionName that will be created
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
    protected get splitListener () {
 | 
			
		||||
@ -50,6 +54,18 @@ export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext,
 | 
			
		||||
 | 
			
		||||
            let syntaxContextType: SyntaxContextType;
 | 
			
		||||
            switch (ruleType) {
 | 
			
		||||
                case FlinkSqlParser.RULE_catalogPath: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.CATALOG;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_databasePath: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.DATABASE;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_databasePathCreate: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.DATABASE_CREATE;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_tablePath: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.TABLE;
 | 
			
		||||
                    break;
 | 
			
		||||
@ -58,16 +74,20 @@ export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext,
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.TABLE_CREATE;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_databasePath: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.DATABASE;
 | 
			
		||||
                case FlinkSqlParser.RULE_viewPath: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.VIEW;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_databasePathCreate: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.DATABASE;
 | 
			
		||||
                case FlinkSqlParser.RULE_viewPathCreate : {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.VIEW_CREATE;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_catalogPath: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.CATALOG;
 | 
			
		||||
                case FlinkSqlParser.RULE_functionName : {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.FUNCTION;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case FlinkSqlParser.RULE_functionNameCreate : {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                default:
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,8 @@ export default class HiveSQL extends BasicParser<HiveSqlLexer, ProgramContext, H
 | 
			
		||||
        HiveSqlParser.RULE_tableNameCreate, // table name that will be created
 | 
			
		||||
        HiveSqlParser.RULE_viewName, // view name
 | 
			
		||||
        HiveSqlParser.RULE_viewNameCreate, // view name that will be created
 | 
			
		||||
        HiveSqlParser.RULE_userDefinedFuncName, // function name
 | 
			
		||||
        HiveSqlParser.RULE_functionNameForDDL, // function name
 | 
			
		||||
        HiveSqlParser.RULE_functionNameForInvoke, // function name
 | 
			
		||||
        HiveSqlParser.RULE_functionNameCreate, // function name that will be created
 | 
			
		||||
 | 
			
		||||
    ]);
 | 
			
		||||
@ -72,7 +73,8 @@ export default class HiveSQL extends BasicParser<HiveSqlLexer, ProgramContext, H
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.VIEW_CREATE;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                case HiveSqlParser.RULE_userDefinedFuncName: {
 | 
			
		||||
                case HiveSqlParser.RULE_functionNameForDDL: 
 | 
			
		||||
                case HiveSqlParser.RULE_functionNameForInvoke: {
 | 
			
		||||
                    syntaxContextType = SyntaxContextType.FUNCTION;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user