Skip to content

feat: Parquet Modular Encryption with Spark KMS for native readers - #2447

Merged
mbutrovich merged 25 commits into
apache:mainfrom
mbutrovich:decryption
Oct 7, 2025
Merged

feat: Parquet Modular Encryption with Spark KMS for native readers#2447
mbutrovich merged 25 commits into
apache:mainfrom
mbutrovich:decryption

Conversation

@mbutrovich

@mbutrovichmbutrovich commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

We want to add Parquet Module Encryption support for the native readers when using a Spark KMS. We use the encryption factory features added in DataFusion 50 to register an encryption factory that uses JNI to get decryption keys from Spark.

What changes are included in this PR?

How are these changes tested?

  • Existing PME tests with new readers added.
  • New tests that exercise PME options like plaintext footer, etc.

@mbutrovichmbutrovich changed the title feat: Parquet Modular Encryption support for native_datafusion and native_iceberg_compat readersfeat: Parquet Modular Encryption with Spark KMS for native_datafusion and native_iceberg_compat readersSep 23, 2025
@mbutrovichmbutrovich changed the title feat: Parquet Modular Encryption with Spark KMS for native_datafusion and native_iceberg_compat readersfeat: Parquet Modular Encryption with Spark KMS for native readersSep 23, 2025
@codecov-commenter

codecov-commenter commented Sep 23, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.78161% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.92%. Comparing base (f09f8af) to head (257f163).
⚠️ Report is 689 commits behind head on main.

Files with missing linesPatch %Lines
...rg/apache/comet/parquet/CometFileKeyUnwrapper.java0.00%18 Missing ⚠️
...a/org/apache/comet/parquet/CometParquetUtils.scala0.00%15 Missing ⚠️
...ain/scala/org/apache/comet/CometExecIterator.scala33.33%7 Missing and 1 partial ⚠️
...va/org/apache/comet/parquet/NativeBatchReader.java0.00%5 Missing ⚠️
...n/scala/org/apache/spark/sql/comet/operators.scala80.76%3 Missing and 2 partials ⚠️
...n/scala/org/apache/comet/rules/CometScanRule.scala42.85%3 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #2447 +/- ##
============================================
+ Coverage 56.12% 58.92% +2.79% - Complexity 976 1457 +481 
============================================
Files 119 147 +28 Lines 11743 13642 +1899 Branches 2251 2369 +118 ============================================
+ Hits 6591 8038 +1447 - Misses 4012 4381 +369 - Partials 1140 1223 +83 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment threadcommon/src/main/java/org/apache/comet/parquet/NativeBatchReader.java Outdated
Comment threadnative/core/src/parquet/parquet_exec.rs Outdated
Comment threadnative/core/src/parquet/parquet_exec.rs Outdated
@parthchandra

Copy link
Copy Markdown
Contributor

@mbutrovich
mbutrovich marked this pull request as ready for review September 26, 2025 20:31
# Conflicts:
#	spark/src/main/scala/org/apache/comet/CometExecIterator.scala
Comment threadcommon/src/main/java/org/apache/comet/parquet/CometFileKeyUnwrapper.java Outdated
Comment threadcommon/src/main/java/org/apache/comet/parquet/CometFileKeyUnwrapper.java Outdated
Comment threadcommon/src/main/java/org/apache/comet/parquet/NativeBatchReader.java Outdated
Comment threadcommon/src/main/scala/org/apache/comet/parquet/CometParquetUtils.scala Outdated
Comment threadspark/src/main/scala/org/apache/spark/sql/comet/operators.scala Outdated
@mbutrovich

Copy link
Copy Markdown
ContributorAuthor

Results attached from the benchmark I added to CometReadBenchmark, and a small chart with highlights to see what the overhead of encryption is for the various readers.

decryption

benchmark_decryption.txt

Comment threadnative/core/src/parquet/encryption_support.rs
Comment threadcommon/src/main/java/org/apache/comet/parquet/CometFileKeyUnwrapper.java Outdated
Comment threadcommon/src/main/java/org/apache/comet/parquet/CometFileKeyUnwrapper.java Outdated
Comment threadnative/core/src/parquet/encryption_support.rs
Comment threadnative/core/src/parquet/encryption_support.rs Outdated

@parthchandraparthchandra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm


// spotless:off
/*
* Architecture Overview:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diagram is super helpful, thanks a lot.

# Conflicts:
#	native/core/src/execution/jni_api.rs
#	spark/src/main/scala/org/apache/comet/CometExecIterator.scala
#	spark/src/main/scala/org/apache/comet/Native.scala

@hsiang-chsiang-c left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@mbutrovich@codecov-commenter@parthchandra@martin-g@hsiang-c