Skip to content

Substrait doesn't support alias in projection #6489

@waynexia

Description

@waynexia

Describe the bug

SQLs like these will fail:

SELECT a as alias_a, a FROM data;

or

SELECT a as alias_a FROM data ORDER BY a;

The error message looks like

Error: Plan("Projections require unique expression names but the expression \"data.a\" at position 0 and \"data.a\" at position 1 have the same name. Consider aliasing (\"AS\") one of them.")

To Reproduce

Adding case in datafusion/substrait/tests/roundtrip_logical_plan.rs like:

    #[tokio::test]
    async fn roundtrip_alias_in_projection() -> Result<()> {
        roundtrip("SELECT a as alias_a, a FROM data").await
    }

Expected behavior

It should generate correct LogicalPlan without error

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingsubstraitChanges to the substrait crate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions