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

Function TEST_F

cpp/src/parquet/size_statistics_test.cc:243–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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