diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala index 77d40a5079cbb010fb32ad1cfbd7c43f18d813eb..4aebef92b983c4bec48ab581e0d2761c21ed4458 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala @@ -18,6 +18,7 @@ package org.apache.spark.sql.catalyst.expressions import org.apache.spark.sql.catalyst.InternalRow +import org.apache.spark.sql.catalyst.analysis.TypeCheckResult import org.apache.spark.sql.catalyst.expressions.codegen._ import org.apache.spark.sql.catalyst.util.TypeUtils import org.apache.spark.sql.types._ @@ -460,3 +461,123 @@ case class Pmod(left: Expression, right: Expression) extends BinaryArithmetic wi override def sql: String = s"$prettyName(${left.sql}, ${right.sql})" } + +/** + * A function that returns the least value of all parameters, skipping null values. + * It takes at least 2 parameters, and returns null iff all parameters are null. + */ +@ExpressionDescription( + usage = "_FUNC_(n1, ...) - Returns the least value of all parameters, skipping null values.") +case class Least(children: Seq[Expression]) extends Expression { + + override def nullable: Boolean = children.forall(_.nullable) + override def foldable: Boolean = children.forall(_.foldable) + + private lazy val ordering = TypeUtils.getInterpretedOrdering(dataType) + + override def checkInputDataTypes(): TypeCheckResult = { + if (children.length <= 1) { + TypeCheckResult.TypeCheckFailure(s"LEAST requires at least 2 arguments") + } else if (children.map(_.dataType).distinct.count(_ != NullType) > 1) { + TypeCheckResult.TypeCheckFailure( + s"The expressions should all have the same type," + + s" got LEAST(${children.map(_.dataType.simpleString).mkString(", ")}).") + } else { + TypeUtils.checkForOrderingExpr(dataType, "function " + prettyName) + } + } + + override def dataType: DataType = children.head.dataType + + override def eval(input: InternalRow): Any = { + children.foldLeft[Any](null)((r, c) => { + val evalc = c.eval(input) + if (evalc != null) { + if (r == null || ordering.lt(evalc, r)) evalc else r + } else { + r + } + }) + } + + override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { + val evalChildren = children.map(_.genCode(ctx)) + val first = evalChildren(0) + val rest = evalChildren.drop(1) + def updateEval(eval: ExprCode): String = { + s""" + ${eval.code} + if (!${eval.isNull} && (${ev.isNull} || + ${ctx.genGreater(dataType, ev.value, eval.value)})) { + ${ev.isNull} = false; + ${ev.value} = ${eval.value}; + } + """ + } + ev.copy(code = s""" + ${first.code} + boolean ${ev.isNull} = ${first.isNull}; + ${ctx.javaType(dataType)} ${ev.value} = ${first.value}; + ${rest.map(updateEval).mkString("\n")}""") + } +} + +/** + * A function that returns the greatest value of all parameters, skipping null values. + * It takes at least 2 parameters, and returns null iff all parameters are null. + */ +@ExpressionDescription( + usage = "_FUNC_(n1, ...) - Returns the greatest value of all parameters, skipping null values.") +case class Greatest(children: Seq[Expression]) extends Expression { + + override def nullable: Boolean = children.forall(_.nullable) + override def foldable: Boolean = children.forall(_.foldable) + + private lazy val ordering = TypeUtils.getInterpretedOrdering(dataType) + + override def checkInputDataTypes(): TypeCheckResult = { + if (children.length <= 1) { + TypeCheckResult.TypeCheckFailure(s"GREATEST requires at least 2 arguments") + } else if (children.map(_.dataType).distinct.count(_ != NullType) > 1) { + TypeCheckResult.TypeCheckFailure( + s"The expressions should all have the same type," + + s" got GREATEST(${children.map(_.dataType.simpleString).mkString(", ")}).") + } else { + TypeUtils.checkForOrderingExpr(dataType, "function " + prettyName) + } + } + + override def dataType: DataType = children.head.dataType + + override def eval(input: InternalRow): Any = { + children.foldLeft[Any](null)((r, c) => { + val evalc = c.eval(input) + if (evalc != null) { + if (r == null || ordering.gt(evalc, r)) evalc else r + } else { + r + } + }) + } + + override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { + val evalChildren = children.map(_.genCode(ctx)) + val first = evalChildren(0) + val rest = evalChildren.drop(1) + def updateEval(eval: ExprCode): String = { + s""" + ${eval.code} + if (!${eval.isNull} && (${ev.isNull} || + ${ctx.genGreater(dataType, eval.value, ev.value)})) { + ${ev.isNull} = false; + ${ev.value} = ${eval.value}; + } + """ + } + ev.copy(code = s""" + ${first.code} + boolean ${ev.isNull} = ${first.isNull}; + ${ctx.javaType(dataType)} ${ev.value} = ${first.value}; + ${rest.map(updateEval).mkString("\n")}""") + } +} diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala index 5f2585fc40b0617d1ce5359ad8bc3366a15a9193..1dd70bcfcfe8732ac8a0323fbb665faccbc78d79 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala @@ -20,7 +20,6 @@ package org.apache.spark.sql.catalyst.expressions import org.apache.spark.sql.catalyst.InternalRow import org.apache.spark.sql.catalyst.analysis.TypeCheckResult import org.apache.spark.sql.catalyst.expressions.codegen._ -import org.apache.spark.sql.catalyst.util.TypeUtils import org.apache.spark.sql.types._ // scalastyle:off line.size.limit @@ -279,124 +278,3 @@ object CaseKeyWhen { CaseWhen(cases, elseValue) } } - -/** - * A function that returns the least value of all parameters, skipping null values. - * It takes at least 2 parameters, and returns null iff all parameters are null. - */ -@ExpressionDescription( - usage = "_FUNC_(n1, ...) - Returns the least value of all parameters, skipping null values.") -case class Least(children: Seq[Expression]) extends Expression { - - override def nullable: Boolean = children.forall(_.nullable) - override def foldable: Boolean = children.forall(_.foldable) - - private lazy val ordering = TypeUtils.getInterpretedOrdering(dataType) - - override def checkInputDataTypes(): TypeCheckResult = { - if (children.length <= 1) { - TypeCheckResult.TypeCheckFailure(s"LEAST requires at least 2 arguments") - } else if (children.map(_.dataType).distinct.count(_ != NullType) > 1) { - TypeCheckResult.TypeCheckFailure( - s"The expressions should all have the same type," + - s" got LEAST(${children.map(_.dataType.simpleString).mkString(", ")}).") - } else { - TypeUtils.checkForOrderingExpr(dataType, "function " + prettyName) - } - } - - override def dataType: DataType = children.head.dataType - - override def eval(input: InternalRow): Any = { - children.foldLeft[Any](null)((r, c) => { - val evalc = c.eval(input) - if (evalc != null) { - if (r == null || ordering.lt(evalc, r)) evalc else r - } else { - r - } - }) - } - - override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { - val evalChildren = children.map(_.genCode(ctx)) - val first = evalChildren(0) - val rest = evalChildren.drop(1) - def updateEval(eval: ExprCode): String = { - s""" - ${eval.code} - if (!${eval.isNull} && (${ev.isNull} || - ${ctx.genGreater(dataType, ev.value, eval.value)})) { - ${ev.isNull} = false; - ${ev.value} = ${eval.value}; - } - """ - } - ev.copy(code = s""" - ${first.code} - boolean ${ev.isNull} = ${first.isNull}; - ${ctx.javaType(dataType)} ${ev.value} = ${first.value}; - ${rest.map(updateEval).mkString("\n")}""") - } -} - -/** - * A function that returns the greatest value of all parameters, skipping null values. - * It takes at least 2 parameters, and returns null iff all parameters are null. - */ -@ExpressionDescription( - usage = "_FUNC_(n1, ...) - Returns the greatest value of all parameters, skipping null values.") -case class Greatest(children: Seq[Expression]) extends Expression { - - override def nullable: Boolean = children.forall(_.nullable) - override def foldable: Boolean = children.forall(_.foldable) - - private lazy val ordering = TypeUtils.getInterpretedOrdering(dataType) - - override def checkInputDataTypes(): TypeCheckResult = { - if (children.length <= 1) { - TypeCheckResult.TypeCheckFailure(s"GREATEST requires at least 2 arguments") - } else if (children.map(_.dataType).distinct.count(_ != NullType) > 1) { - TypeCheckResult.TypeCheckFailure( - s"The expressions should all have the same type," + - s" got GREATEST(${children.map(_.dataType.simpleString).mkString(", ")}).") - } else { - TypeUtils.checkForOrderingExpr(dataType, "function " + prettyName) - } - } - - override def dataType: DataType = children.head.dataType - - override def eval(input: InternalRow): Any = { - children.foldLeft[Any](null)((r, c) => { - val evalc = c.eval(input) - if (evalc != null) { - if (r == null || ordering.gt(evalc, r)) evalc else r - } else { - r - } - }) - } - - override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { - val evalChildren = children.map(_.genCode(ctx)) - val first = evalChildren(0) - val rest = evalChildren.drop(1) - def updateEval(eval: ExprCode): String = { - s""" - ${eval.code} - if (!${eval.isNull} && (${ev.isNull} || - ${ctx.genGreater(dataType, eval.value, ev.value)})) { - ${ev.isNull} = false; - ${ev.value} = ${eval.value}; - } - """ - } - ev.copy(code = s""" - ${first.code} - boolean ${ev.isNull} = ${first.isNull}; - ${ctx.javaType(dataType)} ${ev.value} = ${first.value}; - ${rest.map(updateEval).mkString("\n")}""") - } -} - diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala index 321d820b70f4b72a3306380e5f351d67ea8ec8ca..687387507e2144bacb51f2457e7dd4ae3bd6d165 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala @@ -17,7 +17,11 @@ package org.apache.spark.sql.catalyst.expressions +import java.sql.{Date, Timestamp} + import org.apache.spark.SparkFunSuite +import org.apache.spark.sql.catalyst.InternalRow +import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.TypeCheckFailure import org.apache.spark.sql.catalyst.dsl.expressions._ import org.apache.spark.sql.types._ @@ -211,4 +215,107 @@ class ArithmeticExpressionSuite extends SparkFunSuite with ExpressionEvalHelper checkEvaluation(Pmod(positiveInt, negativeInt), positiveInt) checkEvaluation(Pmod(positiveLong, negativeLong), positiveLong) } + + test("function least") { + val row = create_row(1, 2, "a", "b", "c") + val c1 = 'a.int.at(0) + val c2 = 'a.int.at(1) + val c3 = 'a.string.at(2) + val c4 = 'a.string.at(3) + val c5 = 'a.string.at(4) + checkEvaluation(Least(Seq(c4, c3, c5)), "a", row) + checkEvaluation(Least(Seq(c1, c2)), 1, row) + checkEvaluation(Least(Seq(c1, c2, Literal(-1))), -1, row) + checkEvaluation(Least(Seq(c4, c5, c3, c3, Literal("a"))), "a", row) + + val nullLiteral = Literal.create(null, IntegerType) + checkEvaluation(Least(Seq(nullLiteral, nullLiteral)), null) + checkEvaluation(Least(Seq(Literal(null), Literal(null))), null, InternalRow.empty) + checkEvaluation(Least(Seq(Literal(-1.0), Literal(2.5))), -1.0, InternalRow.empty) + checkEvaluation(Least(Seq(Literal(-1), Literal(2))), -1, InternalRow.empty) + checkEvaluation( + Least(Seq(Literal((-1.0).toFloat), Literal(2.5.toFloat))), (-1.0).toFloat, InternalRow.empty) + checkEvaluation( + Least(Seq(Literal(Long.MaxValue), Literal(Long.MinValue))), Long.MinValue, InternalRow.empty) + checkEvaluation(Least(Seq(Literal(1.toByte), Literal(2.toByte))), 1.toByte, InternalRow.empty) + checkEvaluation( + Least(Seq(Literal(1.toShort), Literal(2.toByte.toShort))), 1.toShort, InternalRow.empty) + checkEvaluation(Least(Seq(Literal("abc"), Literal("aaaa"))), "aaaa", InternalRow.empty) + checkEvaluation(Least(Seq(Literal(true), Literal(false))), false, InternalRow.empty) + checkEvaluation( + Least(Seq( + Literal(BigDecimal("1234567890987654321123456")), + Literal(BigDecimal("1234567890987654321123458")))), + BigDecimal("1234567890987654321123456"), InternalRow.empty) + checkEvaluation( + Least(Seq(Literal(Date.valueOf("2015-01-01")), Literal(Date.valueOf("2015-07-01")))), + Date.valueOf("2015-01-01"), InternalRow.empty) + checkEvaluation( + Least(Seq( + Literal(Timestamp.valueOf("2015-07-01 08:00:00")), + Literal(Timestamp.valueOf("2015-07-01 10:00:00")))), + Timestamp.valueOf("2015-07-01 08:00:00"), InternalRow.empty) + + // Type checking error + assert( + Least(Seq(Literal(1), Literal("1"))).checkInputDataTypes() == + TypeCheckFailure("The expressions should all have the same type, " + + "got LEAST(int, string).")) + + DataTypeTestUtils.ordered.foreach { dt => + checkConsistencyBetweenInterpretedAndCodegen(Least, dt, 2) + } + } + + test("function greatest") { + val row = create_row(1, 2, "a", "b", "c") + val c1 = 'a.int.at(0) + val c2 = 'a.int.at(1) + val c3 = 'a.string.at(2) + val c4 = 'a.string.at(3) + val c5 = 'a.string.at(4) + checkEvaluation(Greatest(Seq(c4, c5, c3)), "c", row) + checkEvaluation(Greatest(Seq(c2, c1)), 2, row) + checkEvaluation(Greatest(Seq(c1, c2, Literal(2))), 2, row) + checkEvaluation(Greatest(Seq(c4, c5, c3, Literal("ccc"))), "ccc", row) + + val nullLiteral = Literal.create(null, IntegerType) + checkEvaluation(Greatest(Seq(nullLiteral, nullLiteral)), null) + checkEvaluation(Greatest(Seq(Literal(null), Literal(null))), null, InternalRow.empty) + checkEvaluation(Greatest(Seq(Literal(-1.0), Literal(2.5))), 2.5, InternalRow.empty) + checkEvaluation(Greatest(Seq(Literal(-1), Literal(2))), 2, InternalRow.empty) + checkEvaluation( + Greatest(Seq(Literal((-1.0).toFloat), Literal(2.5.toFloat))), 2.5.toFloat, InternalRow.empty) + checkEvaluation(Greatest( + Seq(Literal(Long.MaxValue), Literal(Long.MinValue))), Long.MaxValue, InternalRow.empty) + checkEvaluation( + Greatest(Seq(Literal(1.toByte), Literal(2.toByte))), 2.toByte, InternalRow.empty) + checkEvaluation( + Greatest(Seq(Literal(1.toShort), Literal(2.toByte.toShort))), 2.toShort, InternalRow.empty) + checkEvaluation(Greatest(Seq(Literal("abc"), Literal("aaaa"))), "abc", InternalRow.empty) + checkEvaluation(Greatest(Seq(Literal(true), Literal(false))), true, InternalRow.empty) + checkEvaluation( + Greatest(Seq( + Literal(BigDecimal("1234567890987654321123456")), + Literal(BigDecimal("1234567890987654321123458")))), + BigDecimal("1234567890987654321123458"), InternalRow.empty) + checkEvaluation(Greatest( + Seq(Literal(Date.valueOf("2015-01-01")), Literal(Date.valueOf("2015-07-01")))), + Date.valueOf("2015-07-01"), InternalRow.empty) + checkEvaluation( + Greatest(Seq( + Literal(Timestamp.valueOf("2015-07-01 08:00:00")), + Literal(Timestamp.valueOf("2015-07-01 10:00:00")))), + Timestamp.valueOf("2015-07-01 10:00:00"), InternalRow.empty) + + // Type checking error + assert( + Greatest(Seq(Literal(1), Literal("1"))).checkInputDataTypes() == + TypeCheckFailure("The expressions should all have the same type, " + + "got GREATEST(int, string).")) + + DataTypeTestUtils.ordered.foreach { dt => + checkConsistencyBetweenInterpretedAndCodegen(Greatest, dt, 2) + } + } } diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ConditionalExpressionSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ConditionalExpressionSuite.scala index 36185b8c637a1c43f46545682d4537446518fa24..b04ea418fb529530d07b8c7e918deedd37d6a0ba 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ConditionalExpressionSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ConditionalExpressionSuite.scala @@ -17,11 +17,7 @@ package org.apache.spark.sql.catalyst.expressions -import java.sql.{Date, Timestamp} - import org.apache.spark.SparkFunSuite -import org.apache.spark.sql.catalyst.InternalRow -import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.TypeCheckFailure import org.apache.spark.sql.catalyst.dsl.expressions._ import org.apache.spark.sql.types._ @@ -141,107 +137,4 @@ class ConditionalExpressionSuite extends SparkFunSuite with ExpressionEvalHelper checkEvaluation(CaseKeyWhen(c6, Seq(c5, c2, c4, c3)), null, row) checkEvaluation(CaseKeyWhen(literalNull, Seq(c2, c5, c1, c6)), null, row) } - - test("function least") { - val row = create_row(1, 2, "a", "b", "c") - val c1 = 'a.int.at(0) - val c2 = 'a.int.at(1) - val c3 = 'a.string.at(2) - val c4 = 'a.string.at(3) - val c5 = 'a.string.at(4) - checkEvaluation(Least(Seq(c4, c3, c5)), "a", row) - checkEvaluation(Least(Seq(c1, c2)), 1, row) - checkEvaluation(Least(Seq(c1, c2, Literal(-1))), -1, row) - checkEvaluation(Least(Seq(c4, c5, c3, c3, Literal("a"))), "a", row) - - val nullLiteral = Literal.create(null, IntegerType) - checkEvaluation(Least(Seq(nullLiteral, nullLiteral)), null) - checkEvaluation(Least(Seq(Literal(null), Literal(null))), null, InternalRow.empty) - checkEvaluation(Least(Seq(Literal(-1.0), Literal(2.5))), -1.0, InternalRow.empty) - checkEvaluation(Least(Seq(Literal(-1), Literal(2))), -1, InternalRow.empty) - checkEvaluation( - Least(Seq(Literal((-1.0).toFloat), Literal(2.5.toFloat))), (-1.0).toFloat, InternalRow.empty) - checkEvaluation( - Least(Seq(Literal(Long.MaxValue), Literal(Long.MinValue))), Long.MinValue, InternalRow.empty) - checkEvaluation(Least(Seq(Literal(1.toByte), Literal(2.toByte))), 1.toByte, InternalRow.empty) - checkEvaluation( - Least(Seq(Literal(1.toShort), Literal(2.toByte.toShort))), 1.toShort, InternalRow.empty) - checkEvaluation(Least(Seq(Literal("abc"), Literal("aaaa"))), "aaaa", InternalRow.empty) - checkEvaluation(Least(Seq(Literal(true), Literal(false))), false, InternalRow.empty) - checkEvaluation( - Least(Seq( - Literal(BigDecimal("1234567890987654321123456")), - Literal(BigDecimal("1234567890987654321123458")))), - BigDecimal("1234567890987654321123456"), InternalRow.empty) - checkEvaluation( - Least(Seq(Literal(Date.valueOf("2015-01-01")), Literal(Date.valueOf("2015-07-01")))), - Date.valueOf("2015-01-01"), InternalRow.empty) - checkEvaluation( - Least(Seq( - Literal(Timestamp.valueOf("2015-07-01 08:00:00")), - Literal(Timestamp.valueOf("2015-07-01 10:00:00")))), - Timestamp.valueOf("2015-07-01 08:00:00"), InternalRow.empty) - - // Type checking error - assert( - Least(Seq(Literal(1), Literal("1"))).checkInputDataTypes() == - TypeCheckFailure("The expressions should all have the same type, " + - "got LEAST(int, string).")) - - DataTypeTestUtils.ordered.foreach { dt => - checkConsistencyBetweenInterpretedAndCodegen(Least, dt, 2) - } - } - - test("function greatest") { - val row = create_row(1, 2, "a", "b", "c") - val c1 = 'a.int.at(0) - val c2 = 'a.int.at(1) - val c3 = 'a.string.at(2) - val c4 = 'a.string.at(3) - val c5 = 'a.string.at(4) - checkEvaluation(Greatest(Seq(c4, c5, c3)), "c", row) - checkEvaluation(Greatest(Seq(c2, c1)), 2, row) - checkEvaluation(Greatest(Seq(c1, c2, Literal(2))), 2, row) - checkEvaluation(Greatest(Seq(c4, c5, c3, Literal("ccc"))), "ccc", row) - - val nullLiteral = Literal.create(null, IntegerType) - checkEvaluation(Greatest(Seq(nullLiteral, nullLiteral)), null) - checkEvaluation(Greatest(Seq(Literal(null), Literal(null))), null, InternalRow.empty) - checkEvaluation(Greatest(Seq(Literal(-1.0), Literal(2.5))), 2.5, InternalRow.empty) - checkEvaluation(Greatest(Seq(Literal(-1), Literal(2))), 2, InternalRow.empty) - checkEvaluation( - Greatest(Seq(Literal((-1.0).toFloat), Literal(2.5.toFloat))), 2.5.toFloat, InternalRow.empty) - checkEvaluation(Greatest( - Seq(Literal(Long.MaxValue), Literal(Long.MinValue))), Long.MaxValue, InternalRow.empty) - checkEvaluation( - Greatest(Seq(Literal(1.toByte), Literal(2.toByte))), 2.toByte, InternalRow.empty) - checkEvaluation( - Greatest(Seq(Literal(1.toShort), Literal(2.toByte.toShort))), 2.toShort, InternalRow.empty) - checkEvaluation(Greatest(Seq(Literal("abc"), Literal("aaaa"))), "abc", InternalRow.empty) - checkEvaluation(Greatest(Seq(Literal(true), Literal(false))), true, InternalRow.empty) - checkEvaluation( - Greatest(Seq( - Literal(BigDecimal("1234567890987654321123456")), - Literal(BigDecimal("1234567890987654321123458")))), - BigDecimal("1234567890987654321123458"), InternalRow.empty) - checkEvaluation(Greatest( - Seq(Literal(Date.valueOf("2015-01-01")), Literal(Date.valueOf("2015-07-01")))), - Date.valueOf("2015-07-01"), InternalRow.empty) - checkEvaluation( - Greatest(Seq( - Literal(Timestamp.valueOf("2015-07-01 08:00:00")), - Literal(Timestamp.valueOf("2015-07-01 10:00:00")))), - Timestamp.valueOf("2015-07-01 10:00:00"), InternalRow.empty) - - // Type checking error - assert( - Greatest(Seq(Literal(1), Literal("1"))).checkInputDataTypes() == - TypeCheckFailure("The expressions should all have the same type, " + - "got GREATEST(int, string).")) - - DataTypeTestUtils.ordered.foreach { dt => - checkConsistencyBetweenInterpretedAndCodegen(Greatest, dt, 2) - } - } }