You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/19 13:09:15 UTC
[GitHub] [spark] maropu commented on a change in pull request #30851: [SPARK-33846][SQL] Include Comments for a nested schema in StructType.toDDL
maropu commented on a change in pull request #30851:
URL: https://github.com/apache/spark/pull/30851#discussion_r546236591
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/types/StructTypeSuite.scala
##########
@@ -73,6 +73,15 @@ class StructTypeSuite extends SparkFunSuite with SQLHelper {
assert(struct.toDDL == """`b` BOOLEAN COMMENT 'Field\'s comment'""")
}
+ test("SPARK-33846: toDDL should include nested StructType fields' comments") {
+ val nestedStruct = new StructType()
+ .add(StructField("b", StringType).withComment("Nested comment"))
Review comment:
Could you add tests for deeper-nested cases, too?
##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/types/StructTypeSuite.scala
##########
@@ -73,6 +73,15 @@ class StructTypeSuite extends SparkFunSuite with SQLHelper {
assert(struct.toDDL == """`b` BOOLEAN COMMENT 'Field\'s comment'""")
}
+ test("SPARK-33846: toDDL should include nested StructType fields' comments") {
+ val nestedStruct = new StructType()
+ .add(StructField("b", StringType).withComment("Nested comment"))
+ val struct = new StructType()
+ .add(StructField("a", nestedStruct).withComment("comment"))
+ val ddl = "`a` STRUCT<`b`: STRING COMMENT 'Nested comment'> COMMENT 'comment'"
+
+ assert(struct.toDDL == ddl)
Review comment:
Could you add tests to check if `StructType.fromDDL(struct.toDDL)` can work correctly?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org