feat: preserve columnar batches across observations #7325
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 470 lines diff across 5 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.368
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7325"
general
weight: 0.35
sunchao
Which issue does this PR close?
Closes #7324. Related to #5124; metric evaluation remains in Spark, so this does not implement the fully native collector proposed there.
Rationale for this change
A Parquet scan followed by
observe(count(lit(1)).as("rows"))and a grouped aggregation currently introduces a row boundary at the observation. Preserve the observation results while passing Arrow batches between eligible native operators.What changes are included in this PR?
CometCollectMetricsExec, enabled byspark.comet.exec.collectMetrics.enabled. Spark evaluates the metric expressions over batch row views and retains ownership of accumulator publication, observation discovery and resets. The original Arrow batch then feeds the downstream native block.CometCollectMetricsSuitein Linux and macOS CI, with Spark-version-specific aggregate test helpers.How are these changes tested?
The focused suite compares output rows and observations with Spark, covering AQE on/off, empty inputs, repeated execution, aggregate-state publication, limits, joins, iterator consumers, sampling, stage reversion and disabled configuration. It also covers mixed struct representations in
mode, JSON expression caches at task serialization, multi-batch structs, direct column closure,collect_list/collect_setover structs containing calendar intervals, and null padding inarray_insertacross the observation boundary, with AQE off/on and explicit replanning that checks collector identity and native projection. The null-padding regression reproduced the Arrow failure before both the initial-conversion fix and the replanning fix. The partial iterator tests include a trailing shuffle to exercise the row-consumption guard.CometCollectMetricsSuitepassed all 23 tests, including the two new complex-value regressions.-Pstrict-warnings:CometCollectMetricsSuitepassed all 23 tests; main and test sources compiled successfully.git diff --checkpassed. Two independent reviews approved the fixes.Spark 4.1's optional strict-warning profile reports four preexisting errors in
CometShuffleExchangeExecandCometArrowPythonRunnerBase; its normal profile passes. A maintainer needs to applyrun-all-spark-profilesandrun-spark-4.1-testsfor broader version and Spark SQL coverage; the author account cannot add these labels.