cloud-fan commented on code in PR #37104:
URL: https://github.com/apache/spark/pull/37104#discussion_r915960642
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -283,20 +283,7 @@ case class TakeOrderedAndProjectExec(
}
override def executeCollect(): Array[InternalRow] = {
- val orderingSatisfies = SortOrder.orderingSatisfies(child.outputOrdering,
sortOrder)
- val ord = new LazilyGeneratedOrdering(sortOrder, child.output)
- val limited = if (orderingSatisfies) {
-
child.execute().mapPartitionsInternal(_.map(_.copy()).take(limit)).takeOrdered(limit)(ord)
- } else {
-
child.execute().mapPartitionsInternal(_.map(_.copy())).takeOrdered(limit)(ord)
- }
- val data = if (offset > 0) limited.drop(offset) else limited
- if (projectList != child.output) {
- val proj = UnsafeProjection.create(projectList, child.output)
- data.map(r => proj(r).copy())
- } else {
- data
- }
+ doExecute().mapPartitionsInternal(_.map(_.copy())).collect()
Review Comment:
does this mean we now have an extra shuffle?
--
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]