-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-52848][SQL] Avoid cast to Double
in casting TIME/TIMESTAMP to DECIMAL
#51539
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -810,7 +810,7 @@ class CastWithAnsiOnSuite extends CastSuiteBase with QueryErrorsBase { | |
), | ||
condition = "NUMERIC_VALUE_OUT_OF_RANGE.WITH_SUGGESTION", | ||
parameters = Map( | ||
"value" -> "86399.123456", | ||
"value" -> "86399.123456000", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to the previous comment, I think that these error messages become a bit counter-intuitive for users? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems it is counter-intuitive independently from the scale. No doubt there is a room for error improvement. We could print the original value of the source type like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is a good argument. And yes, source type is likely the best fit here, at least from the user perspective I think. |
||
"precision" -> "2", | ||
"scale" -> "0", | ||
"config" -> """"spark.sql.ansi.enabled"""" | ||
|
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.
Are we really sure that we always want to use fixed precision and scale here?
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 have to use fixed
scale
at lest to get correct decimal. Andprecision
should guarantee that we cover full input range.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.
Yeah, that part is alright. However, as a consequence of this, we also get fixed precision/scale in error messages (e.g. #51539 (comment)). Let's continue the discussion over there.