xitep opened a new pull request, #2235:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2235

   * `SetExpr` is a directly recursive data-structure through 
`SetExpr::SetOperation`
   * Its visit impl dispatches directly to `Select` (without necessary going 
through `Query` first)
   * Right now a `Visitor` impl has no chance to observe the scope of a visited 
SELECT
   
   The motivation is that `SELECT`s often introduce aliases which are valid 
only for that particular SELECT.
   
   ```sql
   select * 
     from (select 1 val from dual) x
    where x.val = 1
   
    union all
   
   select *
     from (select 2 val from dual) y
    where y.val = 2
   -- referring to `x` at this point is an error
   ```
   
   This change allows effectively to determine the scope of a (nested) SELECT 
using `Visitor/Mut`.
   
   Alternatively we could entirely drop `SetExpr::Select` and replace it's use 
with `SetExpr::Query`; after all a `Select` is a Query's body. (My personal 
preference would be to keep the current structure as it makes the AST easier to 
follow / navigate / more expressive.)


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