cloud-fan commented on a change in pull request #35961:
URL: https://github.com/apache/spark/pull/35961#discussion_r834964865
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -374,9 +374,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan]
with PredicateHelper wit
sHolder.pushedLimit = Some(limit)
}
operation
- case s @ Sort(order, _, operation @ ScanOperation(_, filter, sHolder:
ScanBuilderHolder))
+ case s @ Sort(order, _, operation @ ScanOperation(project, filter,
sHolder: ScanBuilderHolder))
if filter.isEmpty =>
- val orders = DataSourceStrategy.translateSortOrders(order)
+ val aliasMap = getAliasMap(project)
+ val newOrder = order.map(replaceAlias(_,
aliasMap)).asInstanceOf[Seq[SortOrder]]
+ val orders = DataSourceStrategy.translateSortOrders(newOrder)
if (orders.length == order.length) {
val topNPushed = PushDownUtils.pushTopN(sHolder.builder,
orders.toArray, limit)
if (topNPushed) {
Review comment:
We should think about what plan to return if top N is pushed.
--
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]