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

Method InitializeDataDecoder

cpp/src/parquet/column_reader.cc:946–989  ·  view source on GitHub ↗

Get a decoder object for this page or create a new decoder if this is the first page with this encoding.

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 10

ParquetExceptionFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
encodingMethod · 0.45
findMethod · 0.45
endMethod · 0.45
getMethod · 0.45
SetDecoderMethod · 0.45
SetDataMethod · 0.45

Tested by

no test coverage detected