haiyangsun-db commented on code in PR #55768:
URL: https://github.com/apache/spark/pull/55768#discussion_r3215802363
##########
sql/core/src/main/scala/org/apache/spark/sql/classic/Dataset.scala:
##########
@@ -1461,14 +1463,36 @@ class Dataset[T] private[sql](
isBarrier: Boolean = false,
profile: ResourceProfile = null): DataFrame = {
val func = funcCol.expr
- Dataset.ofRows(
- sparkSession,
+ val output = toAttributes(func.dataType.asInstanceOf[StructType])
+
+ if (SQLConf.get.getConf(SQLConf.UNIFIED_UDF_EXECUTION_ENABLED)) {
+ // If enabled, use the new, unified UDF execution path
+ val pythonUdf = func.asInstanceOf[PythonUDF]
+ val workerSpec =
+ PythonUDFWorkerSpecification.fromPythonFunction(
+ pythonUdf.func,
+ sparkSession.sparkContext.conf)
+ val udf = ExternalUserDefinedFunction(
+ name = pythonUdf.name,
+ payload = pythonUdf.func.command.toArray,
+ dataType = pythonUdf.dataType,
+ children = Seq.empty,
+ udfDeterministic = pythonUdf.udfDeterministic,
+ udfNullable = true)
+ Dataset.ofRows(
+ sparkSession,
+ MapPartitionsExternalUDF(
+ workerSpec, udf, output, logicalPlan))
Review Comment:
we would need `isBarrier`, too
--
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]