ProtoSchemaConverter renders invalid schema for oneof in unwrap mode
- Ngôn ngữ chính
- Java
- Star
- 3.1k
- Fork
- 1.6k
- Merge trung bình
- 3 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 33
Mô tả
### 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_
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu trong parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoSchemaConverter.java tại phần xử lý unwrap repetition, sau đó xem lại fixture TestProto3.OneOfTestMessage và các test của nó. Bật validation trong parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java và bổ sung coverage cho unwrap mode. Công việc được hoàn tất khi việc chuyển đổi oneof tạo ra một schema hợp lệ và read path liên quan được kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- data
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100