← Back to Pull requests

feat: add the Comet Native Executors driver (experimental) #7544

Closed
unknown closed this pull request without merging on Nov 30, 2026 20:26 UTC
View on GitHub
unknown unknown commented on Nov 06, 2026 20:16 UTC
Author

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-scheduler and comet-executor processes with no JVM in the data plane. The cluster is in native/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-flight and tonic, and they are optional. The feature is off by default at every level: the native-executors Cargo feature is off, spark.comet.nativeExecutors.enabled is false, and both configs are internal. With the config off, CometRule behaves 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-native branch.

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.proto gains ResultEndpoints and ResultEndpoint. native/core gains the native-executors Cargo feature with optional arrow-flight and tonic dependencies, native_executors/client.rs (submit a query, open and read a result partition, close it), and prepare_output becomes pub(crate) for the client. is_feature_enabled reports the feature. native/Cargo.lock is regenerated.
2. The Spark driver. CometNativeExecutorsExec.scala has 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.scala has the JNI declarations and a clear error when libcomet lacks the feature. CometRule calls the planner when the config is on and Comet converts the plan. CometConf gets spark.comet.nativeExecutors.enabled and spark.comet.nativeExecutors.scheduler.url. CometNativeExecutorsPlanSuite checks the stage graph, the refusals, that a command stays in Spark and the subquery rewrite without a cluster, in the regular CI matrix. CometNativeExecutorsSuite runs queries on a cluster and is manual. pom.xml exempts the JNI declarations of NativeExecutorsClient from the unused-parameter check of the strict-warnings profile, as it does for Native.
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 of native/native-executors/README.md that said the driver was in progress. The CI parts lint and test the native-executors feature in the same builds as the python-udf feature in the Rust test action, and the manual suite's entry in dev/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, and cargo 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, CometExecRuleSuite and CometIcebergWriteDetectionSuite. Markdown passes prettier --check, and dev/ci/check-suites.py passes.

The cluster-backed tests of CometNativeExecutorsSuite are manual, since they need the cluster binaries in COMET_NATIVE_EXECUTORS_BIN_DIR. They ran against the cluster built from native/native-executors in this PR, with a libcomet built from this PR with the native-executors feature, 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.

Diff: 584 lines (+438 / -146) across 7 files Reviewer: sunchao Review duration: 34570m
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
0.50
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 49.9% (MEDIUM) · Higher = larger blast radius
49.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 19.7% · Safe to merge
19.7%