Encrypted parquet files can't have more than 32767 pages per chunk: 32768
- 主要言語
- Java
- スター
- 3.1k
- フォーク
- 1.6k
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 33
説明
When we were writing an encrypted file, we encountered the following error:
```java
Encrypted parquet files can't have more than 32767 pages per chunk: 32768
```
**Error Stack:**
```java
org.apache.parquet.crypto.ParquetCryptoRuntimeException: Encrypted parquet files can't have more than 32767 pages per chunk: 32768
at org.apache.parquet.crypto.AesCipher.quickUpdatePageAAD(AesCipher.java:131)
at org.apache.parquet.hadoop.ColumnChunkPageWriteStore$ColumnChunkPageWriter.writePage(ColumnChunkPageWriteStore.java:178)
at org.apache.parquet.column.impl.ColumnWriterV1.writePage(ColumnWriterV1.java:67)
at org.apache.parquet.column.impl.ColumnWriterBase.writePage(ColumnWriterBase.java:392)
at org.apache.parquet.column.impl.ColumnWriteStoreBase.sizeCheck(ColumnWriteStoreBase.java:231)
at org.apache.parquet.column.impl.ColumnWriteStoreBase.endRecord(ColumnWriteStoreBase.java:216)
at org.apache.parquet.column.impl.ColumnWriteStoreV1.endRecord(ColumnWriteStoreV1.java:29)
at org.apache.parquet.io.MessageColumnIO$MessageColumnIORecordConsumer.endMessage(MessageColumnIO.java:295)
```
**Reasons:**
The `getBufferedSize` method of [FallbackValuesWriter](https://github.com/apache/parquet-mr/blob/19f284355847696fa254c789ab93c42db9af5982/parquet-column/src/main/java/org/apache/parquet/column/values/fallback/FallbackValuesWriter.java#L73)
returns raw data size to decide if we want to flush the page,
so the actual size of the page written could be much more smaller due to dictionary encoding. This prevents page being too big when fallback happens, but can also produce too many pages in a single column chunk. On the other side, the encryption module only supports up to 32767 pages per chunk, as we use `Short` to store page ordinal as a part of [AAD](https://github.com/apache/parquet-format/blob/master/Encryption.md#442-aad-suffix).
**Reproduce:**
**[reproduce.zip](reproduce.zip)**
**Reporter**: [Ence Wang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=encewang)
#### Original Issue Attachments:
- [image-2024-02-04-19-21-41-207.png](https://issues.apache.org/jira/secure/attachment/13066457/image-2024-02-04-19-21-41-207.png)
- [reproduce.zip](https://issues.apache.org/jira/secure/attachment/13066328/reproduce.zip)
**Note**: *This issue was originally created as [PARQUET-2424](https://issues.apache.org/jira/browse/PARQUET-2424). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start with FallbackValuesWriter.getBufferedSize and trace the page-flush path through ColumnChunkPageWriteStore.ColumnChunkPageWriter.writePage and AesCipher.quickUpdatePageAAD. Use reproduce.zip to reproduce the 32,768-page encrypted column chunk and inspect how page ordinals are encoded. Done means the reproduced encrypted write completes without exceeding the supported page-ordinal limit.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- data-engineering, security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100