Skip to content

compute: bucket temporally on the columnar edge - #38371

Draft
antiguru wants to merge 1 commit into
columnar-tf-join-core-builderfrom
columnar-tg-temporal-bucket-native
Draft

compute: bucket temporally on the columnar edge#38371
antiguru wants to merge 1 commit into
columnar-tf-join-core-builderfrom
columnar-tg-temporal-bucket-native

Conversation

@antiguru

@antiguru antiguru commented Aug 20, 2026

Copy link
Copy Markdown
Member

Makes temporal bucketing columnar throughout, removing the four Vec round-trips its call sites paid. The operator's state was already columnar, since its bucket chain wraps ColumnMergeBatcher, so the decode and re-encode existed only at its boundary.

Three per-record costs go with the round-trips. The reveal path handed the output builder owned tuples reconstituted from the chain's Column chunks, and now gives each chunk as a container. MergeBatcherWrapper::push_container staged its Vec argument into a Column one record at a time before the chunker could read it, and now takes a Column. Bucket::split round-tripped the sealed chunks through a Vec, cloning every record, and now re-chunks the containers.

On the input side, records are addressed by index through a permutation rather than moved, so neither the pass-through nor the bucket routing materializes an owned record. The partition happens before the sort, because only retained records need ordering and in steady state the pass-through share is the larger one.

TemporalBucketing::bucket now returns Self, which lets a Vec stream and a columnar stream both implement it. The reduce key-value path stays on the Vec implementation, which stages through the columnar operator so there is one bucketing implementation rather than two. It feeds an arrangement, and a consumer that re-encodes what it reads is cheaper to hand moved allocations than copied bytes.

Worth knowing for review: enable_compute_temporal_bucketing is compiled in as false but served on in production, so this is a live path rather than a dormant one. CPU-213 tracks reconciling the default. Verified with the flag defaulted on, since the compiled-in default otherwise leaves the operator untested outside temporal_bucketing.slt.

Posted by Claude Code

@antiguru
antiguru force-pushed the columnar-tg-temporal-bucket-native branch from d7c0cb0 to b980c29 Compare August 20, 2026 12:58
@linear-code

linear-code Bot commented Aug 20, 2026

Copy link
Copy Markdown

CPU-51

Temporal bucketing consumed and produced a `Vec` stream, so each of its
four call sites decoded the columnar edge into it and re-encoded the
result. The operator's own state was already columnar, since its bucket
chain wraps `ColumnMergeBatcher`, so the round-trips existed only at its
boundary.

The operator now consumes and produces `Column`, and the four sites hand
it the edge directly. Three per-record costs go with the round-trips:

* The reveal path handed the builder owned tuples reconstituted from the
  chain's `Column` chunks. It now gives each chunk as a container.
* `MergeBatcherWrapper::push_container` staged its `Vec` argument into a
  `Column` one record at a time before the chunker could read it. It
  takes a `Column` now, so the caller's buffer is what the chunker reads.
* `Bucket::split` round-tripped the sealed chunks through a `Vec`, cloning
  every record on the way. It re-chunks the containers.

The input side addresses records by index through a permutation rather
than moving them, so neither the pass-through nor the bucket routing
materializes an owned record. Records are partitioned before that
permutation is sorted, because only the retained ones need ordering and
in steady state the pass-through share is the larger one.

`TemporalBucketing::bucket` returns `Self` rather than a chosen container,
which lets a `Vec` stream and a columnar stream both implement it. The
reduce key-value path keeps the `Vec` implementation, which stages through
the columnar operator so there is one bucketing implementation rather than
two. That path feeds an arrangement, and a re-encoding consumer is cheaper
to hand moved allocations than copied bytes, so `MaybeBucketByTime` offers
it as a separate `_vec` method rather than converting it.
@antiguru
antiguru force-pushed the columnar-tg-temporal-bucket-native branch from b980c29 to e37c599 Compare September 6, 2026 18:23
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