FauxFaux opened a new issue #1509:
URL: https://github.com/apache/arrow-datafusion/issues/1509


   **Describe the bug**
   A construction like:
   
   ```sql
   with x as (
     select a from baz
     union all
     select a from bar
   )
   select a 
   from x
   where a=1
   ```
   
   ..gives the error:
   
   > Plan("No field named 'x.a'. Valid fields are 'baz.a'.")
   
   Explicitly specifying `where x.a` gives the same error, so that is resolving 
correctly?
   
   Writing the query as `where baz.a=1` instead gives:
   
   > Plan("No field named 'baz.a'. Valid fields are 'x.a'.")
   
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   ```
   ❯ create table bar as select 1 as a;
   ❯ create table baz as select 1 as a;
   ❯ with x as (select a from baz union all select a from bar) select a from x;
   +---+
   | a |
   +---+
   | 1 |
   | 1 |
   +---+
   ```
   
   ```
   ❯ with x as (select a from baz union all select a from bar) select a from x 
where a=1;
   Plan("No field named 'x.a'. Valid fields are 'baz.a'.")
   ```
   
   **Expected behavior**
   I believe `SELECT a FROM x WHERE a=1` should function as if x was a single 
table containing a column named `a`, as shown in non-filtered select in the 
reproduction steps above.
   
   **Additional context**
   This isn't something to do with memory tables; it happens to my Parquet 
EXTERNAL tables too.
   
   The error messaging here isn't great for my parquet files, which already use 
dotted notation, like `select "address.line1" from address`, now we have 
"address.address.line1".
   


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


Reply via email to