diff options
author | jiangxingbo <jiangxb1987@gmail.com> | 2016-09-18 16:04:37 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-09-18 16:04:37 +0100 |
commit | 5d3f4615f8d0a19b97cde5ae603f74aef2cc2fd2 (patch) | |
tree | 72af3a5ed8691b346a07ece1acb49926b5d7ad98 /sbin | |
parent | 3fe630d314cf50d69868b7707ac8d8d2027080b8 (diff) | |
download | spark-5d3f4615f8d0a19b97cde5ae603f74aef2cc2fd2.tar.gz spark-5d3f4615f8d0a19b97cde5ae603f74aef2cc2fd2.tar.bz2 spark-5d3f4615f8d0a19b97cde5ae603f74aef2cc2fd2.zip |
[SPARK-17506][SQL] Improve the check double values equality rule.
## What changes were proposed in this pull request?
In `ExpressionEvalHelper`, we check the equality between two double values by comparing whether the expected value is within the range [target - tolerance, target + tolerance], but this can cause a negative false when the compared numerics are very large.
Beforeļ¼
```
val1 = 1.6358558070241E306
val2 = 1.6358558070240974E306
ExpressionEvalHelper.compareResults(val1, val2)
false
```
In fact, `val1` and `val2` are but with different precisions, we should tolerant this case by comparing with percentage range, eg.,expected is within range [target - target * tolerance_percentage, target + target * tolerance_percentage].
After:
```
val1 = 1.6358558070241E306
val2 = 1.6358558070240974E306
ExpressionEvalHelper.compareResults(val1, val2)
true
```
## How was this patch tested?
Exsiting testcases.
Author: jiangxingbo <jiangxb1987@gmail.com>
Closes #15059 from jiangxb1987/deq.
Diffstat (limited to 'sbin')
0 files changed, 0 insertions, 0 deletions