wForget commented on code in PR #4459:
URL: https://github.com/apache/datafusion-comet/pull/4459#discussion_r3732988657


##########
spark/src/main/scala/org/apache/comet/serde/CometScalaUDF.scala:
##########
@@ -53,8 +54,45 @@ import org.apache.comet.udf.codegen.CometScalaUDFCodegen
  */
 object CometScalaUDF extends CometExpressionSerde[ScalaUDF] {
 
-  override def convert(expr: ScalaUDF, inputs: Seq[Attribute], binding: 
Boolean): Option[Expr] =
-    emitJvmCodegenDispatch(expr, inputs, binding)
+  override def convert(expr: ScalaUDF, inputs: Seq[Attribute], binding: 
Boolean): Option[Expr] = {
+    // First check if this udfName is a registered Rust UDF -- those get 
emitted as RustUdfCall
+    // and dispatched to the loaded cdylib rather than the JVM codegen 
dispatcher.
+    expr.udfName.flatMap(CometRustUdfRegistry.instance.get) match {

Review Comment:
   Perhaps we can simply check if the udfName has already been registered in 
`CometRustUdfRegistry.register`, and throw an exception if it exists.



-- 
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]

Reply via email to