Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert test -0.0 equality for complex types
  • Loading branch information
tanelk committed Sep 4, 2020
commit d20a2ed46c07f50391b369bf8d4c268105f81246
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ object LiteralGenerator {
case BinaryType => binaryLiteralGen
case CalendarIntervalType => calendarIntervalLiterGen
case DecimalType.Fixed(precision, scale) => decimalLiteralGen(precision, scale)
case ArrayType(et, _) => randomGen(et).map(
lit => Literal.create(Array(lit.value), ArrayType(et)))
case dt => throw new IllegalArgumentException(s"not supported type $dt")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper {
DataTypeTestUtils.propertyCheckSupported.foreach { dt =>
checkConsistencyBetweenInterpretedAndCodegen(EqualTo, dt, dt)
checkConsistencyBetweenInterpretedAndCodegen(EqualNullSafe, dt, dt)

val arrayType = ArrayType(dt)
checkConsistencyBetweenInterpretedAndCodegen(EqualTo, arrayType, arrayType)
checkConsistencyBetweenInterpretedAndCodegen(EqualNullSafe, arrayType, arrayType)
}
}

Expand Down Expand Up @@ -500,32 +496,6 @@ class PredicateSuite extends SparkFunSuite with ExpressionEvalHelper {
checkEvaluation(EqualTo(infinity, infinity), true)
}

private def testEquality(literals: Seq[Literal]): Unit = {
literals.foreach(left => {
literals.foreach(right => {
checkEvaluation(EqualTo(left, right), true)
checkEvaluation(EqualNullSafe(left, right), true)

val leftArray = Literal.create(Array(left.value), ArrayType(left.dataType))
val rightArray = Literal.create(Array(right.value), ArrayType(right.dataType))
checkEvaluation(EqualTo(leftArray, rightArray), true)
checkEvaluation(EqualNullSafe(leftArray, rightArray), true)

val leftStruct = Literal.create(
Row(left.value), new StructType().add("a", left.dataType))
val rightStruct = Literal.create(
Row(right.value), new StructType().add("a", right.dataType))
checkEvaluation(EqualTo(leftStruct, rightStruct), true)
checkEvaluation(EqualNullSafe(leftStruct, rightStruct), true)
})
})
}

test("SPARK-32688: 0.0 and -0.0 should be equal") {
testEquality(Seq(Literal(0.0), Literal(-0.0)))
testEquality(Seq(Literal(0.0f), Literal(-0.0f)))
}

test("SPARK-22693: InSet should not use global variables") {
val ctx = new CodegenContext
InSet(Literal(1), Set(1, 2, 3, 4)).genCode(ctx)
Expand Down