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

    https://github.com/apache/spark/pull/12057#discussion_r58106507
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/python/BatchPythonEvaluation.scala
 ---
    @@ -69,19 +70,47 @@ case class BatchPythonEvaluation(udf: PythonUDF, 
output: Seq[Attribute], child:
           // combine input with output from Python.
           val queue = new 
java.util.concurrent.ConcurrentLinkedQueue[InternalRow]()
     
    -      val (pyFuncs, children) = collectFunctions(udf)
    -
    -      val pickle = new Pickler
    -      val currentRow = newMutableProjection(children, child.output)()
    -      val fields = children.map(_.dataType)
    -      val schema = new StructType(fields.map(t => new StructField("", t, 
true)).toArray)
    +      val (pyFuncs, inputs) = udfs.map(collectFunctions).unzip
    +
    +      // flatten all the arguments
    +      val allInputs = new ArrayBuffer[Expression]
    +      val dataTypes = new ArrayBuffer[DataType]
    +      val argOffsets = inputs.map { input =>
    +        input.map { e =>
    +          if (allInputs.exists(_.semanticEquals(e))) {
    --- End diff --
    
    In the worst-case this loop is N^2, but N is probably pretty small so it 
probably doesn't matter compared to other perf. issues impacting Python UDFs.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to