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

   ### Describe the bug
   
   See repro; the cast ought to work.
   
   ### To Reproduce
   
   ```rust
   use arrow_array::{ArrayRef, StringArray, Float64Array};
   use arrow_cast::{can_cast_types, cast};
   use arrow_schema::DataType;
   use std::sync::Arc;
   
   assert!(can_cast_types(&DataType::Utf8, &DataType::Decimal128(10, -2)));
   let strings: ArrayRef = Arc::new(StringArray::from(vec!["100"]));
   cast(&strings, &DataType::Decimal128(10, -2)).unwrap();
   // Err: Invalid argument error: Cannot cast string to decimal with negative 
scale -2
   // (also with CastOptions { safe: true })
   
   let floats: ArrayRef = Arc::new(Float64Array::from(vec![100.0]));
   cast(&floats, &DataType::Decimal128(10, -2)).unwrap(); // works
   
   ```
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to