fix: pass the session batch size to the native FilterExec #7280
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 447 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.365
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7280"
general
weight: 0.35
rich7420
Which issue does this PR close?
Closes #7268.
Part of #7267. That epic stays open: this change only helps when
spark.comet.batchSizeis lowered, and it doesn't remove the 2 GiB limit.Rationale for this change
Comet builds the native filter with
FilterExec::try_newand never sets its batch size.FilterExecmerges small output batches into bigger ones, and without a batch size it uses DataFusion's built-in default of 8192 rows. DataFusion's own physical planner passes the session batch size here; Comet's planner skipped that step.So the filter ignores
spark.comet.batchSize. The scan honors the setting and emits small batches, then the filter merges them back up to 8192 rows. With large string or binary values (for example blobs of a few hundred KB each), one merged column can pass Arrow's 2 GiB limit for 32-bit offsets. The query then fails with:org.apache.comet.CometNativeException: Offset overflow error: <n>
Lowering
spark.comet.batchSizeis the natural workaround, but today it has no effect on this path, even atbatchSize=1.What changes are included in this PR?
FilterExecBuilderand the session batch size, the same way DataFusion's planner does.CometFilterExecwrapper used for join probe sides. I checked that this match arm is the only place Comet creates aFilterExec.CometFilterExec::batch_size()accessor, so a test can check the wrapped filter.Behavior change: the filter now follows
spark.comet.batchSizein both directions.This is still a row-count limit. At 8192 rows, any string/binary column averaging more than about 256 KiB per value can still overflow. A byte limit in the coalescer (#7271) is the fix that doesn't depend on row counts. Other operators and batch sources with the same problem are tracked in #7267.
How are these changes tested?
Rust tests. Each one fails without the fix and passes with it:
filter_output_respects_session_batch_size: with a session batch size of 2, five 1-row batches that all pass the filter must come out as[2, 2, 1]. Without the fix they merge into one 5-row batch. The batches include a string column with NULL, empty and multi-byte values, and the test checks every value comes through in order.projection_prunes_filter_output_and_preserves_metrics(existing test): now plans with a session batch size of 5 and asserts the filter keeps it, with and without projection pruning.probe_filters_keep_session_batch_size(planner/join.rs): prepares a filter -> projection -> filter plan as a join probe side, and checks both wrappedCometFilterExecs keep the session batch size.SQL file test
operators/filter_varlen_values.sql: withspark.comet.batchSize=4, filters over binary, string,array<struct<binary, string>>andmap<string, binary>columns, including NULL, empty and non-ASCII values, compared with Spark. One filter keeps about one row in three, so every batch gets merged. This test checks that merged batches match Spark. It passes with or without the fix, because SQL can't see batch sizes; the Rust tests are the regression guard.