rangadi commented on code in PR #41075:
URL: https://github.com/apache/spark/pull/41075#discussion_r1188970475
##########
connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/utils/ProtobufOptions.scala:
##########
@@ -141,6 +141,33 @@ private[sql] class ProtobufOptions(
// what information is available in a serialized proto.
val emitDefaultValues: Boolean =
parameters.getOrElse("emit.default.values", false.toString).toBoolean
+
+ // Whether to render enum fields as their integer values.
+ //
+ // As an example, consider the following message type:
+ // ```
+ // syntax = "proto3";
+ // message Person {
+ // enum Job {
+ // NONE = 0;
+ // ENGINEER = 1;
+ // DOCTOR = 2;
+ // }
+ // Job job = 1;
+ // }
+ // ```
+ //
+ // If we have an instance of this message like `Person(job = ENGINEER)`,
then the
+ // default deserialization will be:
+ // `{"job": "ENGINEER"}`
+ //
+ // But with this option set the deserialization will be:
+ // `{"job": 1}`
+ //
+ // Please note the output struct type will now contain an int column
+ // instead of string, so use caution if changing existing parsing logic.
+ val enumsAsInts: Boolean =
+ parameters.getOrElse("enums.as.ints", false.toString).toBoolean
Review Comment:
Good point @HyukjinKwon .
Thanks @justaparth for the ticket. would you like to send a PR for doc
update :)? Essentially we would copy scala documentation to markdown.
--
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]