-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
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
Fix: Support for e notation using existing parse_decimal in string to decimal conversion #6905
base: main
Are you sure you want to change the base?
Fix: Support for e notation using existing parse_decimal in string to decimal conversion #6905
Conversation
error message changed.
@andygrove @viirya @tustvold please take a first look. The one failing test will be fixed once I add the rounding logic in parse-e-notation function. |
.and_then(|v| T::validate_decimal_precision(v, precision).map(|_| v)) | ||
parse_decimal::<T>(v, precision, scale).map_err(|_| { | ||
ArrowError::CastError(format!( | ||
"Cannot cast string '{}' to decimal type of precision {} and scale {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T:DATA_TYPE shows default Decimal(38,10) or Decimal256(76,..) in the error message, hiding the precision and scale provided for cast.
@@ -230,6 +231,7 @@ where | |||
)?)) | |||
} | |||
|
|||
#[allow(dead_code)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails in clippy, hence added #[allow(dead_code)]
, there is no use, if required we can remove it and cover existing tests with parse_decimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove this and port the tests, to ensure we aren't losing test coverage / accidentally changing behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be a breaking API change, as it changes the rounding behaviour of parse_decimal?
Clippy did not complain and tests are passing, except one which I'm working on - rounding for e-notation. Would any others build task catch it? |
Which issue does this PR close?
Closes #. apache/datafusion#10315
Rationale for this change
What changes are included in this PR?
Completed :
Pending :
Are there any user-facing changes?