Skip to content

Commit

Permalink
fix logic for null input entries
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Jan 2, 2024
1 parent a628339 commit 3de1ee5
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions cpp/src/strings/filling/fill.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,21 @@ namespace strings {
namespace detail {
namespace {
struct fill_fn {
column_device_view d_strings;
size_type begin;
size_type end;
string_view d_value;
column_device_view const d_strings;
size_type const begin;
size_type const end;
string_view const d_value;
size_type* d_offsets{};
char* d_chars{};

__device__ void operator()(size_type idx)
{
if (d_strings.is_null(idx)) {
if (!d_chars) d_offsets[idx] = 0;
return;
}
auto const d_str =
((begin <= idx) && (idx < end)) ? d_value : d_strings.element<string_view>(idx);
auto const d_str = d_strings.is_null(idx) ? string_view{} : d_strings.element<string_view>(idx);
auto const d_output = ((begin <= idx) && (idx < end)) ? d_value : d_str;
if (!d_chars) {
d_offsets[idx] = d_str.size_bytes();
d_offsets[idx] = d_output.size_bytes();
} else {
copy_string(d_chars + d_offsets[idx], d_str);
copy_string(d_chars + d_offsets[idx], d_output);
}
}
};
Expand Down

0 comments on commit 3de1ee5

Please sign in to comment.