Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/6825#discussion_r32636034
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala
---
@@ -123,24 +124,40 @@ class ArithmeticExpressionSuite extends SparkFunSuite
with ExpressionEvalHelper
}
}
- test("MaxOf") {
- checkEvaluation(MaxOf(1, 2), 2)
- checkEvaluation(MaxOf(2, 1), 2)
- checkEvaluation(MaxOf(1L, 2L), 2L)
- checkEvaluation(MaxOf(2L, 1L), 2L)
+ test("MaxOf basic") {
+ testNumericDataTypes { convert =>
+ val small = Literal(convert(1))
+ val large = Literal(convert(2))
+ checkEvaluation(MaxOf(small, large), convert(2))
+ checkEvaluation(MaxOf(large, small), convert(2))
+ checkEvaluation(MaxOf(Literal.create(null, small.dataType), large),
convert(2))
+ checkEvaluation(MaxOf(large, Literal.create(null, small.dataType)),
convert(2))
+ }
+ }
- checkEvaluation(MaxOf(Literal.create(null, IntegerType), 2), 2)
- checkEvaluation(MaxOf(2, Literal.create(null, IntegerType)), 2)
+ test("MaxOf for atomic type") {
+ checkEvaluation(MaxOf(true, false), true)
+ checkEvaluation(MaxOf("abc", "bcd"), UTF8String.fromString("bcd"))
+// checkEvaluation(MaxOf(Array(1.toByte, 2.toByte), Array(1.toByte,
3.toByte)),
+// Array(1.toByte, 3.toByte))
--- End diff --
This test will fail at `checkEvaluationWithGeneratedProjection` for hash
code not equal. I'm not sure why we want to compare the hash code, and I looked
into the hashCode implementation of `GenericRow` and `Row`, they are different.
Does anyone know why we want to compare the hash code there?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]