Get a decoder object for this page or create a new decoder if this is the first page with this encoding.
| 944 | // Get a decoder object for this page or create a new decoder if this is the |
| 945 | // first page with this encoding. |
| 946 | void InitializeDataDecoder(const DataPage& page, int64_t levels_byte_size) { |
| 947 | const uint8_t* buffer = page.data() + levels_byte_size; |
| 948 | const int64_t data_size = page.size() - levels_byte_size; |
| 949 | |
| 950 | if (data_size < 0) { |
| 951 | throw ParquetException("Page smaller than size of encoded levels"); |
| 952 | } |
| 953 | |
| 954 | Encoding::type encoding = page.encoding(); |
| 955 | if (IsDictionaryIndexEncoding(encoding)) { |
| 956 | // Normalizing the PLAIN_DICTIONARY to RLE_DICTIONARY encoding |
| 957 | // in decoder. |
| 958 | encoding = Encoding::RLE_DICTIONARY; |
| 959 | } |
| 960 | |
| 961 | auto it = decoders_.find(static_cast<int>(encoding)); |
| 962 | if (it != decoders_.end()) { |
| 963 | ARROW_DCHECK(it->second.get() != nullptr); |
| 964 | current_decoder_.SetDecoder(it->second.get()); |
| 965 | } else { |
| 966 | switch (encoding) { |
| 967 | case Encoding::PLAIN: |
| 968 | case Encoding::BYTE_STREAM_SPLIT: |
| 969 | case Encoding::RLE: |
| 970 | case Encoding::DELTA_BINARY_PACKED: |
| 971 | case Encoding::DELTA_BYTE_ARRAY: |
| 972 | case Encoding::DELTA_LENGTH_BYTE_ARRAY: { |
| 973 | auto decoder = MakeTypedDecoder<DType>(encoding, descr_, pool_); |
| 974 | current_decoder_.SetDecoder(decoder.get()); |
| 975 | decoders_[static_cast<int>(encoding)] = std::move(decoder); |
| 976 | break; |
| 977 | } |
| 978 | |
| 979 | case Encoding::RLE_DICTIONARY: |
| 980 | throw ParquetException("Dictionary page must be before data page."); |
| 981 | |
| 982 | default: |
| 983 | throw ParquetException("Unknown encoding type."); |
| 984 | } |
| 985 | } |
| 986 | current_encoding_ = encoding; |
| 987 | current_decoder_->SetData(static_cast<int>(num_buffered_values_), buffer, |
| 988 | static_cast<int>(data_size)); |
| 989 | } |
| 990 | |
| 991 | // Available values in the current data page, value includes repeated values |
| 992 | // and nulls. |
nothing calls this directly
no test coverage detected