-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
base: master
Are you sure you want to change the base?
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
TPC-H: Total hot run time: 39927 ms
|
TPC-DS: Total hot run time: 196454 ms
|
ClickBench: Total hot run time: 32.2 s
|
611affd
to
f5249ed
Compare
run buildall |
TPC-H: Total hot run time: 32503 ms
|
TPC-DS: Total hot run time: 196810 ms
|
ClickBench: Total hot run time: 31.09 s
|
f5249ed
to
02ccc8e
Compare
run buildall |
TPC-H: Total hot run time: 32446 ms
|
TPC-DS: Total hot run time: 190151 ms
|
ClickBench: Total hot run time: 30.96 s
|
run buildall |
TPC-H: Total hot run time: 32395 ms
|
TPC-DS: Total hot run time: 192236 ms
|
ClickBench: Total hot run time: 31.28 s
|
SetType setType; | ||
if (ctx.GLOBAL() != null) { | ||
setType = SetType.GLOBAL; | ||
} else if (ctx.LOCAL() != null || ctx.SESSION() != null) { | ||
setType = SetType.SESSION; | ||
} else { | ||
setType = SetType.DEFAULT; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is duplicated many times and needs to be abstracted.
@@ -4331,6 +4340,117 @@ public LogicalPlan visitCreateTableLike(CreateTableLikeContext ctx) { | |||
return new CreateTableLikeCommand(info); | |||
} | |||
|
|||
@Override | |||
public Command visitCreateUserDefineFunction(CreateUserDefineFunctionContext ctx) { | |||
SetType setType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetType is not a good name since it is not just used in SetCommand
private Type[] argTypes; | ||
|
||
public FunctionArgsDefInfo(List<DataType> argTypeDefs, boolean isVariadic) { | ||
this.argTypeDefs = argTypeDefs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utils.fastToImmutableList(Objects.requireNonNull(argTypeDefs, "argTypeDefs should not be null"))
/** | ||
* represent function arguments | ||
*/ | ||
public class FunctionArgsDefInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only have data types, maybe we should change it name to a better one
if (isTableFunction) { | ||
return new CreateFunctionCommand(setType, ifNotExists, function, functionArgsDefInfo, returnType, | ||
intermediateType, properties); | ||
} else { | ||
return new CreateFunctionCommand(setType, ifNotExists, isAggFunction, function, functionArgsDefInfo, | ||
returnType, intermediateType, properties); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use different ctor for table function?
} else if (isAlias) { | ||
analyzeAliasFunction(ctx); | ||
} else if (isTableFunction) { | ||
analyzeTableFunction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analyzeTableFunction(); | |
analyzeUdtf(); |
return StmtType.CREATE; | ||
} | ||
|
||
private void validate(ConnectContext ctx) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void validate(ConnectContext ctx) throws Exception { | |
private void analyze(ConnectContext ctx) throws Exception { |
@@ -1831,4 +1834,243 @@ private static boolean supportCompare(DataType dataType) { | |||
} | |||
return true; | |||
} | |||
|
|||
public static void validateDataType(DataType dataType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not add this function in TypeCoercionUtils. add this function in DataType and Type directly
} | ||
} | ||
|
||
private Boolean parseBooleanFromProperties(String propertyString) throws AnalysisException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseOrDefault maybe better for use
} | ||
String expirationTimeString = properties.get(EXPIRATION_TIME); | ||
if (expirationTimeString != null) { | ||
long timeMinutes = Long.parseLong(expirationTimeString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we need to catch number exception for better error message?
02ccc8e
to
2fa60f1
Compare
run buildall |
TPC-H: Total hot run time: 32649 ms
|
TPC-DS: Total hot run time: 197418 ms
|
ClickBench: Total hot run time: 31.67 s
|
2fa60f1
to
d2a0fdf
Compare
run buildall |
TPC-H: Total hot run time: 32641 ms
|
TPC-DS: Total hot run time: 194781 ms
|
ClickBench: Total hot run time: 31.1 s
|
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)