edponce commented on a change in pull request #11257: URL: https://github.com/apache/arrow/pull/11257#discussion_r717885797
########## File path: cpp/src/arrow/compute/kernels/aggregate_test.cc ########## @@ -873,6 +873,37 @@ TYPED_TEST(TestRandomNumericCountKernel, RandomArrayCount) { } } +// +// Count Distinct +// + +class PercyTestCountKernel : public ::testing::Test { +}; + +void PercyValidateCountDistinct(const Array& input, int64_t expected) { + CountOptions non_null; +// CountOptions nulls(CountOptions::ONLY_NULL); +// CountOptions all(CountOptions::ALL); + + ASSERT_OK_AND_ASSIGN(Datum result, CallFunction("count_distinct", {input})); + AssertDatumsEqual(result, Datum(expected)); + +// ASSERT_OK_AND_ASSIGN(result, Count(input, nulls)); +// AssertDatumsEqual(result, Datum(expected.second)); + +// ASSERT_OK_AND_ASSIGN(result, Count(input, all)); +// AssertDatumsEqual(result, Datum(expected.first + expected.second)); +} + +void PercyValidateCountDistinct(const char* json, int64_t expected) { + auto array = ArrayFromJSON(int32(), json); + PercyValidateCountDistinct(*array, expected); +} + +TEST_F(PercyTestCountKernel, Percy) { + PercyValidateCountDistinct("[1, 1, 2, 2, 5, 8, 9, 9, 9, 10, 6, 6]", 7); +} Review comment: Add more tests that combine valid, nulls, etc. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org