cloud-fan commented on code in PR #46814:
URL: https://github.com/apache/spark/pull/46814#discussion_r1621557032
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/PropagateEmptyRelation.scala:
##########
@@ -133,8 +133,8 @@ abstract class PropagateEmptyRelationBase extends
Rule[LogicalPlan] with CastSup
p
}
- // the only case can be matched here is that LogicalQueryStage is empty
- case p: LeafNode if !p.isInstanceOf[LocalRelation] && isEmpty(p) =>
empty(p)
+ // Only replace a query stage if it would lead to a reduction of operators
+ case p: LogicalQueryStage if isEmpty(p) && !p.isDirectStage => empty(p)
Review Comment:
can we add code comments to explain the `!p.isDirectStage` condition?
--
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]