You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/10/10 01:54:44 UTC

[GitHub] [beam] maduris commented on pull request #14974: [BEAM-12464] Change ProtoSchemaTranslator beam schema creation to match the order for protobufs containing Oneof fields

maduris commented on pull request #14974:
URL: https://github.com/apache/beam/pull/14974#issuecomment-939391046


   hi @reubenvanammers,
   
   Glad you are already looking to the same issue we are facing.
   
   I believe the convert function needs to be also updated to use the identifier number instead of the enum index on line
   oneOfConvert has indices using the identifiers from proto definition where oneOf only has enum value.
   
   https://github.com/apache/beam/blob/master/sdks/java/extensions/protobuf/src/main/java/org/apache/beam/sdk/extensions/protobuf/ProtoDynamicMessageSchema.java#L731
   
   Something like?
   
   `        @Override
           void setOnProtoMessage(Message.Builder message, OneOfType.Value oneOf) {
               int caseIndex = oneOf.getCaseType().getValue();
               int convertIndex =
                   logicalType.getCaseEnumType().valueOf(logicalType.getCaseEnumType().getValues().get(caseIndex)).getValue();
               oneOfConvert.get(convertIndex).setOnProtoMessage(message, oneOf.getValue());
           }`
   
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org