justaparth commented on code in PR #43767:
URL: https://github.com/apache/spark/pull/43767#discussion_r1400821080


##########
connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/ProtobufOptions.scala:
##########
@@ -168,6 +168,28 @@ private[sql] class ProtobufOptions(
   // instead of string, so use caution if changing existing parsing logic.
   val enumsAsInts: Boolean =
     parameters.getOrElse("enums.as.ints", false.toString).toBoolean
+
+  // Whether to unwrap the struct representation for well known primitve 
wrapper types when
+  // deserializing. By default, the wrapper types for primitives (i.e. 
google.protobuf.Int32Value,
+  // google.protobuf.Int64Value, etc.) will get deserialized as structs. We 
allow the option to
+  // deserialize them as their respective primitives.
+  // https://protobuf.dev/reference/protobuf/google.protobuf/
+  //
+  // For example, given a message like:
+  // ```
+  // syntax = "proto3";
+  // message = Example {
+  //   google.protobuf.Int32Value val = 1;
+  // }
+  // ```
+  //
+  // The message Example(Int32Value(1)) would be deserialized by default as
+  // {val: {value: 1}}
+  //
+  // However, with this option set, it would be deserialized as
+  // {val: 1}
+  val unwrapWellKnownTypes: Boolean =
+    parameters.getOrElse("unwrap.protobuf.wkt", false.toString).toBoolean

Review Comment:
   yes, definitely. i updated it, let me know what you think



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