GitHub user mgaido91 opened a pull request:
https://github.com/apache/spark/pull/23233
[SPARK-26233][SQL][BACKPORT-2.3] CheckOverflow when encoding a decimal value
## What changes were proposed in this pull request?
When we encode a Decimal from external source we don't check for overflow.
That method is useful not only in order to enforce that we can represent the
correct value in the specified range, but it also changes the underlying data
to the right precision/scale. Since in our code generation we assume that a
decimal has exactly the same precision and scale of its data type, missing to
enforce it can lead to corrupted output/results when there are subsequent
transformations.
## How was this patch tested?
added UT
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mgaido91/spark SPARK-26233_2.3
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/23233.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #23233
commit a1e77445c2675137fbcddf73181c47469f159dbf
Author: Marco Gaido
Date: 2018-12-04T18:33:27Z
[SPARK-26233][SQL] CheckOverflow when encoding a decimal value
When we encode a Decimal from external source we don't check for overflow.
That method is useful not only in order to enforce that we can represent the
correct value in the specified range, but it also changes the underlying data
to the right precision/scale. Since in our code generation we assume that a
decimal has exactly the same precision and scale of its data type, missing to
enforce it can lead to corrupted output/results when there are subsequent
transformations.
added UT
Closes #23210 from mgaido91/SPARK-26233.
Authored-by: Marco Gaido
Signed-off-by: Dongjoon Hyun
---
-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org