Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21106#discussion_r188913856
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvalHelper.scala
---
@@ -196,39 +197,33 @@ trait ExpressionEvalHelper extends
GeneratorDrivenPropertyChecks {
expression: Expression,
expected: Any,
inputRow: InternalRow = EmptyRow): Unit = {
- checkEvaluationWithUnsafeProjection(expression, expected, inputRow,
UnsafeProjection)
- checkEvaluationWithUnsafeProjection(expression, expected, inputRow,
InterpretedUnsafeProjection)
- }
-
- protected def checkEvaluationWithUnsafeProjection(
- expression: Expression,
- expected: Any,
- inputRow: InternalRow,
- factory: UnsafeProjectionCreator): Unit = {
- val unsafeRow = evaluateWithUnsafeProjection(expression, inputRow,
factory)
- val input = if (inputRow == EmptyRow) "" else s", input: $inputRow"
-
- if (expected == null) {
- if (!unsafeRow.isNullAt(0)) {
- val expectedRow = InternalRow(expected, expected)
- fail("Incorrect evaluation in unsafe mode: " +
- s"$expression, actual: $unsafeRow, expected: $expectedRow$input")
- }
- } else {
- val lit = InternalRow(expected, expected)
- val expectedRow =
- factory.create(Array(expression.dataType,
expression.dataType)).apply(lit)
- if (unsafeRow != expectedRow) {
- fail("Incorrect evaluation in unsafe mode: " +
- s"$expression, actual: $unsafeRow, expected: $expectedRow$input")
+ for (fallbackMode <- Seq("CODEGEN_ONLY", "NO_CODEGEN")) {
--- End diff --
let's not hardcode it, call `CodegenObjectFactoryMode.xxx` instead
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]