andygrove commented on code in PR #46:
URL: https://github.com/apache/datafusion-java/pull/46#discussion_r3255384972
##########
core/src/main/java/org/apache/datafusion/SessionContext.java:
##########
@@ -204,6 +209,41 @@ public DataFrame readParquet(String path,
ParquetReadOptions options) {
return new DataFrame(dfHandle);
}
+ /**
+ * Register a Java-implemented scalar UDF. After registration, the function
can be invoked by SQL
+ * via its {@code name} or referenced in DataFusion plans deserialised with
{@link #fromProto}.
+ *
+ * <p>Argument and return types are declared at registration time. The UDF
is registered with an
+ * exact signature: the runtime will reject calls whose argument types do
not match {@code
+ * argTypes} exactly.
+ *
+ * @throws RuntimeException if registration fails (e.g., name already
registered with an
+ * incompatible signature, schema serialisation failure).
+ */
+ public void registerUdf(
+ String name,
+ ScalarUdf udf,
+ ArrowType returnType,
+ List<ArrowType> argTypes,
+ Volatility volatility) {
Review Comment:
I agree that documenting the strategy makes sense. Please go ahead and work
on this when you have time. I also agree that we should stay as close to the
Rust APIs as we can. I did some refactoring of this - let me know what you
think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]