| 1731 | } |
| 1732 | |
| 1733 | int Decode(ByteArray* buffer, int max_values) override { |
| 1734 | // Decode up to `max_values` strings into an internal buffer |
| 1735 | // and reference them into `buffer`. |
| 1736 | max_values = std::min(max_values, num_valid_values_); |
| 1737 | DCHECK_GE(max_values, 0); |
| 1738 | if (max_values == 0) { |
| 1739 | return 0; |
| 1740 | } |
| 1741 | |
| 1742 | int32_t data_size = 0; |
| 1743 | const int32_t* length_ptr = buffered_length_->data_as<int32_t>() + length_idx_; |
| 1744 | int bytes_offset = len_ - decoder_->bytes_left(); |
| 1745 | for (int i = 0; i < max_values; ++i) { |
| 1746 | int32_t len = length_ptr[i]; |
| 1747 | if (ARROW_PREDICT_FALSE(len < 0)) { |
| 1748 | throw ParquetException("negative string delta length"); |
| 1749 | } |
| 1750 | buffer[i].len = len; |
| 1751 | if (AddWithOverflow(data_size, len, &data_size)) { |
| 1752 | throw ParquetException("excess expansion in DELTA_(LENGTH_)BYTE_ARRAY"); |
| 1753 | } |
| 1754 | } |
| 1755 | length_idx_ += max_values; |
| 1756 | if (ARROW_PREDICT_FALSE(!decoder_->Advance(8 * static_cast<int64_t>(data_size)))) { |
| 1757 | ParquetException::EofException(); |
| 1758 | } |
| 1759 | const uint8_t* data_ptr = data_ + bytes_offset; |
| 1760 | for (int i = 0; i < max_values; ++i) { |
| 1761 | buffer[i].ptr = data_ptr; |
| 1762 | data_ptr += buffer[i].len; |
| 1763 | } |
| 1764 | this->num_values_ -= max_values; |
| 1765 | num_valid_values_ -= max_values; |
| 1766 | return max_values; |
| 1767 | } |
| 1768 | |
| 1769 | int DecodeArrow(int num_values, int null_count, const uint8_t* valid_bits, |
| 1770 | int64_t valid_bits_offset, |
nothing calls this directly
no test coverage detected