Skip to content

Commit

Permalink
Fix gather() for STRUCT inputs with no nulls in members. (#9194)
Browse files Browse the repository at this point in the history
Fixes #9188.

Prior to this fix, when `cudf::gather()` is called on a STRUCT input
column, the null masks of the children of the result column would not
be set correctly if the child columns do not contain nulls.

This fix enforces null mask calculation if `NULLIFY` is set.

In addition, this commit also cleans up the `TypedStructGatherTest` test suite:
1. IIFEs for `STRUCT` column construction.
2. Corrections for `assert()` conditions.
3. Switched `column` construction to `column_wrapper` and `column_view`.
4. Corrected the output null mask for `TestGatherStructOfListOfStructs`.
5. Added repro test for #9188.

Authors:
  - MithunR (https://github.com/mythrocks)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Jason Lowe (https://github.com/jlowe)
  - Karthikeyan (https://github.com/karthikeyann)

URL: #9194
  • Loading branch information
mythrocks authored Sep 13, 2021
1 parent 04ae78b commit eab2486
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 274 deletions.
7 changes: 4 additions & 3 deletions cpp/include/cudf/detail/gather.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,10 @@ struct column_gatherer_impl<struct_view> {
mr);
});

auto const nullable = std::any_of(structs_column.child_begin(),
structs_column.child_end(),
[](auto const& col) { return col.nullable(); });
auto const nullable =
nullify_out_of_bounds or std::any_of(structs_column.child_begin(),
structs_column.child_end(),
[](auto const& col) { return col.nullable(); });
if (nullable) {
gather_bitmask(
// Table view of struct column.
Expand Down
Loading

0 comments on commit eab2486

Please sign in to comment.