compute: Emit TopK monotonic and basic output as the columnar edge - #37783
compute: Emit TopK monotonic and basic output as the columnar edge#37783antiguru wants to merge 3 commits into
Conversation
ddd570d to
c790948
Compare
c790948 to
31a84a6
Compare
31a84a6 to
2f27548
Compare
2f27548 to
1536039
Compare
1536039 to
15eb779
Compare
15eb779 to
10e7a85
Compare
10e7a85 to
8ee12e6
Compare
8ee12e6 to
40d648a
Compare
| let (oks, errs) = self.build_topk( | ||
| ok_input, group_key, order_key, offset, limit, arity, buckets, | ||
| ); |
There was a problem hiding this comment.
Note: We should remember to push columnar containers further down into top-k.
There was a problem hiding this comment.
Recorded as a TODO on topk_result_to_columnar, the seam that owns the encode:
/// TODO: TopK renders its stages over `Vec` containers, so this encode sits at
/// the very end of the plan. Pushing columnar containers down through
/// `build_topk` and the monotonic path would remove it.
Both TopK paths reach the edge through that one function, the monotonic arm directly and the basic arm via build_topk, so a single note covers the whole operator rather than one per call site.
Doing the push-down itself needs the same treatment mz_join_core got in #38368: build_topk's stages chain through arrangements, so only the last stage can write the output edge, and the fallible-limit arm materializes rows before the demux. Happy to take it as a follow-up PR on top of the stack if you want it before this lands.
Posted by Claude Code
40d648a to
8def045
Compare
Flip the two TopK plans that build a result collection (MonotonicTopK and Basic) to produce a `CollectionEdge::Columnar` via a shared `topk_result_to_columnar` helper. The bucketed MonotonicTop1 plan emits an arrangement and is materialized by the shared `as_specific_collection` path, so it is untouched. Both sites drop the hash-key pairing from a `consolidate_named`-consolidated `(hash_key, row)` collection. The hash key is a function of the row, so the drop is injective and the output has no within-batch duplicates. A non-consolidating `ColumnBuilder` therefore matches the prior `map` semantics, and the row is pushed borrowed. The err collection stays `Vec`, and the intra-operator machinery stays on `Vec`. Also corrects a stale comment on `map_topk_key`: its columnar arm runs once the input edge is columnar, which the upstream producers now emit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment-only, no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TopK renders its stages over `Vec` containers, so the columnar output edge is produced by a single encode at the end of the plan. Note at that seam that the encode disappears once the stages themselves carry columnar containers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
23a66b9 to
b1c836e
Compare
Monotonic and basic TopK emit their
from_collectionsoutput as the columnar edge. Bucketed TopK is already covered by the shared arrangement-materialization path (P5).Columnar dataflow-edge migration. Design doc:
doc/developer/design/20260720_columnar_dataflow_edges.md(#37744).Part of CPU-51.