feat: add the Comet Native Executors driver (experimental) #7544
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 584 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.381
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7544"
general
weight: 0.35
sunchao
Which issue does this PR close?
Part of #7288.
Closes #7557.
Rationale for this change
Comet Native Executors run whole Spark queries on a cluster of
comet-schedulerandcomet-executorprocesses with no JVM in the data plane. The cluster is innative/native-executors. This PR adds the Spark driver side: the driver plans a query with Catalyst and Comet, turns the plan into a graph of stages, and submits it to the scheduler's Arrow Flight service. Spark tasks then read the result partitions from the executors over Flight.The driver never links Ballista. Its only new native dependencies are
arrow-flightandtonic, and they are optional. The feature is off by default at every level: thenative-executorsCargo feature is off,spark.comet.nativeExecutors.enabledis false, and both configs are internal. With the config off,CometRulebehaves as before.This PR is split out of https://github.com/apache/datafusion-comet/pull/7289. The cluster-side features some queries need, such as sorting the partitions of a range exchange in parallel and moving a join whose build side turns out small, are in that PR and not here. This PR is not expected to run the TPC-H queries yet: the cluster in this repository fails most of the ones that join. Nothing here depends on Ballista's
comet-nativebranch.What changes are included in this PR?
One commit for each part, and commits for the review feedback.
1. The wire format and the JNI client.
native_executors.protogainsResultEndpointsandResultEndpoint.native/coregains thenative-executorsCargo feature with optionalarrow-flightandtonicdependencies,native_executors/client.rs(submit a query, open and read a result partition, close it), andprepare_outputbecomespub(crate)for the client.is_feature_enabledreports the feature.native/Cargo.lockis regenerated.2. The Spark driver.
CometNativeExecutorsExec.scalahas the planner. Planning validates the stage graph and refuses a query that cannot run entirely in the Comet pipeline, naming the operator. The query itself is built when it executes: that lists the files each scan reads, runs the subqueries in the scans' filters, and writes scalar subquery results into the plan as literals. A Parquet scan that lists no files, or an Iceberg scan that plans no tasks, gets one empty partition. The exec then reads the result partitions.NativeExecutorsClient.scalahas the JNI declarations and a clear error when libcomet lacks the feature.CometRulecalls the planner when the config is on and Comet converts the plan.CometConfgetsspark.comet.nativeExecutors.enabledandspark.comet.nativeExecutors.scheduler.url.CometNativeExecutorsPlanSuitechecks the stage graph, the refusals, that a command stays in Spark and the subquery rewrite without a cluster, in the regular CI matrix.CometNativeExecutorsSuiteruns queries on a cluster and is manual.pom.xmlexempts the JNI declarations ofNativeExecutorsClientfrom the unused-parameter check of thestrict-warningsprofile, as it does forNative.3. Docs and CI. A contributor guide page,
native_executors.md, with how to run the driver and its current limitations, and the one sentence ofnative/native-executors/README.mdthat said the driver was in progress. The CI parts lint and test thenative-executorsfeature in the same builds as thepython-udffeature in the Rust test action, and the manual suite's entry indev/ci/check-suites.py.How are these changes tested?
Rust:
cargo clippy -p datafusion-comet --all-targets --features python-udf,native-executors -- -D warnings,cargo fmt --check, andcargo test -p datafusion-comet --features native-executors --lib native_executors.Scala, with JDK 17 on the default profile, and
./mvnw test-compile -Pspark-3.5,delta -Pstrict-warnings:./mvnw spotless:check,./mvnw test-compile -DskipTests,CometNativeExecutorsPlanSuite,CometExecRuleSuiteandCometIcebergWriteDetectionSuite. Markdown passesprettier --check, anddev/ci/check-suites.pypasses.The cluster-backed tests of
CometNativeExecutorsSuiteare manual, since they need the cluster binaries inCOMET_NATIVE_EXECUTORS_BIN_DIR. They ran against the cluster built fromnative/native-executorsin this PR, with a libcomet built from this PR with thenative-executorsfeature, on TPC-H data at scale factor 1. All 13 tests that are not TPC-H queries pass, and so do TPC-H q1, q6, q11 and q15. The other 18 TPC-H queries join, and fail while the scheduler plans them (CometFragmentExec input N has K partitions, expected 1). They need the cluster of #7289.