Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in SQL support for ORDER BY and aliased expressions #3160

Closed
andygrove opened this issue Aug 15, 2022 · 1 comment · Fixed by #3165
Closed

Regression in SQL support for ORDER BY and aliased expressions #3160

andygrove opened this issue Aug 15, 2022 · 1 comment · Fixed by #3165
Labels
bug Something isn't working

Comments

@andygrove
Copy link
Member

Describe the bug

DataFusion 10.0 supports this query:

❯ select y.column_1 z, sum(column_2) q from x y group by y.column_1 order by y.column_1;
+---+---+
| z | q |
+---+---+
| 1 | 2 |
+---+---+

DataFusion master fails:

❯ select y.column_1 z, sum(column_2) q from x y group by y.column_1 order by y.column_1;
SchemaError(FieldNotFound { qualifier: Some("y"), name: "column_1", valid_fields: Some(["z", "q"]) })

To Reproduce

echo "1,2" > data.csv
create external table x stored as csv location 'data.csv';

Expected behavior
Query should work

Additional context
None

@andygrove andygrove added the bug Something isn't working label Aug 15, 2022
@andygrove
Copy link
Member Author

andygrove commented Aug 15, 2022

According to git bisect, this regression was introduced in #3003:

$ git bisect bad
e23925c96c97139d101719fa7a456088eeed6ae9 is the first bad commit
commit e23925c96c97139d101719fa7a456088eeed6ae9
Author: Andy Grove <[email protected]>
Date:   Mon Aug 1 19:30:26 2022 -0600

    Fix SQL planner bug when resolving columns with same name as a relation (#3003)
    
    * repro unit test
    
    * improve test
    
    * fix
    
    * make logic more robust
    
    * add a simple test case
    
    Co-authored-by: Wei-Ting Kuo <[email protected]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant