alamb commented on issue #2581:
URL: https://github.com/apache/datafusion/issues/2581#issuecomment-2575099075

   > Apologies, I should have checked the example value. 10_000 shows what I 
mean:
   
   Ah, yes, in this case the 
[UnwrapCastInComparison](https://docs.rs/datafusion/latest/datafusion/optimizer/unwrap_cast_in_comparison/struct.UnwrapCastInComparison.html)
 rule can't convert `10,000` to an `Int8` and so the conversion is done at 
runtime
   
   I just ran across a seemingly similar request / PR in arrow-rs from @gruuya 
   - https://github.com/apache/arrow-rs/pull/6892
   
   
   > A side note, but perhaps we're missing a rule somewhere to know that x can 
never = 10000 when it started out as a u8?
   
   Yes I agree this would be a better plan. 
   
   > Perhaps my change in https://github.com/apache/datafusion/pull/13736 that 
preserves min/max stats through cast expressions?
   
   Indeed that would be quite sweet. We could do the conversion of `x = 10000` 
to `false` based on:
   1. If the range of the **type** of x can not represent 10,000 there is no 
way it can be true
   2. If the known range of `x` (#1376 style) can not represent 10,000 also 
there is no way it can be true
   
   


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