ProtoSchemaConverter renders invalid schema for oneof in unwrap mode
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
### Describe the bug, including details regarding any error messages, version, and platform.
When unwrap is enabled all fields of the `TestProto3.OneOfTestMessage` will be required.
```
message TestProto3.OneOfTestMessage {
required int32 first = 1;
required int32 second = 2;
}
```
https://github.com/apache/parquet-java/blob/73a4430af6c40f8eb246ad4911eb6d103c9a2abe/parquet-protobuf/src/test/resources/TestProto3.proto#L116
This will never work but tests are missing for unwrap of `TestProto3.OneOfTestMessage`
The required repetition is added here:
https://github.com/apache/parquet-java/blob/73a4430af6c40f8eb246ad4911eb6d103c9a2abe/parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoSchemaConverter.java#L278
This could be caught early by adding `withValidation(true)` here:
https://github.com/apache/parquet-java/blob/73a4430af6c40f8eb246ad4911eb6d103c9a2abe/parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java#L221
If validation is disabled it will fail when trying to read one of the non-existing fields in the `oneof`.
Is there really a need for setting all primitive fields in unwrap to required?
### Component(s)
_No response_
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez dans parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoSchemaConverter.java, au niveau de la gestion de unwrap repetition, puis examinez le fixture TestProto3.OneOfTestMessage et ses tests. Activez la validation dans parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java et ajoutez une couverture pour le unwrap mode. Le travail est terminé lorsque la conversion de oneof produit un schéma valide et que le read path concerné est testé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- data
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100