sunchao commented on code in PR #5483:
URL: https://github.com/apache/datafusion-comet/pull/5483#discussion_r3873983682
##########
spark/src/main/scala/org/apache/comet/rules/CometExecRule.scala:
##########
@@ -646,6 +646,15 @@ case class CometExecRule(session: SparkSession)
// Set up logical links
newPlan = newPlan.transform {
+ case op: CometExec
+ if op
+ .getTagValue(SparkPlan.LOGICAL_PLAN_TAG)
+ .exists(_.isInstanceOf[LogicalQueryStage]) =>
+ // AQE replanning reuses this physical root and links it to the
current logical stage.
+ // originalPlan can still point to a subtree hidden inside that
logical leaf, which
+ // AQE cannot replace in the current logical plan. Only preserve a
direct stage link,
+ // not a link inherited from an ancestor.
Review Comment:
Updated in 92b0baac92bafdb866547fda3161c4ce3eab981a. Added version-pinned
Spark 4.1.3 links beside the guard: `LogicalQueryStageStrategy` returns the
existing physical root, then `SparkStrategies.plan` assigns its direct logical
link. The comment also distinguishes the ordinary exchange path, where the
exchange is behind a query-stage leaf, and keeps the direct/inherited
distinction explicit.
--
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]