[
https://issues.apache.org/jira/browse/SPARK-24193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17102439#comment-17102439
]
Wenchen Fan commented on SPARK-24193:
-------------------------------------
I think it's not a problem if you do `df.collect` instead of `df.rdd.collect`.
LIMIT only preserves the data order if it's the last operation. When you do
`df.rdd`, it means you are going to add more operations.
> Sort by disk when number of limit is big in TakeOrderedAndProjectExec
> ---------------------------------------------------------------------
>
> Key: SPARK-24193
> URL: https://issues.apache.org/jira/browse/SPARK-24193
> Project: Spark
> Issue Type: New Feature
> Components: SQL
> Affects Versions: 2.3.0
> Reporter: Jin Xing
> Assignee: Jin Xing
> Priority: Major
> Fix For: 2.4.0
>
>
> Physical plan of "_select colA from t order by colB limit M_" is
> _TakeOrderedAndProject_;
> Currently _TakeOrderedAndProject_ sorts data in memory, see
> https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala#L158
>
> Shall we add a config -- if the number of limit (M) is too big, we can sort
> by disk ? Thus memory issue can be resolved.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]