Skip to content

tp: run steps which keep their rows as transforms - #7798

Merged
LalitMaganti merged 3 commits into
mainfrom
dev/lalitm/exec-transforms
Oct 7, 2026
Merged

LalitMaganti merged 3 commits into
mainfrom
dev/lalitm/exec-transforms

Conversation

@LalitMaganti

Copy link
Copy Markdown
Member

Summary

Runs AssertType, TreeNumberNodes, TreeAccumulateUp and TreeAccumulateDown
as transforms, changing the batch they are given in place.

Why

Each of these converts or appends columns and keeps every row: one batch
in, the same rows out. As operators they copied every batch into one of
their own and paid the operator's dispatch around it, which dominates on
small inputs.

Changes

  • Adds pipeline_steps_benchmark: each step run through a pipeline over a
    scan, over one row and over 2^20 rows, as a plan runs it.
  • AssertType replaces its column in place.
  • TreeNumberNodes and the accumulations append their columns in place.
  • Adds test::ProcessCopy, which runs a transform on a fresh copy of its
    input, as a pipeline hands each batch over.

IntervalFlatten, TreeParentFirst, TreeChildFirst, Sort and GroupBy stay
operators: they emit rows other than their input's, hold rows back or
emit after the input ends.

Benchmarks

Per run, operator vs transform:

Benchmark Operator Transform
BM_StepsAssertTypeAsIs/1 88.9 ns 61.4 ns
BM_StepsAssertTypeWiden/1 102.2 ns 66.7 ns
BM_StepsTreeNumberNodes/1 114.8 ns 87.0 ns
BM_StepsTreeAccumulateDown/1 182.8 ns 119.8 ns
BM_StepsTreeAccumulateUp/1 242.6 ns 132.4 ns

Over 2^20 rows every step is within 1% of before, as is every
TreeNumberNodes and tree order benchmark.

Testing

Existing unit tests, now run through Process.

Adds benchmarks running each tree and type step through a pipeline over
a scan, over one row and over 2^20 rows. Over many rows the step's own
work dominates; over one row, the pipeline's work around it does.
AssertType converts one column of each batch and keeps every row, so it
changes the batch it is given in place rather than copying it into a
batch of its own.

| Benchmark (per run) | Operator | Transform |
|---|--:|--:|
| BM_StepsAssertTypeAsIs/1 | 88.9 ns | 61.4 ns |
| BM_StepsAssertTypeWiden/1 | 102.2 ns | 66.7 ns |
| BM_StepsAssertTypeWiden/1048576 | 4.00 ms | 3.97 ms |
TreeNumberNodes, TreeAccumulateUp and TreeAccumulateDown each append
columns to the batch they are given and keep every row, so they change
it in place rather than copying it into a batch of their own. Tests run
them on a fresh copy of their input, as a pipeline hands each batch
over.

| Benchmark (per run) | Operator | Transform |
|---|--:|--:|
| BM_StepsTreeNumberNodes/1 | 114.8 ns | 87.0 ns |
| BM_StepsTreeAccumulateDown/1 | 182.8 ns | 119.8 ns |
| BM_StepsTreeAccumulateUp/1 | 242.6 ns | 132.4 ns |
| BM_StepsTreeAccumulateUp/1048576 | 52.1 ms | 51.7 ms |
@LalitMaganti
LalitMaganti requested a review from a team as a code owner October 6, 2026 20:33
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

🎨 Perfetto UI Builds & Tests

@LalitMaganti
LalitMaganti merged commit ec4d30c into main Oct 7, 2026
28 checks passed
@LalitMaganti
LalitMaganti deleted the dev/lalitm/exec-transforms branch October 7, 2026 13:27
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.

2 participants