jayzhan211 commented on issue #8302:
URL: 
https://github.com/apache/arrow-datafusion/issues/8302#issuecomment-1832926920

   > > 
https://github.com/apache/arrow-datafusion/blob/2a692446f46ef96f48eb9ba19231e9576be9ff5a/datafusion/expr/src/type_coercion/binary.rs#L388-L406
   > > 
   > > In `comparison_binary_numeric_coercion`, signed type and u64 is coerced 
to i64, anyone knows why is this acceptable? what kind of cases are?
   > > for type u64 and f32, it will return f32 which is smaller than u64, not 
sure why is this too
   > 
   > The comment in the code you linked seems to say "some information loss is 
inevitable":
   > 
   > ```
   >         // The following match arms encode the following logic: Given the 
two
   >         // integral types, we choose the narrowest possible integral type 
that
   >         // accommodates all values of both types. Note that some 
information
   >         // loss is inevitable when we have a signed type and a `UInt64`, in
   >         // which case we use `Int64`;i.e. the widest signed integral type.
   > ```
   > 
   > It is likely for "usability" so that you can compare i64 and u64 without 
an explicit type cast 🤷
   
   I don't think that usability is the good reason :(  It might cause data 
loss. 
   
   @alamb I would like to change them to the straightforward version, choose 
the larger type between two. I think it can also be used all the place in 
datafusion easily (one place is `can_coerce_from`). Is there any concern about 
this change?


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

Reply via email to