-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Substrait doesn't support the concept of ALIASes, as inside the plan there are no column names, just indices (https://substrait.io/expressions/field_references/#field-references). Ensuring the final plan has the right column names is done through the "names" field on the RootRel.
DataFusion supports already producing that "names" field (
| names: plan.schema().field_names(), |
| Ok(from_substrait_rel(ctx, root.input.as_ref().unwrap(), &function_extension).await?) |
To Reproduce
#[tokio::test]
async fn select_with_alias() -> Result<()> {
roundtrip("SELECT a AS aliased_a FROM data").await
}
fails with
assertion `left == right` failed
left: "Projection: data.a AS aliased_a\n TableScan: data projection=[a]"
right: "TableScan: data projection=[a]"
Expected behavior
Should succeed producing the correct column names
Additional context
I'll write up a PR to fix
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working