Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature](nereids)support create function command in nereids #45874

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ supportedCreateStatement
| CREATE SQL_BLOCK_RULE (IF NOT EXISTS)?
name=identifier properties=propertyClause? #createSqlBlockRule
| CREATE ENCRYPTKEY (IF NOT EXISTS)? multipartIdentifier AS STRING_LITERAL #createEncryptkey
| CREATE statementScope?
(TABLES | AGGREGATE)? FUNCTION (IF NOT EXISTS)?
functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
RETURNS returnType=dataType (INTERMEDIATE intermediateType=dataType)?
properties=propertyClause? #createUserDefineFunction
| CREATE statementScope? ALIAS FUNCTION (IF NOT EXISTS)?
functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
WITH PARAMETER LEFT_PAREN parameters=identifierSeq? RIGHT_PAREN
AS expression #createAliasFunction
;

supportedAlterStatement
Expand Down Expand Up @@ -239,11 +248,12 @@ supportedDropStatement
((FROM | IN) database=identifier)? properties=propertyClause #dropFile
| DROP WORKLOAD POLICY (IF EXISTS)? name=identifierOrText #dropWorkloadPolicy
| DROP REPOSITORY name=identifier #dropRepository

| DROP statementScope? FUNCTION (IF EXISTS)?
functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN #dropFunction
;

supportedShowStatement
: SHOW (GLOBAL | SESSION | LOCAL)? VARIABLES wildWhere? #showVariables
: SHOW statementScope? VARIABLES wildWhere? #showVariables
| SHOW AUTHORS #showAuthors
| SHOW CREATE (DATABASE | SCHEMA) name=multipartIdentifier #showCreateDatabase
| SHOW BROKER #showBroker
Expand Down Expand Up @@ -294,7 +304,7 @@ supportedShowStatement
| SHOW DATABASE databaseId=INTEGER_VALUE #showDatabaseId
| SHOW TABLE tableId=INTEGER_VALUE #showTableId
| SHOW TRASH (ON backend=STRING_LITERAL)? #showTrash
| SHOW (GLOBAL | SESSION | LOCAL)? STATUS #showStatus
| SHOW statementScope? STATUS #showStatus
| SHOW WHITELIST #showWhitelist
| SHOW TABLETS BELONG
tabletIds+=INTEGER_VALUE (COMMA tabletIds+=INTEGER_VALUE)* #showTabletsBelong
Expand Down Expand Up @@ -349,7 +359,7 @@ unsupportedShowStatement
| SHOW FULL? TABLES ((FROM | IN) database=multipartIdentifier)? wildWhere? #showTables
| SHOW FULL? VIEWS ((FROM | IN) database=multipartIdentifier)? wildWhere? #showViews
| SHOW CREATE MATERIALIZED VIEW name=multipartIdentifier #showMaterializedView
| SHOW CREATE (GLOBAL | SESSION | LOCAL)? FUNCTION functionIdentifier
| SHOW CREATE statementScope? FUNCTION functionIdentifier
LEFT_PAREN functionArguments? RIGHT_PAREN
((FROM | IN) database=multipartIdentifier)? #showCreateFunction
| SHOW (DATABASES | SCHEMAS) (FROM catalog=identifier)? wildWhere? #showDatabases
Expand Down Expand Up @@ -696,8 +706,6 @@ fromRollup

unsupportedDropStatement
: DROP (DATABASE | SCHEMA) (IF EXISTS)? name=multipartIdentifier FORCE? #dropDatabase
| DROP (GLOBAL | SESSION | LOCAL)? FUNCTION (IF EXISTS)?
functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN #dropFunction
| DROP TABLE (IF EXISTS)? name=multipartIdentifier FORCE? #dropTable
| DROP VIEW (IF EXISTS)? name=multipartIdentifier #dropView
| DROP INDEX (IF EXISTS)? name=identifier ON tableName=multipartIdentifier #dropIndex
Expand Down Expand Up @@ -753,15 +761,6 @@ analyzeProperties
unsupportedCreateStatement
: CREATE (DATABASE | SCHEMA) (IF NOT EXISTS)? name=multipartIdentifier
properties=propertyClause? #createDatabase
| CREATE (GLOBAL | SESSION | LOCAL)?
(TABLES | AGGREGATE)? FUNCTION (IF NOT EXISTS)?
functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
RETURNS returnType=dataType (INTERMEDIATE intermediateType=dataType)?
properties=propertyClause? #createUserDefineFunction
| CREATE (GLOBAL | SESSION | LOCAL)? ALIAS FUNCTION (IF NOT EXISTS)?
functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
WITH PARAMETER LEFT_PAREN parameters=identifierSeq? RIGHT_PAREN
AS expression #createAliasFunction
| CREATE USER (IF NOT EXISTS)? grantUserIdentify
(SUPERUSER | DEFAULT ROLE role=STRING_LITERAL)?
passwordOption (COMMENT STRING_LITERAL)? #createUser
Expand Down Expand Up @@ -819,28 +818,29 @@ passwordOption
;

functionArguments
: functionArgument (COMMA functionArgument)*
: DOTDOTDOT
| dataTypeList
| dataTypeList COMMA DOTDOTDOT
;

functionArgument
: DOTDOTDOT
| dataType
dataTypeList
: dataType (COMMA dataType)*
;

supportedSetStatement
: SET (optionWithType | optionWithoutType)
(COMMA (optionWithType | optionWithoutType))* #setOptions
| SET identifier AS DEFAULT STORAGE VAULT #setDefaultStorageVault
| SET PROPERTY (FOR user=identifierOrText)? propertyItemList #setUserProperties
| SET (GLOBAL | LOCAL | SESSION)? TRANSACTION
| SET statementScope? TRANSACTION
( transactionAccessMode
| isolationLevel
| transactionAccessMode COMMA isolationLevel
| isolationLevel COMMA transactionAccessMode) #setTransaction
;

optionWithType
: (GLOBAL | LOCAL | SESSION) identifier EQ (expression | DEFAULT) #setVariableWithType
: statementScope identifier EQ (expression | DEFAULT) #setVariableWithType
;

optionWithoutType
Expand All @@ -856,7 +856,7 @@ optionWithoutType
;

variable
: (DOUBLEATSIGN ((GLOBAL | LOCAL | SESSION) DOT)?)? identifier EQ (expression | DEFAULT) #setSystemVariable
: (DOUBLEATSIGN (statementScope DOT)?)? identifier EQ (expression | DEFAULT) #setSystemVariable
| ATSIGN identifier EQ expression #setUserVariable
;

Expand All @@ -869,7 +869,7 @@ isolationLevel
;

supportedUnsetStatement
: UNSET (GLOBAL | SESSION | LOCAL)? VARIABLE (ALL | identifier)
: UNSET statementScope? VARIABLE (ALL | identifier)
| UNSET DEFAULT STORAGE VAULT
;

Expand Down Expand Up @@ -962,6 +962,10 @@ dataDesc
;

// -----------------Command accessories-----------------
statementScope
: (GLOBAL | SESSION | LOCAL)
;

buildMode
: BUILD (IMMEDIATE | DEFERRED)
;
Expand Down
Loading
Loading