| 1908 | : TypedDecoderImpl<BooleanType>(descr, Encoding::RLE) {} |
| 1909 | |
| 1910 | void SetData(int num_values, const uint8_t* data, int len) override { |
| 1911 | num_values_ = num_values; |
| 1912 | uint32_t num_bytes = 0; |
| 1913 | |
| 1914 | if (len < 4) { |
| 1915 | throw ParquetException("Received invalid length : " + std::to_string(len) + |
| 1916 | " (corrupt data page?)"); |
| 1917 | } |
| 1918 | // Load the first 4 bytes in little-endian, which indicates the length |
| 1919 | num_bytes = ::arrow::bit_util::FromLittleEndian(SafeLoadAs<uint32_t>(data)); |
| 1920 | if (num_bytes < 0 || num_bytes > static_cast<uint32_t>(len - 4)) { |
| 1921 | throw ParquetException("Received invalid number of bytes : " + |
| 1922 | std::to_string(num_bytes) + " (corrupt data page?)"); |
| 1923 | } |
| 1924 | |
| 1925 | auto decoder_data = data + 4; |
| 1926 | if (decoder_ == nullptr) { |
| 1927 | decoder_ = std::make_shared<::arrow::util::RleBitPackedDecoder<bool>>( |
| 1928 | decoder_data, num_bytes, |
| 1929 | /*bit_width=*/1); |
| 1930 | } else { |
| 1931 | decoder_->Reset(decoder_data, num_bytes, /*bit_width=*/1); |
| 1932 | } |
| 1933 | } |
| 1934 | |
| 1935 | int Decode(bool* buffer, int max_values) override { |
| 1936 | max_values = std::min(max_values, num_values_); |
nothing calls this directly
no test coverage detected