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

Method Decode

cpp/src/parquet/decoder.cc:1714–1748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1712 }
1713
1714 int Decode(ByteArray* buffer, int max_values) override {
1715 // Decode up to `max_values` strings into an internal buffer
1716 // and reference them into `buffer`.
1717 max_values = std::min(max_values, num_valid_values_);
1718 DCHECK_GE(max_values, 0);
1719 if (max_values == 0) {
1720 return 0;
1721 }
1722
1723 int32_t data_size = 0;
1724 const int32_t* length_ptr = buffered_length_->data_as<int32_t>() + length_idx_;
1725 int bytes_offset = len_ - decoder_->bytes_left();
1726 for (int i = 0; i < max_values; ++i) {
1727 int32_t len = length_ptr[i];
1728 if (ARROW_PREDICT_FALSE(len < 0)) {
1729 throw ParquetException("negative string delta length");
1730 }
1731 buffer[i].len = len;
1732 if (AddWithOverflow(data_size, len, &data_size)) {
1733 throw ParquetException("excess expansion in DELTA_(LENGTH_)BYTE_ARRAY");
1734 }
1735 }
1736 length_idx_ += max_values;
1737 if (ARROW_PREDICT_FALSE(!decoder_->Advance(8 * static_cast<int64_t>(data_size)))) {
1738 ParquetException::EofException();
1739 }
1740 const uint8_t* data_ptr = data_ + bytes_offset;
1741 for (int i = 0; i < max_values; ++i) {
1742 buffer[i].ptr = data_ptr;
1743 data_ptr += buffer[i].len;
1744 }
1745 this->num_values_ -= max_values;
1746 num_valid_values_ -= max_values;
1747 return max_values;
1748 }
1749
1750 int DecodeArrow(int num_values, int null_count, const uint8_t* valid_bits,
1751 int64_t valid_bits_offset,

Callers

nothing calls this directly

Calls 4

ParquetExceptionFunction · 0.85
AddWithOverflowFunction · 0.85
bytes_leftMethod · 0.80
AdvanceMethod · 0.45

Tested by

no test coverage detected