We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utf8
Describe the bug
arrow cannot cast Utf8 to decimal correctly in #8326.
// Negative number is wrong ❯ select '-1.23499999'::DECIMAL(4,3); +---------------------+ | Utf8("-1.23499999") | +---------------------+ | -0.765 | +---------------------+ 1 row in set. Query took 0.032 seconds.
The problem is that arrow does not parse the string correctly. fn parse_string_to_decimal_native<T: DecimalType>(
To Reproduce
#[test] fn test() { let array = LargeStringArray::from(vec![Some("-0.12345")]); // Decimal128 let output_type = DataType::Decimal128(38, 2); assert!(can_cast_types(array.data_type(), &output_type)); let casted_array = cast(&array, &output_type).unwrap(); let decimal_arr = casted_array.as_primitive::<Decimal128Type>(); assert_eq!("-0.12", decimal_arr.value_as_string(0)); // Decimal256 let output_type = DataType::Decimal256(76, 3); assert!(can_cast_types(array.data_type(), &output_type)); let casted_array = cast(&array, &output_type).unwrap(); let decimal_arr = casted_array.as_primitive::<Decimal256Type>(); assert_eq!("-0.123.", decimal_arr.value_as_string(0)); }
Expected behavior
pass the test
Additional context
#8326
The text was updated successfully, but these errors were encountered:
Looks like this is adding 1 instead of -1 when combining the decimal and numeric components
1
-1
Sorry, something went wrong.
label_issue.py automatically added labels {'arrow'} from #5128
label_issue.py
Successfully merging a pull request may close this issue.
Describe the bug
arrow cannot cast
Utf8
to decimal correctly in #8326.The problem is that arrow does not parse the string correctly.
fn parse_string_to_decimal_native<T: DecimalType>(
To Reproduce
Expected behavior
pass the test
Additional context
#8326
The text was updated successfully, but these errors were encountered: