[ 
https://issues.apache.org/jira/browse/BEAM-12464?focusedWorklogId=610023&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-610023
 ]

ASF GitHub Bot logged work on BEAM-12464:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/21 07:10
            Start Date: 14/Jun/21 07:10
    Worklog Time Spent: 10m 
      Work Description: reubenvanammers edited a comment on pull request #14974:
URL: https://github.com/apache/beam/pull/14974#issuecomment-859175251


   >  Can you explain the use case where this is necessary?
   
   How I noticed this was when I was trying to convert a Beam Row into a 
protobuf, with the OneOf not in the first position. During the conversion, the 
it converts in the order of the converters, which in turn is the order of the 
generated Schema. Because the OneOf field is first in the generated schema, the 
first field in the row is attempted to be converted to a proto OneOf,  which 
then fails. Basically this means that Rows containing OneOfs can't be converted 
to protos, except if all of the OneOfs are at the start of the row. 
   
   Obviously there are workarounds (I.e. reordering the beam row before 
converting to protobuf) , but I believe that the behaviour is surprising enough 
to warrant changing one way or the other. 


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

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 610023)
    Time Spent: 1h  (was: 50m)

> Change ProtoSchemaTranslator beam schema creation to match the order for 
> protobufs containing Oneof fields
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-12464
>                 URL: https://issues.apache.org/jira/browse/BEAM-12464
>             Project: Beam
>          Issue Type: Improvement
>          Components: extensions-java-protobuf
>            Reporter: Reuben van Ammers
>            Priority: P2
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently, when ProtoSchemaTranslator creates the beam schema from a protobuf 
> definition it always puts the Oneofs at the start of the beam schema due to 
> Oneofs being created from the code first. This means that the order of the 
> fields doesn't match the order of the protobuf defintion. As the schema 
> generation is used when converting from beam rows to protobufs, it 
> additionally means that it is impossible to convert from a beam row where the 
> oneof fields are not the first fields in the beamrow.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to