rangadi commented on code in PR #41075:
URL: https://github.com/apache/spark/pull/41075#discussion_r1188968513
##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufFunctionsSuite.scala:
##########
@@ -361,15 +361,23 @@ class ProtobufFunctionsSuite extends QueryTest with
SharedSparkSession with Prot
val df = Seq(dynamicMessage.toByteArray).toDF("value")
+ // Test that roundtrip serde works correctly both with and without enums
as ints.
checkWithFileAndClassName("SimpleMessageEnum") {
case (name, descFilePathOpt) =>
- val fromProtoDF = df.select(
- from_protobuf_wrapper($"value", name,
descFilePathOpt).as("value_from"))
- val toProtoDF = fromProtoDF.select(
- to_protobuf_wrapper($"value_from", name,
descFilePathOpt).as("value_to"))
- val toFromProtoDF = toProtoDF.select(
- from_protobuf_wrapper($"value_to", name,
descFilePathOpt).as("value_to_from"))
- checkAnswer(fromProtoDF.select($"value_from.*"),
toFromProtoDF.select($"value_to_from.*"))
+ List(
+ Map.empty[String, String],
+ Map("enums.as.ints" -> "false"),
+ Map("enums.as.ints" -> "true"))
+ .foreach(opts => {
+ val fromProtoDF = df.select(
+ from_protobuf_wrapper($"value", name, descFilePathOpt,
opts).as("value_from"))
+ val toProtoDF = fromProtoDF.select(
+ to_protobuf_wrapper($"value_from", name,
descFilePathOpt).as("value_to"))
Review Comment:
Agree. Lets go with the current version (int will be used if the input
schema is int).
--
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]