Skip to content

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

@andygrove

Description

@andygrove

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions