diff options
author | Takuya UESHIN <ueshin@happy-camper.st> | 2014-12-16 21:19:57 -0800 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2014-12-16 21:19:57 -0800 |
commit | ddc7ba31cb1062acb182293b2698b1b20ea56a46 (patch) | |
tree | 81d7be445cb2b0bbfceedb814016c596526eaf39 /sql/catalyst/src/test | |
parent | 0aa834adeaf4e31d63198e4197dc592790d3d0cc (diff) | |
download | spark-ddc7ba31cb1062acb182293b2698b1b20ea56a46.tar.gz spark-ddc7ba31cb1062acb182293b2698b1b20ea56a46.tar.bz2 spark-ddc7ba31cb1062acb182293b2698b1b20ea56a46.zip |
[SPARK-4720][SQL] Remainder should also return null if the divider is 0.
This is a follow-up of SPARK-4593 (#3443).
Author: Takuya UESHIN <ueshin@happy-camper.st>
Closes #3581 from ueshin/issues/SPARK-4720 and squashes the following commits:
c3959d4 [Takuya UESHIN] Make Remainder return null if the divider is 0.
Diffstat (limited to 'sql/catalyst/src/test')
-rw-r--r-- | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala index b030483223..1e371db315 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala @@ -179,6 +179,21 @@ class ExpressionEvaluationSuite extends FunSuite { checkEvaluation(Divide(Literal(null, IntegerType), Literal(null, IntegerType)), null) } + test("Remainder") { + checkEvaluation(Remainder(Literal(2), Literal(1)), 0) + checkEvaluation(Remainder(Literal(1.0), Literal(2.0)), 1.0) + checkEvaluation(Remainder(Literal(1), Literal(2)), 1) + checkEvaluation(Remainder(Literal(1), Literal(0)), null) + checkEvaluation(Remainder(Literal(1.0), Literal(0.0)), null) + checkEvaluation(Remainder(Literal(0.0), Literal(0.0)), null) + checkEvaluation(Remainder(Literal(0), Literal(null, IntegerType)), null) + checkEvaluation(Remainder(Literal(1), Literal(null, IntegerType)), null) + checkEvaluation(Remainder(Literal(null, IntegerType), Literal(0)), null) + checkEvaluation(Remainder(Literal(null, DoubleType), Literal(0.0)), null) + checkEvaluation(Remainder(Literal(null, IntegerType), Literal(1)), null) + checkEvaluation(Remainder(Literal(null, IntegerType), Literal(null, IntegerType)), null) + } + test("INSET") { val hS = HashSet[Any]() + 1 + 2 val nS = HashSet[Any]() + 1 + 2 + null |