OpenFile fails on encrypted Bloom filter columns with ErrKeyNotFound
perfloop-oss/parquet-go · Uncatalogued correctness
https://perfloop.ai/t/oss/case_nb8h1me4jh
Verdict
VERIFIED · settled 2026-11-24 · merged as parquet-go/parquet-go#756
What happened: The check fails before this change and passes with it.
Hypothesis
Opening an encrypted-footer Parquet file fails completely when any column whose key is intentionally unavailable has a Bloom filter. This breaks the documented partial-decryption contract for callers that hold the footer key and a subset of column keys.
In encrypt.go lines 101-129, ErrKeyNotFound is documented as a non-fatal signal so OpenFile leaves that column inaccessible rather than aborting the open. In file.go lines 813-817, FileRowGroup.init handles ErrKeyNotFound by leaving decryptionKey nil and setting missingKey = true. However, in OpenFile's default eager Bloom filter loop (file.go lines 264-327), line 283 checks only `if cc.decryptionKey != nil { continue }`. For encrypted-footer files, the footer (including BloomFilterOffset) is decrypted with the footer key, so cc.chunk.MetaData.BloomFilterOffset is positive while cc.decryptionKey is nil. OpenFile then attempts to decode the AES-GCM ciphertext at BloomFilterOffset as a plaintext Thrift BloomFilterHeader and fails. Upstream open PRs on parquet-go/parquet-go were checked (PRs #561 and #272 touch file.go but neither changes this Bloom filter guard).
A bounded 8-case search across EncryptedFooter {true, false}, PrefetchBloomFilters {false, true}, and SkipPageIndex {false, true} failed all 4 encrypted-footer configurations with `decoding bloom filter header: missing required field: 1:FIELD<I32>`. Running `go test . -run '^TestHuntOpenFileBloomErrKeyNotFoundReplay$' -count=1` deterministically reproduces the failure on a 1-row encrypted-footer file.
The Case should verify that OpenFile succeeds across both PrefetchBloomFilters modes when an encrypted column with a Bloom filter returns ErrKeyNotFound, that accessible columns remain readable, and that accessing the missing-key column's BloomFilter or Pages reports ErrKeyNotFound. The submitted test file layout is provisional.
Change to test: Skip eager plaintext Bloom filter decoding in OpenFile when cc.missingKey is true as well as when cc.decryptionKey != nil, so encrypted columns whose KeyRetriever returned ErrKeyNotFound defer to the lazy readBloomFilter path and return ErrKeyNotFound without aborting OpenFile.
Where it lives
Evidence
The check fails before this change and passes with it: `For nonempty name/value files with a valid footer key and ErrKeyNotFound for the name column key, OpenFile succeeds with encrypted Bloom filters in either footer layout and PrefetchBloomFilters mode, the value column is readable, and name-column BloomFilter.Check and Pages.ReadPage return ErrKeyNotFound.`
Checks: 2 of 2 passed. Verification: no defect found.