maropu commented on a change in pull request #30851:
URL: https://github.com/apache/spark/pull/30851#discussion_r546989218
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructField.scala
##########
@@ -82,17 +82,22 @@ case class StructField(
if (metadata.contains("comment")) Option(metadata.getString("comment"))
else None
}
+ private def getDDLComment: String = getComment()
Review comment:
nit: `private def getDDLComment = getComment()`
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructField.scala
##########
@@ -82,17 +82,22 @@ case class StructField(
if (metadata.contains("comment")) Option(metadata.getString("comment"))
else None
}
+ private def getDDLComment: String = getComment()
+ .map(escapeSingleQuotedString)
+ .map(" COMMENT '" + _ + "'")
+ .getOrElse("")
+
+ /**
+ * Returns a string containing a schema in SQL format. For example the
following value:
+ * `StructField("eventId", IntegerType)` will be converted to `eventId`: INT.
+ */
+ private[sql] def sql: String = s"${quoteIdentifier(name)}:
${dataType.sql}$getDDLComment"
Review comment:
nit: remove `: String`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]