Does using limit clause in pyspark reader always result in only 1 partition?

Viewed 45
1 Answers

I don't understand the background of this. But for this statement, the result will always be 1 as you tried to collect result.

>>> df3.limit(1000000).explain()
== Physical Plan ==
CollectLimit 1000000
+- FileScan csv 

But for LimitExec which is physical leaf node for limit operation. It has several implementation such as GlobalLimitExec, LocalLimitExec. For some implementations, it could use same partition num to parrellel fetch enough records, or pick subsets of partitions iteratively. Generally, you don't need to care how is doing.

Related