Skip to content

[coalesce] Add specialized StringArray path for push_batch_with_indices #11563

In review

Description

@Rich-T-kid

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Part of #7761 and related to #7764.

#11174 routes non-null UInt32 indices through BatchCoalescer::push_batch_with_index. Primitive, byte-view, and fixed-size binary arrays have specialized indexed-copy implementations, but StringArray still uses the generic copy_rows_by_indices fallback.

That fallback calls take to materialize the selected strings and then feeds the result through GenericInProgressArray, so the indexed path does not avoid the extra UTF-8 materialization and copy.

The GKE benchmark run shows the regression most clearly for sparse single_utf8 inputs:

nulls selectivity main #11174 change
0 0.001 35.8 ms 43.6 ms 22% slower
0 0.01 12.1 ms 13.1 ms 8% slower
0.1 0.001 46.3 ms 53.3 ms 15% slower
0.1 0.01 13.7 ms 14.7 ms 8% slower

Describe the solution you'd like

Add a specialized indexed-copy implementation for StringArray that gathers offsets, copies selected values directly into the in-progress buffers, and gathers nulls without first building an intermediate array with take.

The implementation should preserve the existing bounds-checking contract and cover nullable and non-null arrays, repeated or out-of-order indices, and chunking across the target batch size.

Use coalesce_kernels with BENCH_FILTER=take to verify the sparse single_utf8 cases recover the regression without hurting dense or mixed UTF-8 cases.

Additional context

#7764 tracks specialization of the regular push_batch path. This issue is narrower: the indexed push_batch_with_indices / copy_rows_by_indices path introduced in #11174.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions