diff options
author | petermaxlee <petermaxlee@gmail.com> | 2016-07-08 16:49:02 +0800 |
---|---|---|
committer | Wenchen Fan <wenchen@databricks.com> | 2016-07-08 16:49:02 +0800 |
commit | 8228b06303718b202be60b830df7dfddd97057b1 (patch) | |
tree | 2e3941ce7fb3c2b12ce501d32b3d37f8cee64a81 | |
parent | dff73bfa5e08c4c065584cfa9655a7839d28ad49 (diff) | |
download | spark-8228b06303718b202be60b830df7dfddd97057b1.tar.gz spark-8228b06303718b202be60b830df7dfddd97057b1.tar.bz2 spark-8228b06303718b202be60b830df7dfddd97057b1.zip |
[SPARK-16436][SQL] checkEvaluation should support NaN
## What changes were proposed in this pull request?
This small patch modifies ExpressionEvalHelper. checkEvaluation to support comparing NaN values for floating point comparisons.
## How was this patch tested?
This is a test harness change.
Author: petermaxlee <petermaxlee@gmail.com>
Closes #14103 from petermaxlee/SPARK-16436.
-rw-r--r-- | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala index e58a0df317..58e9d6f8bd 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala @@ -63,6 +63,10 @@ trait ExpressionEvalHelper extends GeneratorDrivenPropertyChecks { expected.asInstanceOf[Spread[Double]].isWithin(result) case (result: MapData, expected: MapData) => result.keyArray() == expected.keyArray() && result.valueArray() == expected.valueArray() + case (result: Double, expected: Double) => + if (expected.isNaN) result.isNaN else expected == result + case (result: Float, expected: Float) => + if (expected.isNaN) result.isNaN else expected == result case _ => result == expected } |