Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/6825#discussion_r32593520
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala
---
@@ -123,24 +123,54 @@ 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)
-
- checkEvaluation(MaxOf(Literal.create(null, IntegerType), 2), 2)
- checkEvaluation(MaxOf(2, Literal.create(null, IntegerType)), 2)
+ 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))
+ }
+ }
+
+ test("MaxOf for atomic type") {
+ checkEvaluation(MaxOf(true, false), true)
+ checkEvaluation(MaxOf("abc", "bcd"), "bcd")
+// checkEvaluation(MaxOf(Array(1.toByte, 2.toByte), Array(1.toByte,
3.toByte)),
+// Array(1.toByte, 3.toByte))
+ checkEvaluation(MaxOf(java.sql.Date.valueOf("2012-11-12"),
java.sql.Date.valueOf("2012-12-22")),
--- End diff --
All expressions only work with InternalRow, which only contain internal
types (int, long, UTF8String), no Date or Timestamp. so we don't need to test
Date/Timestamp, or use DateUtils.fromDate() to do the conversion before calling
expression on them.
---
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]