| 1532 | } |
| 1533 | |
| 1534 | void InitHeader() { |
| 1535 | if (!decoder_->GetVlqInt(&values_per_block_) || |
| 1536 | !decoder_->GetVlqInt(&mini_blocks_per_block_) || |
| 1537 | !decoder_->GetVlqInt(&total_value_count_) || |
| 1538 | !decoder_->GetZigZagVlqInt(&last_value_)) { |
| 1539 | ParquetException::EofException("InitHeader EOF"); |
| 1540 | } |
| 1541 | |
| 1542 | if (values_per_block_ == 0) { |
| 1543 | throw ParquetException("cannot have zero value per block"); |
| 1544 | } |
| 1545 | if (values_per_block_ % 128 != 0) { |
| 1546 | throw ParquetException( |
| 1547 | "the number of values in a block must be multiple of 128, but it's " + |
| 1548 | std::to_string(values_per_block_)); |
| 1549 | } |
| 1550 | if (mini_blocks_per_block_ == 0) { |
| 1551 | throw ParquetException("cannot have zero miniblock per block"); |
| 1552 | } |
| 1553 | values_per_mini_block_ = values_per_block_ / mini_blocks_per_block_; |
| 1554 | if (values_per_mini_block_ == 0) { |
| 1555 | throw ParquetException("cannot have zero value per miniblock"); |
| 1556 | } |
| 1557 | if (values_per_mini_block_ % 32 != 0) { |
| 1558 | throw ParquetException( |
| 1559 | "the number of values in a miniblock must be multiple of 32, but it's " + |
| 1560 | std::to_string(values_per_mini_block_)); |
| 1561 | } |
| 1562 | |
| 1563 | total_values_remaining_ = total_value_count_; |
| 1564 | if (delta_bit_widths_ == nullptr) { |
| 1565 | delta_bit_widths_ = AllocateBuffer(pool_, mini_blocks_per_block_); |
| 1566 | } else { |
| 1567 | PARQUET_THROW_NOT_OK( |
| 1568 | delta_bit_widths_->Resize(mini_blocks_per_block_, /*shrink_to_fit*/ false)); |
| 1569 | } |
| 1570 | first_block_initialized_ = false; |
| 1571 | values_remaining_current_mini_block_ = 0; |
| 1572 | } |
| 1573 | |
| 1574 | void InitBlock() { |
| 1575 | DCHECK_GT(total_values_remaining_, 0) << "InitBlock called at EOF"; |
nothing calls this directly
no test coverage detected