This is an automated email from the ASF dual-hosted git repository.
gurwls223 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 1e7169ed8c1d [SPARK-53660][SQL][TESTS] Add unit test for Metadata
equality check
1e7169ed8c1d is described below
commit 1e7169ed8c1d27ab170bfb0eaa2e290c20afd433
Author: Yicong-Huang <[email protected]>
AuthorDate: Tue Sep 23 10:20:24 2025 +0900
[SPARK-53660][SQL][TESTS] Add unit test for Metadata equality check
### What changes were proposed in this commit?
This commit introduces a new unit test to verify the equality check of
`StructField` instances with different metadata configurations.
### Why are the changes needed?
To ensure that the equality check correctly identifies `StructField`
instances with empty and non-empty metadata as unequal.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Added a new unit test.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #52397 from Yicong-Huang/ES-1587692/fix-add-test.
Authored-by: Yicong-Huang <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
.../scala/org/apache/spark/sql/types/MetadataSuite.scala | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/types/MetadataSuite.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/types/MetadataSuite.scala
index e750bce1b94e..406a66af4806 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/types/MetadataSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/types/MetadataSuite.scala
@@ -79,6 +79,18 @@ class MetadataSuite extends SparkFunSuite {
intercept[NoSuchElementException](meta.getLong("no_such_key"))
}
+ test("Metadata equality check") {
+
+ // Create a StructField with empty metadata
+ val field1 = StructField("myField", IntegerType, nullable = true,
Metadata.empty)
+
+ // Create a StructField with non-empty metadata
+ val metadata = new MetadataBuilder().putString("description", "An integer
field").build()
+ val field2 = StructField("myField", IntegerType, nullable = true, metadata)
+
+ assert(!(field1 == field2), s"field1 = $field1, field2 = $field2")
+ }
+
test("Kryo serialization for expressions") {
val conf = new SparkConf()
val serializer = new KryoSerializer(conf).newInstance()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]