mihailoale-db opened a new pull request, #52060:
URL: https://github.com/apache/spark/pull/52060

   ### What changes were proposed in this pull request?
   In case a `Project`, `Aggregate` or `Window` is a child of `Union`, we don't 
remove an `Alias` in case it is on top of an `Attribute` which exists in the 
output set of the operator. This is needed because otherwise, we end up having 
an operator with duplicates in its output. When that happens, `Union` is not 
resolved and we fail (but we shouldn't).
   Consider this example:
   ```
   SELECT col1 FROM values(1) WHERE 100 IN (SELECT col1 UNION SELECT col1);
   ```
   
   In this PR I propose that we fix above query (it should pass, now it fails) 
by not removing `Alias`es under `Union` that would cause duplicates.
   
   ### Why are the changes needed?
   To fix a query pattern.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Added test.
   
   ### 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