Skip to content

compute: columnar TopK input (C3)#37749

Draft
antiguru wants to merge 1 commit into
moritz/columnar-c1from
columnar-c3-topk-input
Draft

compute: columnar TopK input (C3)#37749
antiguru wants to merge 1 commit into
moritz/columnar-c1from
columnar-c3-topk-input

Conversation

@antiguru

Copy link
Copy Markdown
Member

Remove these sections if your commit already has a good description!

Motivation

Why does this change exist? Link to a GitHub issue, design doc, Slack
thread, or explain the problem in a sentence or two. A reviewer who has
no context should understand why after reading this section.

If this implements or addresses an existing issue, it's enough to link to that:
Closes
Fixes
etc.

Description

What does this PR actually do? Focus on the approach and any non-obvious
decisions. The diff shows the code --- use this space to explain what the
diff can't tell a reviewer.

Verification

How do you know this change is correct? Describe new or existing automated
tests, or manual steps you took.

Generalize `render_topk` to consume its input as a `CollectionEdge` instead
of decoding to `Vec` up front. A new `map_topk_key` helper forms the TopK
`(key, value)` arrangement input off the edge: the `Vec` arm maps the
collection and reuses the owned row (behaviorally identical to before), and
the columnar arm reads the batch via `into_index_iter`, forms the hash and
group key from borrowed datums, and materializes the value row inline, so no
`ColumnarToVec` decode sits on the input path.

The three TopK variants (`build_topk`, `render_top1_monotonic`, and the
inline MonotonicTopK path) route their key-forming through the helper. Temporal
bucketing keeps its sanctioned leaf decode, and the rare column-limit error
path stays byte-identical on the `Vec` edge via `into_vec` (the identity there).
The intra-operator `explode_one`/`ensure_monotonic` on `Vec` are unchanged.

Producers still emit `Vec` in Wave 1, so the columnar arm is dead in
production and this adds no runtime change.

Adds `map_topk_key_arms_agree`, a cross-arm unit test feeding the same input
as a `Vec` and a columnar edge and asserting identical `(key, value)` updates
across several timestamps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@antiguru
antiguru force-pushed the columnar-c3-topk-input branch from ec81e98 to f4f4a8b Compare July 20, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant