MCPcopy Create free account
hub / github.com/apache/arrow / TestMerge

Method TestMerge

cpp/src/parquet/statistics_test.cc:380–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378 }
379
380 void TestMerge() {
381 int num_null[2];
382 random_numbers(2, 42, 0, 100, num_null);
383
384 auto statistics1 = MakeStatistics<TestType>(this->schema_.Column(0));
385 this->GenerateData(1000);
386 statistics1->Update(this->values_ptr_, this->values_.size() - num_null[0],
387 num_null[0]);
388
389 auto statistics2 = MakeStatistics<TestType>(this->schema_.Column(0));
390 this->GenerateData(1000);
391 statistics2->Update(this->values_ptr_, this->values_.size() - num_null[1],
392 num_null[1]);
393
394 auto total = MakeStatistics<TestType>(this->schema_.Column(0));
395 total->Merge(*statistics1);
396 total->Merge(*statistics2);
397
398 ASSERT_EQ(num_null[0] + num_null[1], total->null_count());
399 ASSERT_EQ(this->values_.size() * 2 - num_null[0] - num_null[1], total->num_values());
400 ASSERT_EQ(total->min(), std::min(statistics1->min(), statistics2->min()));
401 ASSERT_EQ(total->max(), std::max(statistics1->max(), statistics2->max()));
402 }
403
404 void TestEquals() {
405 const auto n_values = 1;

Callers 1

TYPED_TESTFunction · 0.80

Calls 10

random_numbersFunction · 0.85
ColumnMethod · 0.45
GenerateDataMethod · 0.45
UpdateMethod · 0.45
sizeMethod · 0.45
MergeMethod · 0.45
null_countMethod · 0.45
num_valuesMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected