feat: core SPI for contrib leaf scans (CometScanWithPlanData) [Delta contrib split, part 1]#4700
Open
schenksj wants to merge 1 commit into
Open
feat: core SPI for contrib leaf scans (CometScanWithPlanData) [Delta contrib split, part 1]#4700schenksj wants to merge 1 commit into
schenksj wants to merge 1 commit into
Conversation
Introduce a small extension contract so out-of-tree Comet contrib leaf scans (Delta, and future Hudi/etc.) can participate in native planning without core holding a compile-time reference to them -- mirroring the Iceberg-precedent of keeping the data-source-specific code at the edge. What this adds: - `trait CometScanWithPlanData` (`sourceKey` / `commonData` / `perPartitionData`, plus optional `dynamicPruningFilters` / `withDynamicPruningFilters` for scans whose DPP filters live in a @transient field). `CometNativeScanExec` now mixes it in. - `CometNativeExec.foreachUntilCometInput` matches `case _: CometLeafExec` (a strict superset of the previous fixed scan enumeration -- all built-in leaf scans already extend `CometLeafExec`), so any leaf Comet exec is recognised as an input boundary. - `PlanDataInjector.findAllPlanData` collects per-partition planning data via the trait instead of a hardcoded `CometNativeScanExec` match. - `PlanDataInjector`'s registry gains one reflective `DeltaPlanDataInjector$` slot, appended only when a contrib bundled it (`-Pcontrib-delta`). Default builds get a `ClassNotFoundException` -> `None` and an unchanged injectors list, so there is zero contrib surface at runtime. - `CometPlanAdaptiveDynamicPruningFilters` rewrites AQE DPP filters in place for trait scans whose filters can't survive `makeCopy` (apache#3510). Inert by construction: with no contrib on the classpath this is behavior- preserving (the leaf match is a superset; the trait match catches the same `CometNativeScanExec`; the reflective slot resolves to nothing). Tests: `CometScanWithPlanDataSuite` (trait-contract defaults + reflective-slot graceful absence). Verified `CometJoinSuite` (native scan fusion / DPP) stays green. First unit of the Delta-contrib PR split (tracking: apache#4366).
This was referenced Jun 21, 2026
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of the Delta Lake contrib PR breakup. The native Delta scan work (delta-kernel-rs, Iceberg-style contrib) was first posted as a single ~27k-line tracking PR, #4366, which is impractical to review as one unit. This is the first of a sequence of small, independently-reviewable, independently-mergeable PRs that reconstruct that work. The full sequence and its dependency graph live in #4366.
This first slice touches core only. It adds a small extension contract that lets out-of-tree Comet contrib leaf scans (Delta now... others later?) take part in native planning without core holding a compile-time reference to them. This is the same "the edge keeps the source-specific code" shape Iceberg already uses. It ships no Delta code and is inert on default builds.
Changes
trait CometScanWithPlanData—sourceKey/commonData/perPartitionData, plus optionaldynamicPruningFilters/withDynamicPruningFilters(for scans whose DPP filters live in a@transientfield thatTreeNode.makeCopycannot carry, Epic: CometNativeScan improvements (per-partition serde, cleanup, DPP, AQE DPP, V2 operator) #3510).CometNativeScanExecmixes it in.foreachUntilCometInputnow matchescase _: CometLeafExec. This is a strict superset of the previous fixed scan list: the three leaf scans it replaces (CometNativeScanExec,CometIcebergNativeScanExec,CometCsvNativeScanExec) are exactly the classes that extendCometLeafExec.PlanDataInjector.findAllPlanDatacollects per-partition planning data via the trait instead of a hardcodedCometNativeScanExecmatch.PlanDataInjectorregistry gains one reflectiveDeltaPlanDataInjector$slot, appended to the existinginjectorsByKindregistry (perf: O(1) PlanDataInjector lookup by op kind #4535) only when a contrib bundled the class (-Pcontrib-delta). Default builds getClassNotFoundException -> Noneand an unchanged registry. A class that is present but fails to bind (a misbuilt contrib jar) is logged, not silently swallowed.CometPlanAdaptiveDynamicPruningFiltersrewrites AQE DPP filters in place for trait scans whose filters cannot survivemakeCopy.What this part deliberately does NOT do yet
perPartitionFilePathson the trait. That member only feedsFAILED_READ_FILEerror conversion and lands in a later part, after feat: surface native parquet read failures as FAILED_READ_FILE #4536 (now merged).DeltaPlanDataInjectoron the classpath yet, so the reflective slot resolves to nothing. This part is inert.Why it is safe on default builds
With no contrib on the classpath the change is behavior-preserving. The leaf match is a proven superset of the old enumeration. The trait match catches the same
CometNativeScanExecand still drives its subquery resolution. The reflective slot resolves toNone. And the new DPP arm never fires becauseCometNativeScanExecleavesdynamicPruningFiltersempty.Verification
CometScanWithPlanDataSuite(new): trait-contract defaults plus reflective-slot graceful absence. 2/2.CometJoinSuite(native scan fusion and the DPP path): 28/28.Roadmap
This is part 1 of the breakup. Subsequent parts add the build gate and inert wiring, the Rust planning and read path, the Scala claim/decline and execution, Change Data Feed reads, the test battery, and docs. Each later part is gated behind
-Pcontrib-delta, so every intermediate state onmainis safe for default builds. Tracking umbrella: #4366.🤖 AI disclosure: this PR was prepared with assistance from Claude Code (Claude Opus 4.8), under the submitter's review and direction.