andygrove opened a new issue, #6833:
URL: https://github.com/apache/arrow-rs/issues/6833

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   If I try and cast floating-point value `12345.67` to `decimal(6,2)` then I 
get an error, as expected:
   
   ```
   "1234567 is too large to store in a Decimal128 of precision 6. Max is 999999"
   ```
   
   However, if I try and cast a `decimal(24,2)` value of  `12345.67` to 
`decimal(6,2)` then I do not get an error but instead have an invalid decimal 
value.
   
   ``
   PrimitiveArray<Decimal128(6, 2)>
   [
       1234567,
   ]
   ```
   
   If I then convert this decimal to a string, it produces `1234.56` instead of 
`12345.67`
   
   ```
   StringArray
   [
     "1234.56",
   ]
   ```
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   
   This is the root cause of https://github.com/apache/datafusion/issues/13492


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

Reply via email to