0lai0 commented on issue #5095:
URL: 
https://github.com/apache/datafusion-comet/issues/5095#issuecomment-5268849332

   While working on #5095, I found a bug in `cast_boolean_to_decimal` when 
`precision <= scale` and the input contains `true`.
   
   For example, `CAST(true AS DECIMAL(3,3))` currently returns `Ok` with an 
unscaled value of `1000` (i.e. `1.000`), but `DECIMAL(3,3)` only allows values 
up to `0.999` (unscaled `999`). The overflow error remap in 
`with_precision_and_scale` never triggers because Arrow only validates type 
metadata, not per-value precision.
   
   Int cast uses `is_validate_decimal_precision` per value; the boolean path 
does not. Spark would not accept this value.
   
   I'll open a separate issue to fix the boolean overflow handling. For this PR 
I'll scope to int→decimal only; float stays unchanged (#1371 / #5136) and 
boolean is out of scope until the bug is fixed.


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