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

Function TEST_F

cpp/src/parquet/size_statistics_test.cc:251–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249};
250
251TEST_F(SizeStatisticsRoundTripTest, EnableSizeStats) {
252 auto schema = ::arrow::schema({
253 ::arrow::field("a", ::arrow::list(::arrow::list(::arrow::int32()))),
254 ::arrow::field("b", ::arrow::list(::arrow::list(::arrow::utf8()))),
255 });
256 // First two rows will be in one row group, and the other two rows in another row group.
257 auto table = ::arrow::TableFromJSON(schema, {R"([
258 [ [[1],[1,1],[1,1,1]], [["a"],["a","a"],["a","a","a"]] ],
259 [ [[0,1,null]], [["foo","bar",null]] ],
260 [ [], [] ],
261 [ [[],[null],null], [[],[null],null] ]
262 ])"});
263
264 for (auto size_stats_level :
265 {SizeStatisticsLevel::None, SizeStatisticsLevel::ColumnChunk,
266 SizeStatisticsLevel::PageAndColumnChunk}) {
267 WriteFile(size_stats_level, table, /*max_row_group_length=*/2, /*page_size=*/1);
268 ReadSizeStatistics();
269
270 if (size_stats_level == SizeStatisticsLevel::None) {
271 EXPECT_THAT(row_group_stats_,
272 ::testing::ElementsAre(kEmptyRowGroupStats, kEmptyRowGroupStats,
273 kEmptyRowGroupStats, kEmptyRowGroupStats));
274 } else {
275 EXPECT_THAT(row_group_stats_, ::testing::ElementsAre(
276 SizeStatistics{/*def_levels=*/{0, 0, 0, 0, 1, 8},
277 /*rep_levels=*/{2, 2, 5},
278 /*byte_array_bytes=*/std::nullopt},
279 SizeStatistics{/*def_levels=*/{0, 0, 0, 0, 1, 8},
280 /*rep_levels=*/{2, 2, 5},
281 /*byte_array_bytes=*/12},
282 SizeStatistics{/*def_levels=*/{0, 1, 1, 1, 1, 0},
283 /*rep_levels=*/{2, 2, 0},
284 /*byte_array_bytes=*/std::nullopt},
285 SizeStatistics{/*def_levels=*/{0, 1, 1, 1, 1, 0},
286 /*rep_levels=*/{2, 2, 0},
287 /*byte_array_bytes=*/0}));
288 }
289
290 if (size_stats_level == SizeStatisticsLevel::PageAndColumnChunk) {
291 EXPECT_THAT(
292 page_stats_,
293 ::testing::ElementsAre(
294 PageSizeStatistics{/*def_levels=*/{0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 1, 2},
295 /*rep_levels=*/{1, 2, 3, 1, 0, 2},
296 /*byte_array_bytes=*/{}},
297 PageSizeStatistics{/*def_levels=*/{0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 1, 2},
298 /*rep_levels=*/{1, 2, 3, 1, 0, 2},
299 /*byte_array_bytes=*/{6, 6}},
300 PageSizeStatistics{/*def_levels=*/{0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0},
301 /*rep_levels=*/{1, 0, 0, 1, 2, 0},
302 /*byte_array_bytes=*/{}},
303 PageSizeStatistics{/*def_levels=*/{0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0},
304 /*rep_levels=*/{1, 0, 0, 1, 2, 0},
305 /*byte_array_bytes=*/{0, 0}}));
306 } else {
307 EXPECT_THAT(page_stats_, ::testing::ElementsAre(kEmptyPageStats, kEmptyPageStats,
308 kEmptyPageStats, kEmptyPageStats));

Callers

nothing calls this directly

Calls 10

listFunction · 0.85
TableFromJSONFunction · 0.85
RecordBatchFromJSONFunction · 0.85
CombineChunksMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.70
schemaFunction · 0.50
fieldFunction · 0.50
ResetFunction · 0.50
dictionaryFunction · 0.50
num_rowsMethod · 0.45

Tested by

no test coverage detected