NVIDIA / NVIDIA/cudf

List scatter misindexes child rows for sliced sources and targets

Open
#23,818 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

Scattering into or from a sliced lists column produces wrong child rows whenever the list child is not fixed-width.

`list_child_constructor` in `cpp/src/lists/copying/scatter_helper.cu` reads the parent lists offsets with the raw row index and ignores the column view offset:

- strings branch: `strings_offset = lists_offsets_ptr[row_index] + intra_index`
- nested-lists branch: `child_row_index = lists_offsets_ptr[row_index] + intra_index`

For a sliced source or target view, `row_index` is relative to the view but the offsets data pointer is not shifted, so both reads land on the wrong offsets entry and the constructed child copies from wrong rows of the underlying buffer. The fixed-width branch is unaffected because element access goes through `list_device_view`, whose constructor already applies the offset (`offsets.element(row_index + lists_column.offset())`).

The struct branch has the same problem one level up: `project_member_as_list_view` builds the member-as-list `column_view` with the offset hardcoded to `0`, so a sliced `List` source or target misindexes both offsets values and null-mask bits inside its members.

Observed with a standalone program against libcudf 26.10 nightly: scattering a sliced 4-row `List>` source (slice {1,3}) produced leaf values `10 11 12 13 14` where `13 14 15` was expected.

Suggested fix: use `lists_column_device_view::offset_at(row_index)` (which indexes `offsets()[offset() + idx]`) at the two device sites, and pass the parent's `offset()` into `project_member_as_list_view`. Both are no-ops when `offset() == 0`.

Contributor guide

Open the contributing guide

Research direction

Start in cpp/src/lists/copying/scatter_helper.cu at list_child_constructor and inspect project_member_as_list_view for how sliced column offsets are propagated. Verify the existing scatter behavior for sliced nested-list and List sources or targets, then confirm that child rows and member null-mask bits match the expected unsliced values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.