Lordworms opened a new issue, #13774:
URL: https://github.com/apache/datafusion/issues/13774

   ### Describe the bug
   
   Bug where NATURAL JOIN rejects source table column qualifiers in ORDER BY 
clause.
   
   ### To Reproduce
   
   ```
   (base) ➜  ~ echo '"id","name","stuff"
   1,"aaa",2
   2,"bbb",1
   3,"cc",1
   4,"d",2' > test1.csv
   (base) ➜  ~ datafusion-cli
   DataFusion CLI v43.0.0
   > CREATE EXTERNAL TABLE server
   STORED AS CSV
   LOCATION 'test1.csv';
   0 row(s) fetched.
   Elapsed 0.037 seconds.
   
   > create table client(id int, name string, stuff int);
   0 row(s) fetched.
   Elapsed 0.007 seconds.
   
   > select * from server;
   +----+------+-------+
   | id | name | stuff |
   +----+------+-------+
   | 1  | aaa  | 2     |
   | 2  | bbb  | 1     |
   | 3  | cc   | 1     |
   | 4  | d    | 2     |
   +----+------+-------+
   4 row(s) fetched.
   Elapsed 0.021 seconds.
   
   > create table client(id int, name string, stuff int);
   Execution error: Table 'client' already exists
   > SELECT * FROM server NATURAL JOIN client AS client ORDER BY server.id;
   Schema error: No field named server.id. Valid fields are client.id, 
client.name, client.stuff.
   ```
   
   ### Expected behavior
   
   ```
   DataFusion CLI v41.0.0
   > CREATE EXTERNAL TABLE server(id int, name string, stuff int)
   STORED AS CSV
   LOCATION 'test1.csv';
   0 row(s) fetched. 
   Elapsed 0.005 seconds.
   
   > create table client(id int, name string, stuff int);
   0 row(s) fetched. 
   Elapsed 0.005 seconds.
   
   > SELECT * FROM server NATURAL JOIN client AS client ORDER BY server.id;
   +----+------+-------+
   | id | name | stuff |
   +----+------+-------+
   +----+------+-------+
   0 row(s) fetched. 
   Elapsed 0.020 seconds.
   ```
   
   ### Additional context
   
   _No response_


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