qazxcdswe123 commented on issue #15291:
URL: https://github.com/apache/datafusion/issues/15291#issuecomment-2744966415

   > [@alamb](https://github.com/alamb) What's the reason to cast numeric 
columns to i64/u64 and not to smallest compatible type? Why not to try 
something like this:
   > 
   >         macro_rules! try_parse_num {
   >             ($num:expr, $ty:ident) => {{
   >                 if let Ok(n) = $num.parse::<$ty>() {
   >                     return Ok(lit(n));
   >                 }
   >             }};
   >         }
   > 
   >         try_parse_num!(signed_number, i8);
   >         if !negative {
   >             try_parse_num!(unsigned_number, u8);
   >         }
   >         try_parse_num!(signed_number, i16);
   >         if !negative {
   >             try_parse_num!(unsigned_number, u16);
   >         }
   >         try_parse_num!(signed_number, i32);
   >         if !negative {
   >             try_parse_num!(unsigned_number, u32);
   >         }
   >         try_parse_num!(signed_number, i64);
   >         if !negative {
   >             try_parse_num!(unsigned_number, u64);
   >         }
   > I replaced code at
   > 
   > 
[datafusion/datafusion/sql/src/expr/value.rs](https://github.com/apache/datafusion/blob/74aeb91fd94109d05178555d83e812e6e0712573/datafusion/sql/src/expr/value.rs#L81)
   > 
   > Line 81 in 
[74aeb91](/apache/datafusion/commit/74aeb91fd94109d05178555d83e812e6e0712573)
   > 
   >  // Try to parse as i64 first, then u64 if negative is false, then decimal 
or f64 
   > with provided snippet and everything is ok now - no one rule is failing, 
behaviour is the same, no matter of used column type.
   
   I think it makes some sense from a [False 
Sharing](https://en.wikipedia.org/wiki/False_sharing) perspective but I'm not 
entirely sure about that.


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