Skip to content
Prev Previous commit
Next Next commit
fix test failures
import checkObjectExprEvaluation for test
  • Loading branch information
kiszk committed Apr 4, 2018
commit b1f08c1b23d901ac10486d32a8ac0e3489cdc3e2
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class ObjectExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
"toJavaDate", ObjectType(classOf[SQLDate]), 77777, DateTimeUtils.toJavaDate(77777)),
(DateTimeUtils.getClass, ObjectType(classOf[Timestamp]),
"toJavaTimestamp", ObjectType(classOf[SQLTimestamp]),
88888888L, DateTimeUtils.toJavaTimestamp(88888888L))
88888888.toLong, DateTimeUtils.toJavaTimestamp(88888888))
).foreach { case (cls, dataType, methodName, argType, arg, expected) =>
checkObjectExprEvaluation(StaticInvoke(cls, dataType, methodName,
Seq(BoundReference(0, argType, true))), expected, InternalRow.fromSeq(Seq(arg)))
Expand Down Expand Up @@ -216,6 +216,7 @@ class ObjectExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
checkEvaluation(createExternalRow, Row.fromSeq(Seq(1, "x")), InternalRow.fromSeq(Seq()))
}

// This is an alternative version of `checkEvaluation` to compare results
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is intentionally imported for testing from #20757

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this pr is merged first, I'll remove this in my pr.

// by scala values instead of catalyst values.
private def checkObjectExprEvaluation(
expression: => Expression, expected: Any, inputRow: InternalRow = EmptyRow): Unit = {
Expand Down