felixloesing commented on code in PR #13747:
URL: https://github.com/apache/gluten/pull/13747#discussion_r4744634474
##########
gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenExplainUtils.scala:
##########
@@ -138,26 +141,35 @@ object GlutenExplainUtils extends AdaptiveSparkPlanHelper
{
def visit(tmp: QueryPlan[_]): Unit = {
tmp.foreachUp {
- case cmd: CommandResultExec => visit(cmd.commandPhysicalPlan)
- case p: V2CommandExec
- if !shouldIgnoreInFallbackStats(p) =>
- onFallback(p, fallbackReason(p))
- case sub: AdaptiveSparkPlanExec if sub.isSubquery =>
visit(sub.executedPlan)
- case p: QueryStageExec => visit(p.plan)
- case i: InMemoryTableScanExec =>
- if (PlanUtil.isGlutenTableCache(i)) {
- onGluten(i)
- } else {
- onFallback(i, "Columnar table cache is disabled")
+ node =>
+ if (visited.add(node.asInstanceOf[AnyRef])) {
+ node match {
+ case cmd: CommandResultExec => visit(cmd.commandPhysicalPlan)
+ case p: V2CommandExec
+ if !shouldIgnoreInFallbackStats(p) =>
+ onFallback(p, fallbackReason(p))
+ // AQE is a leaf, so foreachUp cannot enter its plan before this
guard.
+ case sub: AdaptiveSparkPlanExec if sub.isSubquery &&
sub.isFinalPlan =>
+ visit(sub.executedPlan)
+ case reused: ReusedSubqueryExec => visit(reused.child)
+ case p: QueryStageExec => visit(p.plan)
+ case i: InMemoryTableScanExec =>
+ if (PlanUtil.isGlutenTableCache(i)) {
+ onGluten(i)
+ } else {
+ onFallback(i, "Columnar table cache is disabled")
+ }
+ case p: SparkPlan if shouldIgnoreInFallbackStats(p) => // Ignore
+ case p: GlutenPlan =>
+ onGluten(p)
+ p.innerChildren.foreach(visit)
+ case _: BaseSubqueryExec =>
Review Comment:
Done, narrowed to `SubqueryExec`. A vanilla `SubqueryBroadcastExec` is
reported as a fallback again.
--
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]