[SPARK-28369][SQL] Honor spark.sql.decimalOperations.nullOnOverflow in ScalaUDF result#25144
Closed
mgaido91 wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-28369][SQL] Honor spark.sql.decimalOperations.nullOnOverflow in ScalaUDF result#25144mgaido91 wants to merge 1 commit intoapache:masterfrom
mgaido91 wants to merge 1 commit intoapache:masterfrom
Conversation
…n ScalaUDF result
|
Test build #107630 has finished for PR 25144 at commit
|
viirya
reviewed
Jul 15, 2019
| throw new AnalysisException(s"Overflow when setting precision to $newPrecision") | ||
| } | ||
| res | ||
| toPrecision(newPrecision, 0, ROUND_CEILING, nullOnOverflow = false) |
Member
There was a problem hiding this comment.
This throws exception on overflow, I think it preserves current behavior, but don't we want to respect decimalOperationsNullOnOverflow here too?
Contributor
Author
There was a problem hiding this comment.
well, I don't think that is really an issue here. I mean, I see no way ceil and floor can produce an overflow, they rather reduce the needed precision. So I think this case cannot really happen and it is fine to just throw an exception
Contributor
Author
Contributor
|
thanks, merging to master! |
Contributor
Author
|
thanks @cloud-fan @dongjoon-hyun @viirya! |
yiheng
pushed a commit
to yiheng/spark
that referenced
this pull request
Jul 24, 2019
…n ScalaUDF result ## What changes were proposed in this pull request? When a `ScalaUDF` returns a value which overflows, currently it returns null regardless of the value of the config `spark.sql.decimalOperations.nullOnOverflow`. The PR makes it respect the above-mentioned config and behave accordingly. ## How was this patch tested? added UT Closes apache#25144 from mgaido91/SPARK-28369. Authored-by: Marco Gaido <marcogaido91@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When a
ScalaUDFreturns a value which overflows, currently it returns null regardless of the value of the configspark.sql.decimalOperations.nullOnOverflow.The PR makes it respect the above-mentioned config and behave accordingly.
How was this patch tested?
added UT