Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12057#discussion_r57993466
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/python/BatchPythonEvaluation.scala
 ---
    @@ -89,19 +92,30 @@ case class BatchPythonEvaluation(udf: PythonUDF, 
output: Seq[Attribute], child:
           val context = TaskContext.get()
     
           // Output iterator for results from Python.
    -      val outputIterator = new PythonRunner(pyFuncs, bufferSize, 
reuseWorker, true)
    +      val outputIterator = new PythonRunner(pyFuncs, bufferSize, 
reuseWorker, true, numArgs)
             .compute(inputIterator, context.partitionId(), context)
     
           val unpickle = new Unpickler
    -      val row = new GenericMutableRow(1)
    +      val mutableRow = new GenericMutableRow(1)
           val joined = new JoinedRow
    +      val resultType = if (udfs.length == 1) {
    +        udfs.head.dataType
    +      } else {
    +        StructType(udfs.map(u => StructField("", u.dataType, u.nullable)))
    +      }
           val resultProj = UnsafeProjection.create(output, output)
     
           outputIterator.flatMap { pickedResult =>
             val unpickledBatch = unpickle.loads(pickedResult)
             unpickledBatch.asInstanceOf[java.util.ArrayList[Any]].asScala
           }.map { result =>
    -        row(0) = EvaluatePython.fromJava(result, udf.dataType)
    +        val row = if (udfs.length == 1) {
    --- End diff --
    
    Comparing evaluate Python UDF, I think this does not matter, JIT compiler 
could predict this branch pretty easy.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to