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 empty input to getMapValue crashing #9262

Merged
Merged
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
9 changes: 9 additions & 0 deletions java/src/main/native/src/map_lookup.cu
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ std::unique_ptr<column>
get_gather_map_for_map_values(column_view const &input, string_scalar &lookup_key,
rmm::cuda_stream_view stream, rmm::mr::device_memory_resource *mr) {
constexpr size_type block_size{256};

if (input.size() == 0) {
return make_empty_column(data_type{cudf::type_to_id<size_type>()});
}

cudf::detail::grid_1d grid{input.size(), block_size};

auto input_device_view = cudf::column_device_view::create(input, stream);
Expand Down Expand Up @@ -192,6 +197,10 @@ std::unique_ptr<column> map_lookup(column_view const &map_column, string_scalar
get_gather_map_for_map_values<true>(map_column, lookup_key, stream, mr) :
get_gather_map_for_map_values<false>(map_column, lookup_key, stream, mr);

if (gather_map->size() == 0) {
hyperbolic2346 marked this conversation as resolved.
Show resolved Hide resolved
return make_empty_column(cudf::data_type{cudf::type_id::STRING});
}

// Gather map is now available.

auto values_column = structs_column.child(1);
Expand Down