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

   **Describe the bug**
   Casting a floating point number like `1.1_f64` to decimal64 fails. 
   <!--
   A clear and concise description of what the bug is.
   -->
   
   **To Reproduce**
   The following test fails, but only for `Decimal64`.
   ```rust
       #[test]
       fn test_cast_floating_to_decimals() {
           for output_type in [
               DataType::Decimal32(9, 3),
               DataType::Decimal64(9, 3),
               DataType::Decimal128(9, 3),
               DataType::Decimal256(9, 3),
           ] {
               let input_type = DataType::Float64;
               assert!(can_cast_types(&input_type, &output_type));
   
               let array = vec![Some(1.1_f64)];
               let array = PrimitiveArray::<Float64Type>::from_iter(array);
               let result = cast_with_options(
                   &array,
                   &output_type,
                   &CastOptions {
                       safe: false,
                       format_options: FormatOptions::default(),
                   },
               );
               assert!(
                   result.is_ok(),
                   "Failed to cast to {output_type} with: {}",
                   result.unwrap_err().to_string()
               );
           }
       }
   ```
   <!--
   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 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