apache / apache/parquet-java

ProtoSchemaConverter renders invalid schema for oneof in unwrap mode

オープン
#3,039 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: bug
主要言語
Java
スター
3.1k
フォーク
1.6k
平均マージ
3日 12時間
マージ済み PR(30日)
33

説明

### 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_

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoSchemaConverter.java の unwrap repetition の処理から始め、続いて TestProto3.OneOfTestMessage fixture とそのテストを確認します。parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java で validation を有効にし、unwrap mode のカバレッジを追加します。oneof conversion が有効な schema を生成し、関連する read path がテストされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
data
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。