liangz1 commented on a change in pull request #33853:
URL: https://github.com/apache/spark/pull/33853#discussion_r700708369
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
##########
@@ -702,6 +702,18 @@ class DataFrameSuite extends QueryTest
"The size of column names: 2 isn't equal to the size of metadata
elements: 1"))
}
+ test("SPARK-36642: withMetadata: replace metadata of a column") {
+ val metadata = new MetadataBuilder().putLong("key", 1L).build()
+ val df1 = sparkContext.parallelize(Array(1, 2, 3)).toDF("x")
+ val df2 = df1.withMetadata("x", metadata)
+ assert(df2.schema(0).metadata === metadata)
+
Review comment:
I think that might not be necessary because by default (`df1`), column
`"x"` has a metadata `Metadata.empty`, so the new metadata is already
"replacing" the existing default metadata.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]