zahed1994 commented on PR #58146:
URL: https://github.com/apache/spark/pull/58146#issuecomment-5353758035

   Nice catch and elegant fix @manuzhang!
   
   ### Review Summary:
   - **Root Cause**: `plan.expressions.foreach { expr => expr match ... }` 
previously only checked top-level expressions where the expression root itself 
was a `SubqueryExpression`. Nested subqueries inside binary/complex expressions 
(e.g. `WHERE id = (SELECT ...)` where root is `EqualTo`) bypassed cycle 
detection.
   - **Fix**: Changing to `expr.foreach` properly traverses the entire 
expression AST down to any nested `SubqueryExpression` nodes.
   - **Test Case**: Verified the new `ALTER VIEW view1 AS SELECT * FROM jt 
WHERE id = (SELECT id FROM view2)` regression test in `SQLViewSuite`.
   
   LGTM +1!
   


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