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

Method InitHeader

cpp/src/parquet/decoder.cc:1516–1554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1514 static constexpr int kMaxDeltaBitWidth = static_cast<int>(sizeof(T) * 8);
1515
1516 void InitHeader() {
1517 if (!decoder_->GetVlqInt(&values_per_block_) ||
1518 !decoder_->GetVlqInt(&mini_blocks_per_block_) ||
1519 !decoder_->GetVlqInt(&total_value_count_) ||
1520 !decoder_->GetZigZagVlqInt(&last_value_)) {
1521 ParquetException::EofException("InitHeader EOF");
1522 }
1523
1524 if (values_per_block_ == 0) {
1525 throw ParquetException("cannot have zero value per block");
1526 }
1527 if (values_per_block_ % 128 != 0) {
1528 throw ParquetException(
1529 "the number of values in a block must be multiple of 128, but it's " +
1530 std::to_string(values_per_block_));
1531 }
1532 if (mini_blocks_per_block_ == 0) {
1533 throw ParquetException("cannot have zero miniblock per block");
1534 }
1535 values_per_mini_block_ = values_per_block_ / mini_blocks_per_block_;
1536 if (values_per_mini_block_ == 0) {
1537 throw ParquetException("cannot have zero value per miniblock");
1538 }
1539 if (values_per_mini_block_ % 32 != 0) {
1540 throw ParquetException(
1541 "the number of values in a miniblock must be multiple of 32, but it's " +
1542 std::to_string(values_per_mini_block_));
1543 }
1544
1545 total_values_remaining_ = total_value_count_;
1546 if (delta_bit_widths_ == nullptr) {
1547 delta_bit_widths_ = AllocateBuffer(pool_, mini_blocks_per_block_);
1548 } else {
1549 PARQUET_THROW_NOT_OK(
1550 delta_bit_widths_->Resize(mini_blocks_per_block_, /*shrink_to_fit*/ false));
1551 }
1552 first_block_initialized_ = false;
1553 values_remaining_current_mini_block_ = 0;
1554 }
1555
1556 void InitBlock() {
1557 DCHECK_GT(total_values_remaining_, 0) << "InitBlock called at EOF";

Callers

nothing calls this directly

Calls 6

ParquetExceptionFunction · 0.85
to_stringFunction · 0.85
GetVlqIntMethod · 0.80
GetZigZagVlqIntMethod · 0.80
AllocateBufferFunction · 0.70
ResizeMethod · 0.45

Tested by

no test coverage detected