Skip to content

Commit 36236a5

Browse files
committed
add test cases
1 parent 6f5716f commit 36236a5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ class ExpressionEvaluationSuite extends FunSuite {
149149
checkEvaluation(In(Literal(1), Seq(Literal(1), Literal(2))) && In(Literal(2), Seq(Literal(1), Literal(2))), true)
150150
}
151151

152+
test("Divide") {
153+
checkEvaluation(Divide(Literal(2), Literal(1)), 2)
154+
checkEvaluation(Divide(Literal(1.0), Literal(2.0)), 0.5)
155+
checkEvaluation(Divide(Literal(1), Literal(2)), 0)
156+
checkEvaluation(Divide(Literal(1), Literal(0)), null)
157+
checkEvaluation(Divide(Literal(1.0), Literal(0.0)), null)
158+
checkEvaluation(Divide(Literal(0.0), Literal(0.0)), null)
159+
checkEvaluation(Divide(Literal(0), Literal(null, IntegerType)), null)
160+
checkEvaluation(Divide(Literal(1), Literal(null, IntegerType)), null)
161+
checkEvaluation(Divide(Literal(null, IntegerType), Literal(0)), null)
162+
checkEvaluation(Divide(Literal(null, DoubleType), Literal(0.0)), null)
163+
checkEvaluation(Divide(Literal(null, IntegerType), Literal(1)), null)
164+
checkEvaluation(Divide(Literal(null, IntegerType), Literal(null, IntegerType)), null)
165+
}
166+
152167
test("INSET") {
153168
val hS = HashSet[Any]() + 1 + 2
154169
val nS = HashSet[Any]() + 1 + 2 + null

0 commit comments

Comments
 (0)