ProtoSchemaConverter renders invalid schema for oneof in unwrap mode
- Lenguaje dominante
- Java
- Estrellas
- 3.1k
- Forks
- 1.6k
- Merge medio
- 3 d 12 h
- PR fusionados (30 d)
- 33
Descripción
### 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_
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza en parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoSchemaConverter.java, en el manejo de unwrap repetition, y luego revisa el fixture TestProto3.OneOfTestMessage y sus tests. Habilita la validación en parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java y añade cobertura para el unwrap mode. Se considera terminado cuando la conversión de oneof produce un esquema válido y se prueba el read path relevante.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- data
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100