Blizzara commented on issue #14632:
URL: https://github.com/apache/datafusion/issues/14632#issuecomment-2654253000

   Actually, this is related to an interplay between the substrait stuff and 
the analyzer. Seems like what happens is:
   - substrait is kind of handled "correctly", in that the produced & consumed 
plan reports the correct schema. Thus the consumer's 
[rename_expressions](https://github.com/apache/datafusion/blob/980931c5a70b8b08c918195803145f64f1ec901f/datafusion/substrait/src/logical_plan/consumer.rs#L926)
 does not wrap the expressions in renaming casts.
   - analyzer (called by the [roundtrip 
code](https://github.com/apache/datafusion/blob/980931c5a70b8b08c918195803145f64f1ec901f/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs#L1373)
 but also my use-case in production) however sees that the branches of the 
case-when return different types (Struct({f1:Utf8}) vs Struct({c0:Utf8}) or 
something like that), and solves that by casting the then-arm to match the 
else-arm. 
   
   I'm not sure what the correct solution here would be, but maybe the use of 
`named_struct` in substrait is a mistake on my part given the rest of substrait 
is not "named"..


-- 
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

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

Reply via email to