klion26 commented on PR #9169: URL: https://github.com/apache/arrow-rs/pull/9169#issuecomment-3759144303
Sorry for the late reply, I missed this notification. Thanks for the reply。 This is raised in `variant_get` related code, hoping to support conversion like decimal/float to int, and TimeUnit::Nano -> TimeUnit::Second, etc. I found the Decimal-related tests([test_decimal_to_decimal_decrease_scale_and_precision_unchecked](https://github.com/apache/arrow-rs/blob/1db1a8869cceb179aa885ed58da9f0b49c03eafe/arrow-cast/src/cast/mod.rs#L11466)/[test_decimal_to_decimal_increase_scale_and_precision_unchecked](https://github.com/apache/arrow-rs/blob/1db1a8869cceb179aa885ed58da9f0b49c03eafe/arrow-cast/src/cast/mod.rs#L11416)) in `arrow-cast/src/cast/mod.rs(Copied some test case below) <details> <summary> test behavior for decimal cast</summary> input -> casted_result - 99999(Decimal(5, 0)) -> 100(Decimal(3, -3)) - -99999(Decimal(5, 0)) -> -1(Decimal(1, -5)) - 123456789(Decimal(10, 2)) -> 12346(5, -2) - -9876543210(Decimal(10, 4)) -> -987654(Decimal(7, 0)) - 9999999(Decimal(7, 4)) -> Err(Invalid argument error: 1000.000 is too large to store in a Decimal128 of precision 6. Max is 999.999) - 99999(Decimal(5,0)) -> 9999900000(Decimal(10,5)) - -99999(Decimal(5, 0)) -> -9999900000(Decimal(10, 5)) - 99999(Decimal(5, 2)) -> 99999000(10, 5) - -99999(Decimal(5, -2)) -> -9999900000(Decimal(10, 3)) - -12345(Decimal(5, 3)) -> Decimal(6, 5) Err("Invalid argument error: -12.34500 is too small to store in a Decimal128 of precision 6. Min is -9.99999" </details> Looking at `cast_with_option`, it seems it has implemented many conversions, so maybe we can directly use or improve `cast_with_option`? I'll try to figure it out and come back. -- 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]
