test: cover the arrangement bucketing site and name the reduce one - #38807
test: cover the arrangement bucketing site and name the reduce one#38807antiguru wants to merge 1 commit into
Conversation
The runtime fixtures claimed to cover the arrangement re-encode in `ensure_collections`, but a temporal filter above a GROUP BY buckets the keyed `(key, val)` stream inside `render_reduce`, which bypasses `ensure_collections` entirely. So no fixture reached either arrangement site, and the one site whose result propagates was untested: `arrange_collection` hands back a passthrough that becomes the bundle's collection for every later consumer. Add an index on a temporal-filtered view, which routes through the loop that builds the requested arrangements, and pin its plan so the fixture cannot silently stop reaching the site if lowering stops marking the `ArrangeBy`. Point the reduce fixture's comment at `render_reduce`, and rewrite the block header to say which site each fixture covers. Two neighboring comments went stale when bucketing became columnar-native and the edge collapsed to a single representation: there is no re-encode at the TopK site any more, and both legs of the mixed `Union` are columnar whatever their strategy, so the interesting part is that one leg skipped the bucketer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
8b0cbc5 to
293c46e
Compare
bobbyiliev
left a comment
There was a problem hiding this comment.
LGTM otherwise, the relabels match what I see in reduce.rs, top_k.rs and context.rs. A few small questions inline, none blocking.
| 1 | ||
| 3 | ||
|
|
||
| # Bucketed arrangement: an index on a temporal-filtered view. `ensure_collections` |
There was a problem hiding this comment.
If I'm reading this right, the index is the terminal consumer here and the SELECT reads the arrangement, so the passthrough itself might not have a runtime consumer in this shape? Not blocking, just wondering if that part is covered.
| CREATE DEFAULT INDEX ON rt_indexed | ||
|
|
||
| query I rowsort | ||
| SELECT k FROM rt_indexed |
There was a problem hiding this comment.
I think all four rows sit inside the window, so this would catch dropped records but maybe not a leaked expired row? Might not be worth the churn to the earlier pinned results though.
| # output, which reaches `concat_many` as a columnar edge like the other leg. | ||
| # Runtime tests. These turn `enable_compute_temporal_bucketing` on and assert | ||
| # that the bucketed dataflows still produce the correct logical results. There | ||
| # is one fixture per site that applies bucketing, because each site hands the |
There was a problem hiding this comment.
Tiny nit: maybe say "arrangement loop" here, so this doesn't read as covering both ensure_collections sites?
Follow-up to a review comment on #37787, which pointed out that the runtime fixtures did not cover what their comments claimed.
rt_reducewas labelled as hitting the arrangement re-encode incontext.rs, but a temporal filter above a GROUP BY buckets the keyed(key, val)stream insiderender_reduce, which builds its arrangement from aKeyValPlanand bypassesensure_collections. The file's own header already said so three hundred lines above the label. With that fixture accounted for elsewhere, neither arrangement site had a runtime test, and the one whose result propagates was the gap:arrange_collectionreturns a passthrough that becomes the bundle's collection for every later consumer, so a dropped record there left the whole runtime block green.This adds an index on a temporal-filtered view, which reaches the loop that builds the requested arrangements, and asserts both its physical plan and its query results. The plan is pinned because the site is only reached while lowering marks the
ArrangeBywithstrategy=TemporalBucketing; without that assertion the fixture could stop covering the site without failing. The remaining site needs the raw collection to be formed from an arrangement in the sameensure_collectionscall that builds one, and I could not construct a SQL shape that reaches it with bucketing selected. Amz_now()predicate is applied at the top of an MFP chain, so it lifts above a join rather than landing in anArrangeBy's input MFP, and an index on a temporal-filtered view splits into two dataflow objects whose first half builds no arrangement. That site may be unreachable for bucketing, but this PR does not claim so.Two neighboring comments also went stale earlier in the stack. There is no re-encode at the TopK site since bucketing became columnar-native, and both legs of the mixed
Unionare columnar whatever their strategy since the edge collapsed to a single representation, so the property worth stating is that one leg skipped the bucketer.Only
test/sqllogictest/temporal_bucketing.sltchanges.🤖 Generated with Claude Code