-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor UDF management process to support table model user-defined function #14135
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
|
What a spectacular work 🦾! Fabulous design and implementation⚡️⚡️🔥 |
|
|
||
| @Override | ||
| protected void deserializeImpl(ByteBuffer buffer) throws IOException { | ||
| model = Model.findByValue(ReadWriteIOUtils.readInt(buffer)); |
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.
won't be compatible to previous version
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.
may need to add a new PlanType
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.
Fixed. Split it into DropTableModelFunctionPlan and DropTreeModelFunctionPlan
| CreateFunctionPlan createFunctionPlan = | ||
| new CreateFunctionPlan(udfInformation, needToSaveJar ? new Binary(jarFile) : null); | ||
|
|
||
| udfInformation.setAvailable(true); |
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.
true or false?
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.
It should be false. Fixed.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/IoTDBConstant.java
Show resolved
Hide resolved
| /** functionName -> information * */ | ||
| private final Map<Pair<Model, String>, UDFInformation> udfInformationMap; | ||
|
|
||
| /** maintain a map for creating instance, functionName -> class */ | ||
| private final Map<Pair<Model, String>, Class<?>> functionToClassMap; |
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 not using Map<Model, Map<String, UDFInformation>>? In this way, you won't need to iterate all map entry while trying to all functions of one kind of model.
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.
Done. Use Map<Model, Map<String, UDFInformation>> now
| TREE_EXTERNAL((byte) 0), | ||
| TREE_BUILT_IN((byte) 1), | ||
| TREE_UNAVAILABLE((byte) 2), | ||
| TABLE_EXTERNAL((byte) 3), |
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.
| TABLE_EXTERNAL((byte) 3), | |
| TABLE_AVAILABLE((byte) 3), |
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.
Done
| import java.nio.ByteBuffer; | ||
|
|
||
| public enum UDFType { | ||
| TREE_EXTERNAL((byte) 0), |
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.
| TREE_EXTERNAL((byte) 0), | |
| TREE_AVAILABLE((byte) 0), |
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.
Done
|
|
||
| public enum UDFType { | ||
| TREE_EXTERNAL((byte) 0), | ||
| TREE_BUILT_IN((byte) 1), |
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.
add some comments for this enum to explain that this won't appear in previous snapshot file or raft log, just a place holder for some unforeseen circumstances.
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.
Added.
...re/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
Show resolved
Hide resolved
...n/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/ShowFunctionsTask.java
Show resolved
Hide resolved
|


Description
Model. UDFTable usePair<Model, String>as hash key to support table model user-defined function now.SHOW FUNCTIONSwill perform some unexpected behaviors.See https://timechor.feishu.cn/docx/TCyYdm8pYowe0HxEGb9c2UfenCf for more details.