| 40 | namespace parquet { |
| 41 | |
| 42 | TEST(SizeStatistics, UpdateLevelHistogram) { |
| 43 | { |
| 44 | // max_level = 1 |
| 45 | std::vector<int64_t> histogram(2, 0); |
| 46 | UpdateLevelHistogram(std::vector<int16_t>{0, 1, 1, 1, 0}, histogram); |
| 47 | EXPECT_THAT(histogram, ::testing::ElementsAre(2, 3)); |
| 48 | UpdateLevelHistogram(std::vector<int16_t>{1, 1, 0}, histogram); |
| 49 | EXPECT_THAT(histogram, ::testing::ElementsAre(3, 5)); |
| 50 | UpdateLevelHistogram(std::vector<int16_t>{}, histogram); |
| 51 | EXPECT_THAT(histogram, ::testing::ElementsAre(3, 5)); |
| 52 | } |
| 53 | { |
| 54 | // max_level > 1 |
| 55 | std::vector<int64_t> histogram(3, 0); |
| 56 | UpdateLevelHistogram(std::vector<int16_t>{0, 1, 2, 2, 0}, histogram); |
| 57 | EXPECT_THAT(histogram, ::testing::ElementsAre(2, 1, 2)); |
| 58 | UpdateLevelHistogram(std::vector<int16_t>{1, 1, 0}, histogram); |
| 59 | EXPECT_THAT(histogram, ::testing::ElementsAre(3, 3, 2)); |
| 60 | UpdateLevelHistogram(std::vector<int16_t>{}, histogram); |
| 61 | EXPECT_THAT(histogram, ::testing::ElementsAre(3, 3, 2)); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | TEST(SizeStatistics, ThriftSerDe) { |
| 66 | const std::vector<int64_t> kDefLevels = {128, 64, 32, 16}; |
nothing calls this directly
no test coverage detected