Commit 6888089
[SPARK-36926][3.2][SQL] Decimal average mistakenly overflow
backport #34180
### What changes were proposed in this pull request?
This bug was introduced by #33177
When checking overflow of the sum value in the average function, we should use the `sumDataType` instead of the input decimal type.
### Why are the changes needed?
fix a regression
### Does this PR introduce _any_ user-facing change?
Yes, the result was wrong before this PR.
### How was this patch tested?
a new test
Closes #34193 from cloud-fan/bug.
Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>1 parent c542297 commit 6888089
File tree
2 files changed
+8
-2
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate
- core/src/test/scala/org/apache/spark/sql
2 files changed
+8
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1416 | 1416 | | |
1417 | 1417 | | |
1418 | 1418 | | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1419 | 1425 | | |
1420 | 1426 | | |
1421 | 1427 | | |
| |||
0 commit comments