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


   **Describe the bug**
   Currently the Logical Plan builder assumes that the join conditions fields 
are provided in the same order as the tables are specified. This is different 
behavior to how Postgres works which does not care about the order of the 
tables listed in the condition.
   
   e.g.
   
   `t1_id = t2_id` works as `t1` is left and `t1_id` comes is on the left: 
   ```sql
   SELECT t1_id, t1_name, t2_name FROM t1 JOIN t2 ON t1_id = t2_id ORDER BY 
t1_id;
   ```
   
   `t2_id = t1_id` does not work as `t1` is left and `t2_id` comes from the 
right table:
   ```sql
   SELECT t1_id, t1_name, t2_name FROM t1 JOIN t2 ON t2_id = t1_id ORDER BY 
t1_id;
   ```
   
   **To Reproduce**
   It is easy to reproduce with by changing the test with the first statement 
to the second statement.
   
   **Expected behavior**
   Postgres does not care which order the join condition fields are listed in 
as long as they can be uniquely identified.
   
   **Additional context**
   I have create a PR for this.
   


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