sankalpsthakur opened a new pull request, #3799:
URL: https://github.com/apache/parquet-java/pull/3799

   ### Rationale for this change
   
   When `parquet.proto.unwrapProtoWrappers` is enabled, `ProtoSchemaConverter` 
marks every primitive field `REQUIRED`. That is invalid for protobuf `oneof` 
members: at most one alternative can be written, so the other members are 
absent. Write validation then fails, and even without validation the schema 
claims fields a legal oneof record cannot populate.
   
   Fixes https://github.com/apache/parquet-java/issues/3039.
   
   ### What changes are included in this PR?
   
   - Keep `oneof` members optional when converting protobuf schemas in unwrap 
mode.
   - Non-oneof primitives still become `REQUIRED` in unwrap mode, matching 
existing documented behavior.
   - Add schema conversion tests and a validated writer round-trip for 
`OneOfTestMessage`.
   
   ### Are these changes tested?
   
   Yes. `parquet-protobuf` module tests, including:
   
   - `ProtoSchemaConverterTest.testProto3ConvertOneOf`
   - `ProtoSchemaConverterTest.testProto3ConvertOneOfUnwrapped`
   - `ProtoWriteSupportTest.testMessageOneOfUnwrappedRoundTrip` (unwrap + 
`withValidation(true)`)
   
   ### Are there any user-facing changes?
   
   Yes. Unwrap-mode schemas for protobuf `oneof` primitives change from 
`required` to `optional`. Newly written files are valid; previously written 
unwrap+oneof files with `required` members remain readable.
   
   Contributor: Sankalp Thakur (`sankalpsthakur`). Apache ICLA note: this 
contribution is offered under the Apache License 2.0; please confirm ICLA 
status against ASF records if required for merge.
   
   Closes #3039
   


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

Reply via email to