GH-3934: Encrypt DataPageV2 repetition and definition levels together with the values #3935
All Vouch review confidence checks passed
Residual risk 0.36 = Change Risk (0.63) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 290 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.339
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #3935"
general
weight: 0.35
RussellSpitzer
Rationale for this change
Parquet-java is the only implementation that encrypts only the values of a DataPageV2 page and leaves the repetition and definition levels in plaintext. Arrow C++ (and PyArrow), arrow-rs, arrow-go, Polars and Velox all encrypt the whole page body (levels and values) as one module, and DuckDB reads it that way. The spec text is ambiguous for DataPageV2 (see apache/parquet-format#636), so the two layouts cannot read each other's files.
What changes are included in this PR?
ColumnChunkPageWriteStore,ParquetFileWriter,ParquetRewriter) encrypt the levels and the values of a DataPageV2 page as one module.ParquetFileWriter.writeDataPageV2overload takes a page body encryptor. The four overloads that take only a page header encryptor are deprecated, because they leave the levels in plaintext.created_by: parquet-java before 1.19.0 wrote plaintext levels, and every other writer uses one module.Are these changes tested?
Yes. The tests read fixtures written by Arrow (pyarrow 24.0.0), by parquet-java before this change, and hand-built pages that fit both layouts, with GCM and CTR, heap and direct buffers. They check the bytes that the writer and the rewriter produce with an independent decoder, round-trip files with several row groups and page filtering, and check tamper detection through the GCM tag and the CRC.
Are there any user-facing changes?
Yes. This is a breaking change for readers.
Parquet-java 1.18 and earlier cannot read DataPageV2 pages of encrypted columns with levels that 1.19.0 writes. With
AES_GCM_V1the read fails. WithAES_GCM_CTR_V1the levels are decoded incorrectly without an error. Other implementations can read these files. 1.19.0 still reads files written by earlier versions.The
ParquetRewriterdoes not read encrypted input, so it cannot convert old encrypted files. To convert them, read them with 1.19.0 and write them again.Closes #3934
This pr was written with the assistance of Claude Opus 5.5 ~and I haven't fully finished my review which is why I'm leaving this as a draft.~