cloud-fan commented on code in PR #35975:
URL: https://github.com/apache/spark/pull/35975#discussion_r850086581


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala:
##########
@@ -85,22 +85,48 @@ abstract class SparkStrategies extends 
QueryPlanner[SparkPlan] {
       case ReturnAnswer(rootPlan) => rootPlan match {
         case Limit(IntegerLiteral(limit), Sort(order, true, child))
             if limit < conf.topKSortFallbackThreshold =>
-          TakeOrderedAndProjectExec(limit, order, child.output, 
planLater(child)) :: Nil
+          TakeOrderedAndProjectExec(limit, 0, order, child.output, 
planLater(child)) :: Nil
         case Limit(IntegerLiteral(limit), Project(projectList, Sort(order, 
true, child)))
             if limit < conf.topKSortFallbackThreshold =>
-          TakeOrderedAndProjectExec(limit, order, projectList, 
planLater(child)) :: Nil
+          TakeOrderedAndProjectExec(limit, 0, order, projectList, 
planLater(child)) :: Nil
         case Limit(IntegerLiteral(limit), child) =>
-          CollectLimitExec(limit, planLater(child)) :: Nil
+          CollectLimitExec(limit, 0, planLater(child)) :: Nil
+        case GlobalLimitAndOffset(IntegerLiteral(limit), 
IntegerLiteral(offset),
+          Sort(order, true, child)) if limit < conf.topKSortFallbackThreshold 
=>

Review Comment:
   ```suggestion
             Sort(order, true, child)) if limit + offset < 
conf.topKSortFallbackThreshold =>
   ```



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala:
##########
@@ -85,22 +85,48 @@ abstract class SparkStrategies extends 
QueryPlanner[SparkPlan] {
       case ReturnAnswer(rootPlan) => rootPlan match {
         case Limit(IntegerLiteral(limit), Sort(order, true, child))
             if limit < conf.topKSortFallbackThreshold =>
-          TakeOrderedAndProjectExec(limit, order, child.output, 
planLater(child)) :: Nil
+          TakeOrderedAndProjectExec(limit, 0, order, child.output, 
planLater(child)) :: Nil
         case Limit(IntegerLiteral(limit), Project(projectList, Sort(order, 
true, child)))
             if limit < conf.topKSortFallbackThreshold =>
-          TakeOrderedAndProjectExec(limit, order, projectList, 
planLater(child)) :: Nil
+          TakeOrderedAndProjectExec(limit, 0, order, projectList, 
planLater(child)) :: Nil
         case Limit(IntegerLiteral(limit), child) =>
-          CollectLimitExec(limit, planLater(child)) :: Nil
+          CollectLimitExec(limit, 0, planLater(child)) :: Nil
+        case GlobalLimitAndOffset(IntegerLiteral(limit), 
IntegerLiteral(offset),
+          Sort(order, true, child)) if limit < conf.topKSortFallbackThreshold 
=>
+          TakeOrderedAndProjectExec(limit, offset, order, child.output, 
planLater(child)) :: Nil
+        case GlobalLimitAndOffset(IntegerLiteral(limit), 
IntegerLiteral(offset),
+          Project(projectList, Sort(order, true, child)))
+            if limit < conf.topKSortFallbackThreshold =>

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to