eval_many reads inputs in place and keeps chunked results chunked
DecisionVerified 4 Oct 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.
Context#
eval_many used ensure_flat, which copied flat columns with nulls and joined chunked inputs up front. Lazy filters that kept no rows paid for a full join.
Decision#
- D1:
eval_manyreads inputs in place.ensure_flatis removed. Each window'sOP_LOADslices a view. Flat columns with nulls are no longer copied. - D2: when every loaded chunked input shares chunk starts, the windows are the chunks and results stay chunked (
chunked_column). Otherwise use 64Ki-row windows; a window that spans chunks joins only its slice. - D3: in-memory lazy morsels stay chunked.
- D4: a zero-row gather from a chunked column gathers from its first chunk instead of joining the whole column.
Why#
Measured: lazy filter keeping no rows 82 ms -> 0.6 ms with D4.
Rejected options#
- Joining chunked inputs up front: 5.4 ms against 1.9 ms.
- Regrouping chunks into 64Ki windows.
- Keeping layouts in the lazy filter's kept rows: no gain, and a selection keeps the whole morsel alive.
Also found by searching
- lazy filter that keeps no rows is slow on a chunked column
- should eval_many join chunked inputs before evaluating
- how does eval_many window chunked columns
- zero-row gather from chunked column joins the whole column