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

    https://github.com/apache/spark/pull/15821#discussion_r122282259
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -1648,8 +1650,30 @@ def toPandas(self):
             0    2  Alice
             1    5    Bob
             """
    -        import pandas as pd
    -        return pd.DataFrame.from_records(self.collect(), 
columns=self.columns)
    +        if self.sql_ctx.getConf("spark.sql.execution.arrow.enable", 
"false").lower() == "true":
    +            try:
    +                import pyarrow
    +                tables = self._collectAsArrow()
    +                table = pyarrow.concat_tables(tables)
    +                return table.to_pandas()
    --- End diff --
    
    `toPandas()` is a collect operation on the driver, so all data will have to 
be present before the pandas.DataFrame can be made regardless.  As @leifwalsh 
pointed out, the batch size limiting is to benefit the JVM running the 
executor, which might have different limitations that the driver.


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