Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/13860#discussion_r68491125
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructField.scala ---
@@ -51,4 +51,35 @@ case class StructField(
("nullable" -> nullable) ~
("metadata" -> metadata.jsonValue)
}
+
+ /**
+ * Updates the StructField with a new comment value.
+ */
+ def withComment(comment: String): StructField = {
+ val newMetadata = new MetadataBuilder()
+ .withMetadata(metadata)
+ .putString("comment", comment)
+ .build()
+ copy(metadata = newMetadata)
+ }
+
+ /**
+ * Return the comment of this StructField.
+ */
+ def getComment(): Option[String] = {
+ if (metadata.contains("comment"))
Option(metadata.getString("comment")) else None
+ }
+}
+
+object StructField {
+ def apply(
--- End diff --
uh, I see what you want. Let me change it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]