Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue with explode_outer position not nulling position entries of null rows #7754

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
linting
  • Loading branch information
hyperbolic2346 committed Mar 29, 2021
commit 95feefd2908a69ce6a95db3b35ac2a42585df554
32 changes: 16 additions & 16 deletions cpp/src/lists/explode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,25 @@ std::unique_ptr<table> build_table(
std::vector<std::unique_ptr<column>> columns = gathered_table.release()->release();

auto inserted = columns.insert(columns.begin() + explode_column_idx,
explode_col_gather_map
? std::move(detail::gather(table_view({sliced_child}),
explode_col_gather_map->begin(),
explode_col_gather_map->end(),
cudf::out_of_bounds_policy::NULLIFY,
stream,
mr)
->release()[0])
: std::make_unique<column>(sliced_child, stream, mr));
explode_col_gather_map
? std::move(detail::gather(table_view({sliced_child}),
explode_col_gather_map->begin(),
explode_col_gather_map->end(),
cudf::out_of_bounds_policy::NULLIFY,
stream,
mr)
->release()[0])
: std::make_unique<column>(sliced_child, stream, mr));

if (position_array) {
size_type position_size = position_array->size();
// the null mask for position matches the exploded column's gather map, so copy it over
rmm::device_buffer nullmask = explode_col_gather_map ? copy_bitmask(*inserted->get()) : rmm::device_buffer(0, stream);
columns.insert(columns.begin() + explode_column_idx,
std::make_unique<column>(
data_type(type_to_id<size_type>()), position_size, position_array->release(), nullmask));
rmm::device_buffer nullmask =
explode_col_gather_map ? copy_bitmask(*inserted->get()) : rmm::device_buffer(0, stream);
columns.insert(
columns.begin() + explode_column_idx,
std::make_unique<column>(
data_type(type_to_id<size_type>()), position_size, position_array->release(), nullmask));
hyperbolic2346 marked this conversation as resolved.
Show resolved Hide resolved
}

return std::make_unique<table>(std::move(columns));
Expand Down Expand Up @@ -242,9 +244,7 @@ std::unique_ptr<table> explode_outer(table_view const& input_table,

// negative one to indicate a null value
explode_col_gather_map_p[invalid_index] = -1;
if (include_position) {
position_array[invalid_index] = 0;
}
if (include_position) { position_array[invalid_index] = 0; }
}
};

Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/lists/explode_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,8 @@ TEST_F(ExplodeOuterTest, NullsInNestedDoubleExplode)

CUDF_TEST_EXPECT_TABLES_EQUAL(ret->view(), expected);

FCW expected_pos_col{{0, 1, 0, 0, 1, 2, 0, 1, 0, 1, 0, 0, 1}, {1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}};
FCW expected_pos_col{{0, 1, 0, 0, 1, 2, 0, 1, 0, 1, 0, 0, 1},
{1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}};
cudf::table_view pos_expected({expected_pos_col, expected_a, expected_b});

auto pos_ret = cudf::explode_outer_position(first_explode_ret->view(), 0);
Expand Down