You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/25 13:46:08 UTC
[GitHub] [arrow] lidavidm commented on a change in pull request #12251: ARROW-15441: [C++][Compute] Fix incorrect result of hash_count a null type column
lidavidm commented on a change in pull request #12251:
URL: https://github.com/apache/arrow/pull/12251#discussion_r791715298
##########
File path: cpp/src/arrow/compute/kernels/hash_aggregate_test.cc
##########
@@ -2811,5 +2811,98 @@ TEST(GroupBy, SmallChunkSizeSumOnly) {
/*verbose=*/true);
}
+TEST(GroupBy, CountWithNullType) {
+ auto table =
+ TableFromJSON(schema({field("argument", null()), field("key", int64())}), {R"([
+ [null, 1],
+ [null, 1]
+ ])",
+ R"([
+ [null, 2],
+ [null, 3],
+ [null, null],
+ [null, 1],
+ [null, 2]
+ ])",
+ R"([
+ [null, 2],
+ [null, null],
+ [null, 3]
+ ])"});
+
+ CountOptions all(CountOptions::ALL);
+ CountOptions only_valid(CountOptions::ONLY_VALID);
+ CountOptions only_null(CountOptions::ONLY_NULL);
+
+ for (bool use_exec_plan : {false, true}) {
+ for (bool use_threads : {true, false}) {
+ SCOPED_TRACE(use_threads ? "parallel/merged" : "serial");
+ ASSERT_OK_AND_ASSIGN(Datum aggregated_and_grouped,
+ GroupByTest(
+ {
+ table->GetColumnByName("argument"),
+ table->GetColumnByName("argument"),
+ table->GetColumnByName("argument"),
+ },
+ {table->GetColumnByName("key")},
+ {
+ {"hash_count", &all},
+ {"hash_count", &only_valid},
+ {"hash_count", &only_null},
+ },
+ use_threads, use_exec_plan));
+ SortBy({"key_0"}, &aggregated_and_grouped);
+
+ AssertDatumsEqual(ArrayFromJSON(struct_({
+ field("hash_count", int64()),
+ field("hash_count", int64()),
+ field("hash_count", int64()),
+ field("key_0", int64()),
+ }),
+ R"([
+ [3, 0, 3, 1],
+ [3, 0, 3, 2],
+ [2, 0, 2, 3],
+ [2, 0, 2, null]
+ ])"),
+ aggregated_and_grouped,
+ /*verbose=*/true);
+ }
+ }
+}
+
+TEST(GroupBy, CountWithNullTypeEmptyTable) {
Review comment:
Was there an issue with empty tables specifically that this is checking?
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org