Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/2920#discussion_r19687879 --- Diff: python/pyspark/rdd.py --- @@ -449,12 +445,11 @@ def intersection(self, other): def _reserialize(self, serializer=None): serializer = serializer or self.ctx.serializer - if self._jrdd_deserializer == serializer: - return self - else: - converted = self.map(lambda x: x, preservesPartitioning=True) - converted._jrdd_deserializer = serializer - return converted + if self._jrdd_deserializer != serializer: + if not isinstance(self, PipelinedRDD): + self = self.map(lambda x: x, preservesPartitioning=True) --- End diff -- Is it safe to re-assign to `self` here? This seems to change the semantics of this `_reserialize()` method, since it now mutates the original RDD's serializer rather than returning a new one. This might break / impact programs that aren't expecting an RDD object's serializer to change once that RDD is exposed to users (the reassignment to `converted._jrdd_deserializer` is safe because we haven't exposed `converted` to user code yet).
--- 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