Commit 821db48
committed
[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 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>1 parent c9fd14c commit 821db48
2 files changed
Lines changed: 11 additions & 2 deletions
File tree
- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders
- core/src/test/scala/org/apache/spark/sql
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1547 | 1547 | | |
1548 | 1548 | | |
1549 | 1549 | | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
1550 | 1559 | | |
1551 | 1560 | | |
1552 | 1561 | | |
| |||
0 commit comments