You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "sfc-gh-ebrossard (via GitHub)" <gi...@apache.org> on 2023/08/03 18:37:49 UTC
[GitHub] [arrow] sfc-gh-ebrossard commented on a diff in pull request #37016: GH-37014: [C++][Parquet] Preserve some Parquet distinct counts when merging stats
sfc-gh-ebrossard commented on code in PR #37016:
URL: https://github.com/apache/arrow/pull/37016#discussion_r1283579685
##########
cpp/src/parquet/statistics_test.cc:
##########
@@ -645,6 +645,50 @@ class TestStatisticsHasFlag : public TestStatistics<TestType> {
EXPECT_FALSE(merged_statistics->HasDistinctCount());
EXPECT_FALSE(merged_statistics->Encode().has_distinct_count);
});
+
+ // Create a statistics object with zero distinct count. Merging preserves the distinct
+ // count if either side is zero.
+ std::shared_ptr<TypedStatistics<TestType>> statistics3;
+ std::shared_ptr<TypedStatistics<TestType>> statistics4;
+ {
+ EncodedStatistics encoded_statistics3;
+ encoded_statistics3.has_distinct_count = true;
+ encoded_statistics3.distinct_count = 0;
+ statistics3 = std::dynamic_pointer_cast<TypedStatistics<TestType>>(
+ Statistics::Make(this->schema_.Column(0), &encoded_statistics3,
+ /*num_values=*/0));
+ EXPECT_TRUE(statistics3->HasDistinctCount());
+
+ EncodedStatistics encoded_statistics4;
+ encoded_statistics4.has_distinct_count = true;
+ encoded_statistics4.distinct_count = 10;
+ statistics4 = std::dynamic_pointer_cast<TypedStatistics<TestType>>(
+ Statistics::Make(this->schema_.Column(0), &encoded_statistics4,
+ /*num_values=*/10));
+ EXPECT_TRUE(statistics4->HasDistinctCount());
+ }
+
+ // Both sides have 0 for the distinct count.
+ VerifyMergedStatistics(*statistics3, *statistics3,
+ [](TypedStatistics<TestType>* merged_statistics) {
+ EXPECT_TRUE(merged_statistics->HasDistinctCount());
Review Comment:
Sorry, these tests are still failing. I'll see if I can get them running locally with https://arrow.apache.org/docs/developers/cpp/development.html#running-unit-tests and figure out what I've missed here.
--
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