perf: benchmark and document MIN/MAX reader filtering 3/n #7683
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7683"
general
weight: 0.35
sunchao
Which issue does this PR close?
Part of #5774. Follows the merged reader support (#7598) and Spark integration (#7657).
TL;DR performance
Measured on 8.39M INT rows, uncompressed Parquet,
local[1], in both mode orders. Times below are filtering off → on.MAX, one task, improved 74 → 48 ms and 87 → 44 ms across the two runs (about 1.5–2.0× faster).MAXwith four tasks took 63 → 179 ms and 67 → 125 ms, with high variance despite pruning.Timings are sensitive to warmup and outliers; scan savings do not guarantee faster queries. The feature remains disabled by default. Full means, standard deviations, and counters are below.
Rationale for this change
MIN/MAX reader filtering can skip later Parquet row groups after a task observes a useful bound. The benefit depends on data order and task boundaries, while footer inspection and bound updates add overhead. This adds an off/on benchmark and documents eligibility, fallback limits, and metrics before considering broader enablement.
What changes are included in this PR?
CometMinMaxBenchmark: separate MIN and MAX queries over ascending, descending, deterministic random, and constant INT data, with one or four scan tasks by default. It checks Spark result parity, the direct scan/partial aggregate plan, actual task count, and per-task filter attachment before timing.The existing configuration remains disabled by default. Runtime behavior and supported scope are unchanged. The benchmark and documentation are in separate commits.
How are these changes tested?
-Ctarget-cpu=native -Clink-arg=-fuse-ld=bfdand the standard release profile/default features.test-compile, including formatting and style checks, passed. Packaged binary/source jar-content checks passed (the final check was rerun with JDK tools on PATH).prettier --check "*/.md"passed after formatting the two new user-guide tables.git diff --checkpassed.Local release measurements
Environment: AMD EPYC-Genoa, 32 logical CPUs, about 98 GiB RAM, Ubuntu 24.04.4/Linux 6.8; Spark 4.1.3, OpenJDK 21.0.13.0.3, Rust 1.99.1. Spark used
local[1]and an 8 GiB benchmark JVM heap. Production code is fromd187e6823; the benchmark is in this PR'sd2f9fdfc6commit. Each fixture contained 8,388,608 rows and nine row groups per file. Four scan tasks ran serially underlocal[1].Equivalent standard invocations after the same release build:
Favorable ordering and constant values reduced emitted scan rows and requested data bytes by about 87.5%. The unfavorable ordered cases pruned no groups and expose filtering overhead. Random layouts pruned some groups but did not consistently improve elapsed time. These short local runs are sensitive to warmup and long-tail outliers; the first ascending-MIN timing even changes direction when case order reverses. This is evidence of scan-work reduction and overhead cases, not a general speedup claim or a basis to enable the feature by default.
<details>
<summary>All elapsed times and scan-work counters</summary>
Times are mean ± standard deviation in milliseconds, always shown as off → on, regardless of execution order. Every off execution emitted 8,388,608 rows and pruned zero groups. The byte column is
bytes_scannedin bytes, excluding metadata. All on attachment counts equaled the scan-task count; skipped counts were zero. Statistics, page-index, and decoder pruning counters were zero.| Tasks | Layout | Aggregate | On scan rows | Groups pruned | Data bytes off → on | Mean ± SD, off-first | Mean ± SD, on-first |
| ---: | --- | --- | ---: | ---: | --- | --- | --- |
| 1 | ascending | MIN | 1,048,287 | 8 | 33,566,729 → 4,194,680 | 176 ± 21 → 101 ± 22 | 77 ± 10 → 135 ± 96 |
| 1 | ascending | MAX | 8,388,608 | 0 | 33,566,729 → 33,566,729 | 105 ± 4 → 98 ± 5 | 81 ± 3 → 96 ± 7 |
| 1 | descending | MIN | 8,388,608 | 0 | 33,566,728 → 33,566,728 | 73 ± 4 → 84 ± 6 | 69 ± 3 → 68 ± 6 |
| 1 | descending | MAX | 1,048,287 | 8 | 33,566,728 → 4,194,682 | 74 ± 5 → 48 ± 5 | 87 ± 12 → 44 ± 3 |
| 1 | random | MIN | 3,144,861 | 6 | 33,570,132 → 12,585,317 | 63 ± 4 → 67 ± 10 | 62 ± 4 → 54 ± 6 |
| 1 | random | MAX | 5,241,435 | 4 | 33,570,132 → 20,975,530 | 62 ± 2 → 62 ± 1 | 65 ± 3 → 63 ± 3 |
| 1 | constant | MIN | 1,048,287 | 8 | 33,566,756 → 4,194,685 | 53 ± 9 → 102 ± 152 | 60 ± 4 → 42 ± 8 |
| 1 | constant | MAX | 1,048,287 | 8 | 33,566,756 → 4,194,685 | 56 ± 4 → 59 ± 14 | 64 ± 9 → 48 ± 1 |
| 4 | ascending | MIN | 1,048,196 | 32 | 33,567,471 → 4,194,401 | 78 ± 3 → 73 ± 15 | 76 ± 1 → 66 ± 3 |
| 4 | ascending | MAX | 8,388,608 | 0 | 33,567,471 → 33,567,471 | 70 ± 3 → 87 ± 18 | 79 ± 5 → 107 ± 21 |
| 4 | descending | MIN | 8,388,608 | 0 | 33,567,469 → 33,567,469 | 73 ± 2 → 88 ± 15 | 79 ± 2 → 94 ± 5 |
| 4 | descending | MAX | 1,048,196 | 32 | 33,567,469 → 4,194,400 | 59 ± 2 → 69 ± 17 | 74 ± 4 → 68 ± 15 |
| 4 | random | MIN | 3,144,588 | 24 | 33,571,051 → 12,584,536 | 61 ± 2 → 72 ± 17 | 61 ± 3 → 64 ± 2 |
| 4 | random | MAX | 3,406,637 | 23 | 33,571,051 → 13,633,247 | 63 ± 4 → 179 ± 196 | 67 ± 2 → 125 ± 46 |
| 4 | constant | MIN | 1,048,196 | 32 | 33,567,496 → 4,194,404 | 75 ± 3 → 64 ± 14 | 95 ± 9 → 50 ± 14 |
| 4 | constant | MAX | 1,048,196 | 32 | 33,567,496 → 4,194,404 | 68 ± 2 → 58 ± 1 | 81 ± 11 → 68 ± 13 |
Reader
scan_io_data_bytesequaledbytes_scanned.scan_io_metadata_byteswas 524,288 bytes per task in each mode (524,288 for one task and 2,097,152 for four); attachment does not eliminate footer inspection. Timings include planning and result collection, while fixture generation, Spark parity checks, plan validation, and metric reporting are outside the timed cases.</details>