This is an automated email from the ASF dual-hosted git repository.

uros-b pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new ced139fdfcd4 [SPARK-58343][SQL][TEST] Add unit test for 
TypeUtils.typeWithProperEquals
ced139fdfcd4 is described below

commit ced139fdfcd49331ad04b2bc6bb89352118bc67c
Author: Uros Bojanic <[email protected]>
AuthorDate: Sun Jul 26 10:43:06 2026 +0000

    [SPARK-58343][SQL][TEST] Add unit test for TypeUtils.typeWithProperEquals
    
    ### What changes were proposed in this pull request?
    Adds a focused unit test for `TypeUtils.typeWithProperEquals` in 
`TypeUtilsSuite`. The predicate was previously only referenced in a code 
comment, never directly asserted. The test covers atomic types (true), 
UTF8_BINARY string (true), a collated string (false), binary type (false), and 
complex types (false).
    
    ### Why are the changes needed?
    `typeWithProperEquals` gates several expressions (higher-order functions, 
complex-type extractors, collection ops, PivotFirst) but had no direct 
coverage. The added assertions pin its contract, including the special-cased 
BinaryType and collation branches.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    This PR is the test. `build/sbt "catalyst/testOnly *TypeUtilsSuite"`.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    Generated-by: Claude Code (Opus 4.8)
    
    Closes #57518 from uros-b/test-typeutils-properequals.
    
    Lead-authored-by: Uros Bojanic <[email protected]>
    Co-authored-by: Uros Bojanic <[email protected]>
    Signed-off-by: Uros Bojanic <[email protected]>
---
 .../spark/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 6c5afd30d8e1..246531968ac8 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)
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to