| 1780 | } |
| 1781 | |
| 1782 | int Decode(ByteArray* buffer, int max_values) override { |
| 1783 | // Decode up to `max_values` strings into an internal buffer |
| 1784 | // and reference them into `buffer`. |
| 1785 | max_values = std::min(max_values, num_valid_values_); |
| 1786 | DCHECK_GE(max_values, 0); |
| 1787 | if (max_values == 0) { |
| 1788 | return 0; |
| 1789 | } |
| 1790 | |
| 1791 | int32_t data_size = 0; |
| 1792 | const int32_t* length_ptr = buffered_length_->data_as<int32_t>() + length_idx_; |
| 1793 | int bytes_offset = len_ - decoder_->bytes_left(); |
| 1794 | for (int i = 0; i < max_values; ++i) { |
| 1795 | int32_t len = length_ptr[i]; |
| 1796 | if (ARROW_PREDICT_FALSE(len < 0)) { |
| 1797 | throw ParquetException("negative string delta length"); |
| 1798 | } |
| 1799 | buffer[i].len = len; |
| 1800 | if (AddWithOverflow(data_size, len, &data_size)) { |
| 1801 | throw ParquetException("excess expansion in DELTA_(LENGTH_)BYTE_ARRAY"); |
| 1802 | } |
| 1803 | } |
| 1804 | length_idx_ += max_values; |
| 1805 | if (ARROW_PREDICT_FALSE(!decoder_->Advance(8 * static_cast<int64_t>(data_size)))) { |
| 1806 | ParquetException::EofException(); |
| 1807 | } |
| 1808 | const uint8_t* data_ptr = data_ + bytes_offset; |
| 1809 | for (int i = 0; i < max_values; ++i) { |
| 1810 | buffer[i].ptr = data_ptr; |
| 1811 | data_ptr += buffer[i].len; |
| 1812 | } |
| 1813 | this->num_values_ -= max_values; |
| 1814 | num_valid_values_ -= max_values; |
| 1815 | return max_values; |
| 1816 | } |
| 1817 | |
| 1818 | int DecodeArrow(int num_values, int null_count, const uint8_t* valid_bits, |
| 1819 | int64_t valid_bits_offset, |
nothing calls this directly
no test coverage detected