liuzqt commented on code in PR #49715: URL: https://github.com/apache/spark/pull/49715#discussion_r1945748816
########## sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanExec.scala: ########## @@ -579,23 +592,52 @@ case class AdaptiveSparkPlanExec( allChildStagesMaterialized = false, newStages = Seq(newStage)) - case q: QueryStageExec => + case q: QueryStageExec if q ne currentPhysicalPlan => Review Comment: I just noticed an even more complicated pattern from broken test: We create a new non-result query stage as the root node, and that query stage is immediately materialized due to stage reuse, so we have to create result stage right after. Current implementation can not handle such case, and fixing is might be hacky... So yes I think maybe separating result and non-result query stage creation is a better option. I'll rename it and add some comments to clarify. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org