dongjoon-hyun commented on a change in pull request #31682:
URL: https://github.com/apache/spark/pull/31682#discussion_r588087266



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/python/BatchEvalPythonExec.scala
##########
@@ -46,7 +46,18 @@ case class BatchEvalPythonExec(udfs: Seq[PythonUDF], 
resultAttrs: Seq[Attribute]
     val needConversion = 
dataTypes.exists(EvaluatePython.needConversionInPython)
 
     // enable memo iff we serialize the row with schema (schema and class 
should be memorized)
-    val pickle = new Pickler(needConversion)
+    // pyrolite 4.21+ can lookup objects in its cache by value, but 
`GenericRowWithSchema` objects,
+    // that we pass from JVM to Python, don't define their `equals()` to take 
the type of the
+    // values or the schema of the row into account. This causes like
+    // `GenericRowWithSchema(Array(1.0, 1.0),
+    //    StructType(Seq(StructField("_1", DoubleType), StructField("_2", 
DoubleType))))`
+    // and
+    // `GenericRowWithSchema(Array(1, 1),
+    //    StructType(Seq(StructField("_1", IntegerType), StructField("_2", 
IntegerType))))`
+    // to be `equal()` and so we need to disable this feature explicitly 
(`valueCompare=false`).
+    // Please note that cache by reference is still enabled depending on 
`needConversion`.
+    val pickle = new Pickler(/* useMemo = */ needConversion,
+      /* valueCompare = */ false)

Review comment:
       ```scala
   -    val pickle = new Pickler(/* useMemo = */ needConversion,
   -      /* valueCompare = */ false)
   +    val pickle = new Pickler(/* useMemo = */ needConversion, /* 
valueCompare = */ false)
   ```




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

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