liuzqt opened a new pull request, #53272:
URL: https://github.com/apache/spark/pull/53272

   ### What changes were proposed in this pull request?
   
   Safe type casting in `QueryPlan._subqueries`
   
   
   ### Why are the changes needed?
   
   `QueryPlan._subqueries` is dangerous because it force type casting ([code 
pointer](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/QueryPlan.scala#L524))
 
   
   Imagine a `SparkPlan` instance invoke this API where some of its subqueries 
could be `LogicalPlan`(this could happen in AQE where logical->phyiscal 
planning happen respectively in main/sub queries and they could be out-of-sync 
at a specific point.
   
   **_Reasoning why we dont' need a new API_**
   Although this API is at critical path of the whole Spark SQL, there is no 
need to create a separate API since if we run into this class cast error the 
whole query will just fail so it's always better to fix the issue and no need 
to preserve the "failure" buggy behavior.
   
   ### Does this PR introduce _any_ user-facing change?
   NO
   
   ### How was this patch tested?
   Existing UTs.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   NO


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