Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/11347#discussion_r54308425
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -257,53 +264,85 @@ def limit(self, num):
@ignore_unicode_prefix
@since(1.3)
def take(self, num):
- """Returns the first ``num`` rows as a :class:`list` of
:class:`Row`.
+ """Returns the first ``num`` records as a :class:`list`.
>>> df.take(2)
[Row(age=2, name=u'Alice'), Row(age=5, name=u'Bob')]
"""
- with SCCallSiteSync(self._sc) as css:
- port =
self._sc._jvm.org.apache.spark.sql.execution.python.EvaluatePython.takeAndServe(
- self._jdf, num)
- return list(_load_from_socket(port,
BatchedSerializer(PickleSerializer())))
+ return self.limit(num).collect()
--- End diff --
This requires can all the partitions, see SPARK-10731
---
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]