stream ROW_NUMBER output by input batch #7461
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.48) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 513 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.373
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7461"
general
weight: 0.35
comphead
Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example
Closes #123indicates that this PR will close issue #123.-->
Closes #7466.
Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
ROW_NUMBERcurrently uses the generic bounded window executor, which performs per-partition state management and batch slicing even though this function only needs a counter and partition boundary detection. That overhead is particularly expensive for many small window partitions.What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
RowNumberExecto generate row numbers directly within each input batch, carrying the final partition key and counter across batches.ROW_NUMBERwith matching partition and ordering keys.ROW_NUMBERexpressions.How are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
The 12 operator tests pass in an isolated harness. The Spark test additions compile but have not been executed locally.
Benchmark results
Median runtime for 262,144 rows in 32 batches of 8,192 rows, using three string partition keys. Measurements pool two runs of 10 samples each on an Apple M3 Max. The repeat measures streaming first.
The unchanged benchmark source ran in an isolated harness using Comet’s release settings, DataFusion 55.2.0, and Arrow 59.3.2. These measurements cover window execution over already-sorted input.
Input / rows per partition | Base ms | Candidate ms | Speedup range
-- | -- | -- | --
String keys / 1 | 270–284 | 3.76–13.67 | 20–75×
String keys / 4 | 71.47–72.01 | 3.01–3.07 | 23.3–23.9×
String keys / 64 | 10.61–10.81 | 2.55–2.57 | 4.1–4.2×
String keys / 16,384 | 7.26–7.57 | 2.54–2.56 | 2.8–3.0×
String keys / 262,144 | 8.46–22.53 | 2.52–2.54 | 3.3–8.9×
Bigint keys / 4 | 51.48–52.32 | 0.737–0.741 | 69.5–71.0×
Bigint keys / 16,384 | 4.83–4.85 | 0.318–0.320 | 15.1–15.3×
Global window | 4.26–18.01 | 0.235–0.386 | 11–77×
18 carried columns / 4 | 137–288 | 3.04–12.56 | 11–95×
18 carried columns / 16,384 | 11.35–30.92 | 2.56–2.61 | 4.4–12.1×