Skip to content

fix: fallback to Spark scan if encryption is enabled (native_datafusion/native_iceberg_compat) #1785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spark/src/main/scala/org/apache/comet/rules/CometScanRule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ case class CometScanRule(session: SparkSession) extends Rule[SparkPlan] {
return withInfos(scanExec, fallbackReasons.toSet)
}

val encryptionEnabled: Boolean =
conf.getConfString("parquet.crypto.factory.class", "").nonEmpty &&
conf.getConfString("parquet.encryption.kms.client.class", "").nonEmpty

if (scanImpl != CometConf.SCAN_NATIVE_COMET && encryptionEnabled) {
fallbackReasons +=
"Full native scan disabled because encryption is not supported"
return withInfos(scanExec, fallbackReasons.toSet)
}

val typeChecker = CometScanTypeChecker(scanImpl)
val schemaSupported =
typeChecker.isSchemaSupported(scanExec.requiredSchema, fallbackReasons)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class ParquetEncryptionITCase extends CometTestBase with SQLTestUtils {
private val key2 = encoder.encodeToString("1234567890123451".getBytes(StandardCharsets.UTF_8))

test("SPARK-34990: Write and read an encrypted parquet") {
// https://github.com/apache/datafusion-comet/issues/1488
assume(CometConf.COMET_NATIVE_SCAN_IMPL.get() != CometConf.SCAN_NATIVE_ICEBERG_COMPAT)
assume(CometConf.COMET_NATIVE_SCAN_IMPL.get() == CometConf.SCAN_NATIVE_COMET)

import testImplicits._

Expand Down Expand Up @@ -93,8 +92,7 @@ class ParquetEncryptionITCase extends CometTestBase with SQLTestUtils {
}

test("SPARK-37117: Can't read files in Parquet encryption external key material mode") {
// https://github.com/apache/datafusion-comet/issues/1488
assume(CometConf.COMET_NATIVE_SCAN_IMPL.get() != CometConf.SCAN_NATIVE_ICEBERG_COMPAT)
assume(CometConf.COMET_NATIVE_SCAN_IMPL.get() == CometConf.SCAN_NATIVE_COMET)

import testImplicits._

Expand Down
Loading