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

    https://github.com/apache/spark/pull/15821#discussion_r121922567
  
    --- 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 --
    
    The JVM may have a heap size limit lower than the memory available on the 
driver, so a batch size can help the driver stay under that limit even if the 
collected data are larger in memory on the python size than the JVM's max heap. 


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