You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Blizzara (via GitHub)" <gi...@apache.org> on 2024/06/07 07:29:16 UTC

[I] Substrait consumer doesn't respect final output column names [datafusion]

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-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Substrait consumer doesn't respect final output column names [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #10817:
URL: https://github.com/apache/datafusion/issues/10817#issuecomment-2156778930

   I added to the substrait support epic: https://github.com/apache/datafusion/issues/5173


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Substrait consumer doesn't respect final output column names [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #10817: Substrait consumer doesn't respect final output column names
URL: https://github.com/apache/datafusion/issues/10817


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org