scsmithr opened a new issue, #6016:
URL: https://github.com/apache/arrow-datafusion/issues/6016

   ### Describe the bug
   
   Creating a view in a new schema then trying to querying that view using its 
qualified name results in an error. See below:
   
   ```
   DataFusion CLI v22.0.0
   ❯ create schema s;
   0 rows in set. Query took 0.007 seconds.
   ❯ create view s.v as (select 1 as a);
   0 rows in set. Query took 0.004 seconds.
   ❯ select * from s.v;
   Schema error: No field named s.v.a. Valid fields are "s.v".a.
   ```
   
   I'm also not able to us fully qualified field names to select from this view 
either:
   
   ```
   ❯ select a from s.v;
   Schema error: No field named s.v.a. Valid fields are "s.v".a.
   ❯ select s.v.a;
   Schema error: No field named s.v.a.
   ❯ select "s.v".a;
   Schema error: No field named s.v.a.
   ```
   
   ### To Reproduce
   
   Using datafusion-cli
   
   ```
   DataFusion CLI v22.0.0
   ❯ create schema s;
   0 rows in set. Query took 0.007 seconds.
   ❯ create view s.v as (select 1 as a);
   0 rows in set. Query took 0.004 seconds.
   ❯ select * from s.v;
   Schema error: No field named s.v.a. Valid fields are "s.v".a.
   ```
   
   ### Expected behavior
   
   I can run `select * from s.v` (along with the qualified alternatives).
   
   ### Additional context
   
   Also fails in DataFusion 21.1.0 & 21.0.0:
   
   ```
   DataFusion CLI v21.1.0
   ❯ create schema s;
   0 rows in set. Query took 0.007 seconds.
   ❯ create view s.v as select 1 as a;
   0 rows in set. Query took 0.004 seconds.
   ❯ select * from s.v
   ;
   Schema error: No field named "s"."v"."a". Valid fields are "s.v"."a".
   ```
   
   Works as expected in 20.0.0
   
   ```
   DataFusion CLI v20.0.0
   ❯ create schema s;
   0 rows in set. Query took 0.008 seconds.
   ❯ create view s.v as select 1 as a;
   0 rows in set. Query took 0.004 seconds.
   ❯ select * from s.v;
   +---+
   | a |
   +---+
   | 1 |
   +---+
   1 row in set. Query took 0.010 seconds.
   ```


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