You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/05/03 18:03:43 UTC

[GitHub] [spark] BryanCutler commented on a change in pull request #24521: [SPARK-27629][PySpark] Prevent Unpickler from intervening each unpickling

BryanCutler commented on a change in pull request #24521: [SPARK-27629][PySpark] Prevent Unpickler from intervening each unpickling
URL: https://github.com/apache/spark/pull/24521#discussion_r280872290
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/api/python/SerDeUtil.scala
 ##########
 @@ -186,6 +186,9 @@ private[spark] object SerDeUtil extends Logging {
       val unpickle = new Unpickler
       iter.flatMap { row =>
         val obj = unpickle.loads(row)
+        // `Opcodes.MEMOIZE` of Protocol 4 (Python 3.4+) will store objects in internal map
+        // of `Unpickler`. This map is cleared when calling `Unpickler.close()`.
+        unpickle.close()
 
 Review comment:
   It looks like `close()` clears the memoized map, the UnpickleStack, and the input stream. Since the input stream is a `ByteArrayStream` that's a no-op and is fine. Since each row is independent of the others, I don't see any reason why the other 2 would store anything necessary, so I believe that will be fine.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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