feat: integrate MIN/MAX reader filtering with Spark 2/n #7657
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 381 lines diff across 4 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.356
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7657"
general
weight: 0.35
sunchao
Which issue does this PR close?
Part 2 of #5774, following the merged native reader-filter foundation in #7598. This PR does not close the issue.
Rationale for this change
For
SELECT MIN(id) FROM parquet_table, each Spark task can tighten its bound as it reads input and skip later row groups that cannot improve its partial result. The final aggregate combines those partial results as usual.What changes are included in this PR?
Add
spark.comet.exec.aggregate.dynamicFilter.enabled, disabled by default. Capture the flag only for nonempty, ungrouped aggregates whose expressions all use raw-input Partial mode, and include it in Spark plan equality so execution and plan reuse preserve the setting chosen during planning.When enabled, the Rust planner uses
MinMaxReaderFilterExecfor the narrow subset supported by #7598: one unfiltered MIN or MAX over a direct signed-integer column, without grouping, in raw-input Partial mode over an eligible native Parquet scan. Bounds remain local to each execution. Unsupported plans retain ordinary aggregation; Final/PartialMerge stages and JVM boundaries remain ineligible.Only the enabled path removes a matching integer column's identity cast, allowing DataFusion to recognize the bound producer. The disabled path retains that cast and avoids DataFusion's otherwise unconsumed bound updates. Spark displays reader-filter attachment counters only on aggregates whose captured flag is enabled; pruning and byte metrics remain on scans.
Register the new Spark suite in Linux and macOS CI. Benchmarks and detailed tuning documentation remain for PR 3; the configuration description documents the current limits.
How are these changes tested?
CometMinMaxSuite: 9 tests passed on Spark 4.1.3. Filtering off/on matches Spark for all four signed integer types, multiple Spark partitions with AQE off/on, and unsupported plans. The eight-row-group fixture includes an all-null group and actual type minimum/maximum values after bounds improve, and asserts dynamic pruning plus row/byte reductions. Tests also cover captured flags, conditional metrics, canonicalization, DISTINCT and merge stages, and a Comet Partial above a JVM-to-Arrow boundary with no reader attachment.min_max_dynamic_filter.sql: both config-matrix variants passed, covering empty, all-null, and duplicate/mixed input with separate MIN and MAX queries.dev/release/check-rat.sh HEAD) passed. The raw text fixture from #6784 has an exact-path RAT exemption, consistent with the existing data-fixture exclusions.