rangadi commented on code in PR #44643:
URL: https://github.com/apache/spark/pull/44643#discussion_r1456494004


##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufFunctionsSuite.scala:
##########
@@ -1150,6 +1198,34 @@ class ProtobufFunctionsSuite extends QueryTest with 
SharedSparkSession with Prot
     }
   }
 
+  test("Corner case: retain empty recursive proto fields") {
+    // This verifies that a empty proto like 'message A { A a = 1}' can be 
retained by
+    // inserting a dumy field.
+
+    val emptyProtoSchema =
+      StructType(StructField("_dummy_field_to_retain_empty_message", 
StringType) :: Nil)
+    val expectedSchema = StructType(
+      // DDL: "proto STRUCT<name: string, groups: map<
+      //    struct<name: string, group: map<struct<name: string>>>>>"
+      StructField("empty_proto",
+        StructType(
+          StructField("recursive_field", emptyProtoSchema) ::
+            StructField("recursive_array", ArrayType(emptyProtoSchema, 
containsNull = false)

Review Comment:
   Could you update the DDL comment at 1208?



-- 
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]

Reply via email to