Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Nghia Truong <[email protected]>
  • Loading branch information
ttnghia committed Dec 20, 2024
1 parent 5131fd0 commit e59c5cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cpp/tests/groupby/host_udf_example_tests.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>

#include <cuda/std/limits>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/transform.h>
Expand Down Expand Up @@ -166,7 +167,9 @@ struct host_udf_groupby_example : cudf::host_udf_base {
{
auto const start = offsets[idx];
auto const end = offsets[idx + 1];
if (start == end) { return {OutputType{0}, -1}; }

auto constexpr invalid_idx = cuda::std::numeric_limits<cudf::size_type>::lowest();
if (start == end) { return {OutputType{0}, invalid_idx}; }

auto sum_sqr = OutputType{0};
bool has_valid{false};
Expand All @@ -177,7 +180,7 @@ struct host_udf_groupby_example : cudf::host_udf_base {
sum_sqr += val * val;
}

if (!has_valid) { return {OutputType{0}, -1}; }
if (!has_valid) { return {OutputType{0}, invalid_idx}; }
return {static_cast<OutputType>(group_indices[start] + 1) * sum_sqr -
static_cast<OutputType>(group_max[idx]) * static_cast<OutputType>(group_sum[idx]),
idx};
Expand Down

0 comments on commit e59c5cd

Please sign in to comment.