From 3de1ee5b3b3421c34f0b5539f2ba7fc622b2d821 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Tue, 2 Jan 2024 17:56:36 -0500 Subject: [PATCH] fix logic for null input entries --- cpp/src/strings/filling/fill.cu | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/cpp/src/strings/filling/fill.cu b/cpp/src/strings/filling/fill.cu index e50f16d7011..43ad3ab8e54 100644 --- a/cpp/src/strings/filling/fill.cu +++ b/cpp/src/strings/filling/fill.cu @@ -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(idx); + auto const d_str = d_strings.is_null(idx) ? string_view{} : d_strings.element(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); } } };