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

   @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:
   ```rust
           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 
https://github.com/apache/datafusion/blob/74aeb91fd94109d05178555d83e812e6e0712573/datafusion/sql/src/expr/value.rs#L81
 with provided snippet and everything is ok now - no one rule is failing, 
behaviour is the same, no matter of used column type.


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