| 1859 | : TypedDecoderImpl<BooleanType>(descr, Encoding::RLE) {} |
| 1860 | |
| 1861 | void SetData(int num_values, const uint8_t* data, int len) override { |
| 1862 | num_values_ = num_values; |
| 1863 | uint32_t num_bytes = 0; |
| 1864 | |
| 1865 | if (len < 4) { |
| 1866 | throw ParquetException("Received invalid length : " + std::to_string(len) + |
| 1867 | " (corrupt data page?)"); |
| 1868 | } |
| 1869 | // Load the first 4 bytes in little-endian, which indicates the length |
| 1870 | num_bytes = ::arrow::bit_util::FromLittleEndian(SafeLoadAs<uint32_t>(data)); |
| 1871 | if (num_bytes < 0 || num_bytes > static_cast<uint32_t>(len - 4)) { |
| 1872 | throw ParquetException("Received invalid number of bytes : " + |
| 1873 | std::to_string(num_bytes) + " (corrupt data page?)"); |
| 1874 | } |
| 1875 | |
| 1876 | auto decoder_data = data + 4; |
| 1877 | if (decoder_ == nullptr) { |
| 1878 | decoder_ = std::make_shared<::arrow::util::RleBitPackedDecoder<bool>>( |
| 1879 | decoder_data, num_bytes, |
| 1880 | /*bit_width=*/1); |
| 1881 | } else { |
| 1882 | decoder_->Reset(decoder_data, num_bytes, /*bit_width=*/1); |
| 1883 | } |
| 1884 | } |
| 1885 | |
| 1886 | int Decode(bool* buffer, int max_values) override { |
| 1887 | max_values = std::min(max_values, num_values_); |
nothing calls this directly
no test coverage detected