pratham76 commented on code in PR #58656:
URL: https://github.com/apache/spark/pull/58656#discussion_r4040734214


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/subquery.scala:
##########
@@ -439,7 +454,8 @@ object RewritePredicateSubquery extends Rule[LogicalPlan] 
with PredicateHelper {
             ExistenceJoin(exists), Some(finalJoinCond), joinHint)
           introducedAttrs += exists
           Not(exists)
-        case InSubquery(values, ListQuery(sub, _, _, _, conditions, subHint)) 
=>
+        case sq @ InSubquery(values, ListQuery(sub, _, _, _, conditions, 
subHint))
+            if canRewrite(sq) =>

Review Comment:
   `rewriteExistentialExprWithAttrs` now walks the expression with an explicit 
recursion, and a declined
   sub-query is returned untouched, children included. With the default 
`canRewrite` the declined case
   never matches, so the existing callers traverse exactly as before.
   Worth noting for the record: with the correlated-leftover rejection from 
comment 1, every shape that
   could reach this path now raises `0A000` first, so this change is no longer 
observable through SQL.
   I kept it because relying on that coincidence to stay true is the kind of 
thing that breaks later.



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