Blizzara opened a new issue, #10817: URL: https://github.com/apache/datafusion/issues/10817
### 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 (https://github.com/apache/datafusion/blob/8fcb3e4b8a8fe6c4c7f83922dd860c9fa78c0639/datafusion/substrait/src/logical_plan/producer.rs#L117), though the produced list lacks the inner names of struct fields (the "names" should be a flattened list of a [depth-first search through all the fields](https://github.com/substrait-io/substrait/blob/4f5b4ac4d473c9f03f30f86eca080073d99ef1c7/proto/substrait/algebra.proto#L422)). However the consumer side completely disregards the given names (https://github.com/apache/datafusion/blob/8fcb3e4b8a8fe6c4c7f83922dd860c9fa78c0639/datafusion/substrait/src/logical_plan/consumer.rs#L227). I'll write up a PR to fix ### 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 _No response_ -- 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: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org