sydduckworth commented on PR #13305:
URL: https://github.com/apache/datafusion/pull/13305#issuecomment-2465065827

   > @sydduckworth Do you remember why `cast should drop input metadata since 
the type has changed`
   
   When I wrote my PR, I had to make a decision about how to handle metadata 
propagation across expressions.
   It seemed logical to me that the `Column` and `Alias` expressions should 
forward the source field's metadata, but my concern for other expressions was 
that forwarding the metadata could produce unexpected behavior, so I decided 
they would drop just any metadata in the source fields.
   
   The only one I wasn't sure about was `Cast` since I could see an argument 
for it preserving the source metadata, but I eventually just went with the idea 
that any expression that can change the datatype of the input should reset its 
metadata and added that test assertion verify the behavior.
   
   Long story short: there's no reason for that assertion other than my 
arbitrary decision when implementing the feature. To me it seems reasonable to 
change the behavior of `Cast` and remove (or invert) that assertion so the 
logical plan behavior matches the physical plan behavior.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to