I definitely want to move the "V2Encrypted" files into parquet-testing as
soon as we can get agreement here. I can also add some of our "legacy"
V2EncryptedPages into repo if we want to keep an artifact.

On Mon, Nov 16, 2026 at 1:11 PM PRATEEK GAUR <[email protected]> wrote:

> Hi Russell,
>
> +1 on making this change in 1.19.0 and clarifying the spec (point from
> Gidon).
>
> Because DataPageV2 is not even the default in parquet-java, the blast
> radius of
> fixing it now is far smaller. Maybe add a temporary writer flag for rolling
> upgrades (in case writers upgrade before readers), as long as it plays
> nicely
> with how 1.19.0 readers detect legacy files under AES_GCM_CTR_V1 (this
> concerns
> the point that Xinli raised). Also might be good to add a test fixture to
> parquet-testing too?
>
> Thanks for driving the fix here!
>
> Best
>
> On Mon, Nov 16, 2026 at 4:47 AM Antoine Pitrou <[email protected]> wrote:
>
> >
> > I'm not a Parquet Java maintainer, but this sounds ok and necessary.
> >
> > Note: in Parquet C++ we're probably going to switch to V2 data pages by
> > default.
> >
> > Regards
> >
> > Antoine.
> >
> >
> > Le 13/11/2026 à 22:17, Russell Spitzer a écrit :
> > > Hopefully this got your attention. I promise this is not an
> > exaggeration. I
> > > do want to break encryption in parquet-java but I promise it's for a
> good
> > > reason.
> > >
> > > *TLDR; Parquet-java is writing unencrypted levels with V2Pages,
> breaking
> > > compatibility with all other Apache implementations. We should fix this
> > > even if it means breaking compatibility with older parquet-java
> readers.*
> > >
> > > So first a quick story
> > >
> > > When modular encryption was introduced, it treated DataPageV1 as a nice
> > > blob of data. Levels and Values all lived together in a happy pile of
> > data.
> > > Encryption took this happy pile of data and encrypted it all together,
> > just
> > > like compression. Whatever was compressed was encrypted.
> > >
> > > DataPageV2 is different: the levels are not compressed with the page
> > > values. A V2Page contains uncompressed levels, followed by compressed
> > > values. I do not think this was intentional, but the writer
> > implementation
> > > in parquet-java re-used existing patterns, causing us to write
> > unencrypted
> > > levels alongside encrypted values. A V1 page is written with everything
> > > encrypted, a V2 page is written with the levels in plaintext.
> > >
> > > Now this would only be a minor security issue (Talk to your security
> > team,
> > > it may be a bigger deal for you) except many implementations did this
> > > correctly.
> > >
> > > PME DataPageV2 Interop: Divergent encryption of rep/def levels between
> > > parquet-java and Arrow <
> > https://github.com/apache/parquet-java/issues/3934>
> > >
> > > Now, Parquet-Java (and Trino to my knowledge) writes and reads V2Pages
> as
> > > if they don't have encrypted levels. However, Parquet-C++, Parquet-rs,
> > > Parquet-Go, Polars, and DuckDB all write or read V2 pages as if the
> > entire
> > > page is encrypted.
> > >
> > > So there is essentially a fork now. Implementations either do not
> encrypt
> > > the whole page or they do encrypt the whole page. This only affects
> > > encrypted columns written with V2 pages, which parquet-java doesn't
> write
> > > by default.
> > >
> > > My suggestion is that we unify the two by breaking Parquet-Java's
> > backward
> > > compatibility. It's arguable that we are doing the incorrect thing in
> > > parquet-java and all the other implementations are correct. To do so I
> > > propose changing the behavior in version 1.19.0 to start writing
> correct
> > > fully encrypted pages while retaining the ability to read the partially
> > > encrypted V2 pages written by previous parquet-java versions. This
> would
> > > cause cross version compatibility issues when previous Parquet-Java
> > > versions read files written by 1.19.0, but would get us compatibility
> > with
> > > the rest of the ecosystem.
> > >
> > > My PR to Break/Fix DataPageV2 Encryption in Parquet java
> > > <https://github.com/apache/parquet-java/pull/3935>
> > >
> > > Gidon also proposed a slight correction to the one ambiguous place in
> the
> > > modular encryption spec that supports the current parquet-java
> > > implementation (although all other references imply the whole page is
> > > encrypted).
> > >
> > > GH-636: Encryption spec compatibility with version 2 of data pages
> > > <https://github.com/apache/parquet-format/pull/637>
> >
> >
> >
>

Reply via email to