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

Method InitializeDataDecoder

cpp/src/parquet/column_reader.cc:854–897  ·  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

852 // Get a decoder object for this page or create a new decoder if this is the
853 // first page with this encoding.
854 void InitializeDataDecoder(const DataPage& page, int64_t levels_byte_size) {
855 const uint8_t* buffer = page.data() + levels_byte_size;
856 const int64_t data_size = page.size() - levels_byte_size;
857
858 if (data_size < 0) {
859 throw ParquetException("Page smaller than size of encoded levels");
860 }
861
862 Encoding::type encoding = page.encoding();
863 if (IsDictionaryIndexEncoding(encoding)) {
864 // Normalizing the PLAIN_DICTIONARY to RLE_DICTIONARY encoding
865 // in decoder.
866 encoding = Encoding::RLE_DICTIONARY;
867 }
868
869 auto it = decoders_.find(static_cast<int>(encoding));
870 if (it != decoders_.end()) {
871 ARROW_DCHECK(it->second.get() != nullptr);
872 current_decoder_ = it->second.get();
873 } else {
874 switch (encoding) {
875 case Encoding::PLAIN:
876 case Encoding::BYTE_STREAM_SPLIT:
877 case Encoding::RLE:
878 case Encoding::DELTA_BINARY_PACKED:
879 case Encoding::DELTA_BYTE_ARRAY:
880 case Encoding::DELTA_LENGTH_BYTE_ARRAY: {
881 auto decoder = MakeTypedDecoder<DType>(encoding, descr_, pool_);
882 current_decoder_ = decoder.get();
883 decoders_[static_cast<int>(encoding)] = std::move(decoder);
884 break;
885 }
886
887 case Encoding::RLE_DICTIONARY:
888 throw ParquetException("Dictionary page must be before data page.");
889
890 default:
891 throw ParquetException("Unknown encoding type.");
892 }
893 }
894 current_encoding_ = encoding;
895 current_decoder_->SetData(static_cast<int>(num_buffered_values_), buffer,
896 static_cast<int>(data_size));
897 }
898
899 // Available values in the current data page, value includes repeated values
900 // and nulls.

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected