Exception thrown by AvroParquetWriter#write causes all subsequent calls to it to fail
- 主要言語
- Java
- スター
- 3.1k
- フォーク
- 1.6k
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 33
説明
Please see sample code below:
```java
Schema schema = new Schema.Parser().parse("""
{
"type": "record",
"name": "person",
"fields": [
{
"name": "address",
"type": [
"null",
{
"type": "array",
"items": "string"
}
],
"default": null
}
]
}
"""
);
ParquetWriter writer = AvroParquetWriter.builder(new org.apache.hadoop.fs.Path("/tmp/person.parquet"))
.withSchema(schema)
.build();
try {
// To trigger exception, add array with null element.
writer.write(new GenericRecordBuilder(schema).set("address", Arrays.asList("first", null, "last")).build());
} catch (Exception e) {
e.printStackTrace(); // "java.lang.NullPointerException: Array contains a null element at 1"
}
try {
// At this point all future calls to writer.write will fail
writer.write(new GenericRecordBuilder(schema).set("address", Arrays.asList("foo", "bar")).build());
} catch (Exception e) {
e.printStackTrace(); // "org.apache.parquet.io.InvalidRecordException: 1(r) > 0 ( schema r)"
}
writer.close();
```
It seems to me this is caused by state not being reset between writes. Is this the indented behavior of the writer? And if so, does one have to create a new writer whenever a write fails?
I'm able to reproduce this using both parquet 1.8.3 and 1.11.0, and have attached a sample parquet file for each version.
**Reporter**: [Øyvind Strømmen](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=InsulaVentus)
#### Original Issue Attachments:
- [person1_11_0.parquet](https://issues.apache.org/jira/secure/attachment/13008167/person1_11_0.parquet)
- [person1_8_3.parquet](https://issues.apache.org/jira/secure/attachment/13008168/person1_8_3.parquet)
**Note**: *This issue was originally created as [PARQUET-1887](https://issues.apache.org/jira/browse/PARQUET-1887). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
エントリポイント AvroParquetWriter#write から開始し、影響を受ける Parquet バージョンに対して提供された再現手順を実行します。null を含む配列が例外を引き起こした後の ParquetWriter の状態を追跡し、その後の有効な書き込みで意図されている動作を特定してテストします。その動作が確実に確立されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- data
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 40/100