cloud-fan commented on a change in pull request #34738:
URL: https://github.com/apache/spark/pull/34738#discussion_r765786630



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -249,12 +250,37 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] 
with PredicateHelper {
   def applyLimit(plan: LogicalPlan): LogicalPlan = plan.transform {
     case globalLimit @ Limit(IntegerLiteral(limitValue), child) =>
       child match {

Review comment:
       a simpler way to skip Project node
   ```
   private def pushDownLimit(plan: LogicalPlan, limit: Int) = plan match {
     case p: Project => pushDownLimit(p.child)
     case ScanOperation(_, filter, sHolder: ScanBuilderHolder) if 
filter.isEmpty => ...
     case Sort(order, _, operation @ ScanOperation(_, filter, sHolder: 
ScanBuilderHolder)) ...
   }
   
   def applyLimit(plan: LogicalPlan): LogicalPlan = plan.transform {
       case globalLimit @ Limit(IntegerLiteral(limitValue), child) => 
pushDownLimit(child, limitValue)
   }
   ```




-- 
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