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

    https://github.com/apache/spark/pull/22344#discussion_r218627396
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala ---
    @@ -98,7 +98,8 @@ case class LocalLimitExec(limit: Int, child: SparkPlan) 
extends UnaryExecNode wi
     /**
      * Take the `limit` elements of the child output.
      */
    -case class GlobalLimitExec(limit: Int, child: SparkPlan) extends 
UnaryExecNode {
    +case class GlobalLimitExec(limit: Int, child: SparkPlan,
    +                           orderedLimit: Boolean = false) extends 
UnaryExecNode {
    --- End diff --
    
    It means this global limit won't change input data order. This is used on 
sort + limit case which is usually taken by `TakeOrderedAndProjectExec` at most 
of time.
    
    But if limit number is more than `SQLConf.TOP_K_SORT_FALLBACK_THRESHOLD`, 
it's not goes for `TakeOrderedAndProjectExec`.
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to