You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "manuzhang (via GitHub)" <gi...@apache.org> on 2025/12/16 04:34:15 UTC

[I] `cast_decimal_to_int16_down` truncated value incorrectly [datafusion-comet]

manuzhang opened a new issue, #2914:
URL: https://github.com/apache/datafusion-comet/issues/2914

   ### Describe the bug
   
   When implementing [fix: array to array cast](https://github.com/apache/datafusion-comet/pull/2897), the test of casting `ArrayType(DecimalType(10,2))` to `ArrayType(ShortType)` failed with following error, where comet truncates `-96833550.07` to `-96833550.7`.
   
   ``` 
   "...The value -96833550.[]7BD of the type "DEC..." did not equal "...The value -96833550.[0]7BD of the type "DEC..." (CometCastSuite.scala:1328)
   ```
   
   It looks to be related to `cast_decimal_to_int16_down` 
   
   https://github.com/apache/datafusion-comet/blob/5ec12d4024e78faa97834f88ab606ecd3d0db5fb/native/spark-expr/src/conversion_funcs/cast.rs#L674-L696
   
   It can be proven by printing the original and truncated values.
   
   ```
   casting value: -9683355007, truncated: -96833550, decimal: 7, is_overflow: false
   ```
   
   ### Steps to reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] `cast_decimal_to_int16_down` formats decimal value incorrectly [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget closed issue #2914: `cast_decimal_to_int16_down` formats decimal value incorrectly
URL: https://github.com/apache/datafusion-comet/issues/2914


-- 
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-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org