You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/03/08 12:45:08 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #39949: [SPARK-42386][SQL] Rewrite HiveGenericUDF with Invoke

cloud-fan commented on code in PR #39949:
URL: https://github.com/apache/spark/pull/39949#discussion_r1129375326


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala:
##########
@@ -194,47 +183,52 @@ private[hive] case class HiveGenericUDF(
 
   override protected def withNewChildrenInternal(newChildren: IndexedSeq[Expression]): Expression =
     copy(children = newChildren)
-  override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
-    val refTerm = ctx.addReferenceObj("this", this)
-    val childrenEvals = children.map(_.genCode(ctx))
-
-    val setDeferredObjects = childrenEvals.zipWithIndex.map {

Review Comment:
   codegen is performance critical. Previously, we generate code to directly set values for `deferredObjects`, but in this PR we always create a `Object[]` to wrap the arguments, which can be bad for performance.
   
   This is a signal that `Invoke` doesn't work very well for Hive UDF. It's still valuable to have something like `HiveGenericUDFInvokeAdapter` to share code between interpreted code path and codegen code path.
   
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org