From 393dad40b40d58ec97b0aedf1939a99a2a2146ec Mon Sep 17 00:00:00 2001 From: Uros Bojanic Date: Sat, 25 Jul 2026 00:09:46 +0000 Subject: [PATCH] Initial commit --- .../sql/catalyst/util/TypeUtilsSuite.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/TypeUtilsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/TypeUtilsSuite.scala index 6c5afd30d8e15..246531968ac81 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/TypeUtilsSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/TypeUtilsSuite.scala @@ -48,6 +48,24 @@ class TypeUtilsSuite extends SparkFunSuite with SQLHelper { ArrayType(StringType, containsNull = false) :: Nil) } + test("typeWithProperEquals") { + // Atomic types have proper equals. + assert(TypeUtils.typeWithProperEquals(IntegerType)) + assert(TypeUtils.typeWithProperEquals(DoubleType)) + assert(TypeUtils.typeWithProperEquals(BooleanType)) + assert(TypeUtils.typeWithProperEquals(TimestampType)) + // UTF8_BINARY strings support binary equality. + assert(TypeUtils.typeWithProperEquals(StringType)) + // Non-UTF8_BINARY (collated) strings do not support binary equality. + assert(!TypeUtils.typeWithProperEquals(StringType("UTF8_LCASE"))) + // Binary type does not have proper equals. + assert(!TypeUtils.typeWithProperEquals(BinaryType)) + // Complex types are not covered. + assert(!TypeUtils.typeWithProperEquals(ArrayType(IntegerType))) + assert(!TypeUtils.typeWithProperEquals(MapType(StringType, IntegerType))) + assert(!TypeUtils.typeWithProperEquals(new StructType().add("a", IntegerType))) + } + test("TIMESTAMP_NANOS_TYPES_ENABLED defaults to Utils.isTesting") { assert(SQLConf.get.timestampNanosTypesEnabled === Utils.isTesting) }