-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[enhancement](UDF)The user defined functions support the global operation #17608
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
Conversation
5d3840a to
808be93
Compare
|
run buildall |
3ba2195 to
6f06578
Compare
|
run buildall |
|
|
||
| public ShowFunctionsStmt(String dbName, boolean isBuiltin, boolean isVerbose, String wild, | ||
| Expr expr) { | ||
| this.type = type; |
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.
missing type param?
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.
Show functions not fully implemented. I plan to fully implement next PR.
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.
I will remove the relevant code in this PR.
| **/ | ||
| public long loadGlobalFunction(DataInputStream in, long checksum) throws IOException { | ||
| GlobalFunctionMgr mgr = GlobalFunctionMgr.read(in); | ||
| if (mgr != null) { |
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.
Under what circumstances, mgr is null?
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.
Yes, there is no case where mgr is null.
| } | ||
|
|
||
| public long saveGlobalFunction(CountingDataOutputStream out, long checksum) throws IOException { | ||
| Env.getCurrentEnv().getGlobalFunctionMgr().write(out); |
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.
| Env.getCurrentEnv().getGlobalFunctionMgr().write(out); | |
| this.globalFunctionMgr.write(out); |
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.
Yes, thank you for your advice.
| FunctionName name = stmt.getFunctionName(); | ||
| Database db = getInternalCatalog().getDbOrDdlException(name.getDb()); | ||
| db.addFunction(stmt.getFunction(), stmt.isIfNotExists()); | ||
| InternalCatalog internalCatalog = getInternalCatalog(); |
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.
Move this line to else block
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.
Yes, thank you for your advice
fe/fe-core/src/main/java/org/apache/doris/catalog/GlobalFunctionMgr.java
Show resolved
Hide resolved
fe7686e to
1395308
Compare
|
run buildall |
|
run compile feut |
1 similar comment
|
run compile feut |
0a60a69 to
a1df463
Compare
|
run buildall |
a1df463 to
5261fc8
Compare
|
run buildall |
|
TeamCity pipeline, clickbench performance test result: |
|
run buildall |
morningman
left a comment
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.
LGTM
…che#16973) (apache#17608) Support create/drop global function. When you create a custom function, it can only be used within in one database. It cannot be used in other database/catalog. When there are many databases/catalog, it needs to create function one by one. ## Problem summary Describe your changes. 1、 When a function is created or deleted, add the global keyword. CREATE [GLOBAL] [AGGREGATE] [ALIAS] FUNCTION function_name (arg_type [, ...]) [RETURNS ret_type] [INTERMEDIATE inter_type] [WITH PARAMETER(param [,...]) AS origin_function] [PROPERTIES ("key" = "value" [, ...]) ] DROP [GLOBAL] FUNCTION function_name (arg_type [, ...]) 2、A completely global global function is set, and the global function metadata is stored in the image. The function lookup strategy is to look in the database first, and if it can't be found, it looks in the global function. Co-authored-by: lexluo <lexluo@tencent.com>
Proposed changes
Issue Number: close #16973
Support create/drop global function.
When you create a custom function, it can only be used within in one database. It cannot be used in other database/catalog. When there are many databases/catalog, it needs to create function one by one.
Problem summary
Describe your changes.
1、 When a function is created or deleted, add the global keyword.
CREATE [GLOBAL] [AGGREGATE] [ALIAS] FUNCTION function_name (arg_type [, ...]) [RETURNS ret_type] [INTERMEDIATE inter_type] [WITH PARAMETER(param [,...]) AS origin_function] [PROPERTIES ("key" = "value" [, ...]) ]
DROP [GLOBAL] FUNCTION function_name (arg_type [, ...])
2、A completely global global function is set, and the global function metadata is stored in the image. The function lookup strategy is to look in the database first, and if it can't be found, it looks in the global function.
Checklist(Required)
Further comments