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

Function MakeDataPage

cpp/src/parquet/test_util.h:350–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348
349template <typename Type>
350static std::shared_ptr<DataPageV1> MakeDataPage(
351 const ColumnDescriptor* d, const std::vector<typename Type::c_type>& values,
352 int num_vals, Encoding::type encoding, const uint8_t* indices, int indices_size,
353 const std::vector<int16_t>& def_levels, int16_t max_def_level,
354 const std::vector<int16_t>& rep_levels, int16_t max_rep_level) {
355 int num_values = 0;
356
357 auto page_stream = CreateOutputStream();
358 test::DataPageBuilder<Type> page_builder(page_stream.get());
359
360 if (!rep_levels.empty()) {
361 page_builder.AppendRepLevels(rep_levels, max_rep_level);
362 }
363 if (!def_levels.empty()) {
364 page_builder.AppendDefLevels(def_levels, max_def_level);
365 }
366
367 if (encoding == Encoding::PLAIN) {
368 page_builder.AppendValues(d, values, encoding);
369 num_values = std::max(page_builder.num_values(), num_vals);
370 } else { // DICTIONARY PAGES
371 PARQUET_THROW_NOT_OK(page_stream->Write(indices, indices_size));
372 num_values = std::max(page_builder.num_values(), num_vals);
373 }
374
375 PARQUET_ASSIGN_OR_THROW(auto buffer, page_stream->Finish());
376
377 return std::make_shared<DataPageV1>(buffer, num_values, encoding,
378 page_builder.def_level_encoding(),
379 page_builder.rep_level_encoding(), buffer->size());
380}
381
382template <typename TYPE>
383class DictionaryPageBuilder {

Callers

nothing calls this directly

Calls 11

CreateOutputStreamFunction · 0.85
def_level_encodingMethod · 0.80
rep_level_encodingMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
AppendRepLevelsMethod · 0.45
AppendDefLevelsMethod · 0.45
AppendValuesMethod · 0.45
num_valuesMethod · 0.45
WriteMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected