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

Function MakeDataPage

cpp/src/parquet/test_util.h:348–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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