Skip to content

Commit

Permalink
Revert "Fix Aggregation Type Promotion: Ensure Unsigned Input Types R…
Browse files Browse the repository at this point in the history
…esult in Unsigned Output for Sum and Multiply (rapidsai#14679)"

This reverts commit a39897c.
  • Loading branch information
abellina committed Jan 25, 2024
1 parent 261bcb7 commit 663814a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cpp/include/cudf/detail/aggregation/aggregation.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1234,12 +1234,12 @@ constexpr bool is_sum_product_agg(aggregation::Kind k)
(k == aggregation::SUM_OF_SQUARES);
}

// Summing/Multiplying integers of any type, always use uint64_t for unsigned and int64_t for signed
// Summing/Multiplying integers of any type, always use int64_t accumulator
template <typename Source, aggregation::Kind k>
struct target_type_impl<Source,
k,
std::enable_if_t<std::is_integral_v<Source> && is_sum_product_agg(k)>> {
using type = std::conditional_t<std::is_unsigned_v<Source>, uint64_t, int64_t>;
using type = int64_t;
};

// Summing fixed_point numbers
Expand Down
13 changes: 5 additions & 8 deletions cpp/tests/groupby/sum_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,10 +28,10 @@ using namespace cudf::test::iterators;
template <typename V>
struct groupby_sum_test : public cudf::test::BaseFixture {};

using K = int32_t;
using supported_types = cudf::test::Concat<
cudf::test::Types<int8_t, int16_t, int32_t, int64_t, float, double, uint16_t, uint64_t>,
cudf::test::DurationTypes>;
using K = int32_t;
using supported_types =
cudf::test::Concat<cudf::test::Types<int8_t, int16_t, int32_t, int64_t, float, double>,
cudf::test::DurationTypes>;

TYPED_TEST_SUITE(groupby_sum_test, supported_types);

Expand All @@ -40,9 +40,6 @@ TYPED_TEST(groupby_sum_test, basic)
using V = TypeParam;
using R = cudf::detail::target_type_t<V, cudf::aggregation::SUM>;

static_assert(std::is_signed_v<R> == std::is_signed_v<V>,
"Both Result type and Source type must have same signedness");

cudf::test::fixed_width_column_wrapper<K> keys{1, 2, 3, 1, 2, 2, 1, 3, 3, 2};
cudf::test::fixed_width_column_wrapper<V> vals{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

Expand Down

0 comments on commit 663814a

Please sign in to comment.