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

    https://github.com/apache/spark/pull/11347#discussion_r54307414
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -79,11 +81,18 @@ def __init__(self, jdf, sql_ctx):
         @property
         @since(1.3)
         def rdd(self):
    -        """Returns the content as an :class:`pyspark.RDD` of :class:`Row`.
    +        """Returns the content as an :class:`pyspark.RDD` of :class:`Row` 
or custom object.
             """
             if self._lazy_rdd is None:
                 jrdd = self._jdf.javaToPython()
    -            self._lazy_rdd = RDD(jrdd, self.sql_ctx._sc, 
BatchedSerializer(PickleSerializer()))
    +            if self._jdf.isOutputPickled():
    +                # If the underlying java DataFrame's output is pickled, 
which means the query
    +                # engine don't know the real schema of the data and just 
keep the pickled binary
    +                # for each custom object(no batch).  So we need to use 
non-batched serializer here.
    +                deserializer = PickleSerializer()
    --- End diff --
    
    The overhead of PickleSerializer is pretty high, it will serialize the 
class for each row, could you do some benchmark to see how is the difference 
between non-batched vs batched (both size and CPU time)?


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