Github user BryanCutler commented on a diff in the pull request: https://github.com/apache/spark/pull/15821#discussion_r122488149 --- 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) --- End diff -- Good point @leifwalsh , I have a test for an empty DataFrame in Java and a test for empty partition in Python, but there should one for this case also and it should definitely handle the error. I'll put that in the next update.
--- 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