justaparth commented on code in PR #41075:
URL: https://github.com/apache/spark/pull/41075#discussion_r1186842132
##########
connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/ProtobufSerializer.scala:
##########
@@ -110,6 +110,19 @@ private[sql] class ProtobufSerializer(
enumSymbols.mkString("\"", "\", \"", "\""))
}
fieldDescriptor.getEnumType.findValueByName(data)
+ case (IntegerType, ENUM) =>
+ val enumValues: Set[Int] =
+ fieldDescriptor.getEnumType.getValues.asScala.map(e =>
e.getNumber).toSet
+ (getter, ordinal) =>
+ val data = getter.getInt(ordinal)
+ if (!enumValues.contains(data)) {
+ throw
QueryCompilationErrors.cannotConvertCatalystTypeToProtobufEnumTypeError(
Review Comment:
yeah i agree, i copy/pasted the error from the existing logic above.
i've moved the error from `QueryCompilationErrors` to `QueryExecutionErrors`
and slightly renamed it, what do you think? happy to change more or use a
different error if that makes more sense though
--
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]