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

Method InitializeDataDecoder

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

837 // Get a decoder object for this page or create a new decoder if this is the
838 // first page with this encoding.
839 void InitializeDataDecoder(const DataPage& page, int64_t levels_byte_size) {
840 const uint8_t* buffer = page.data() + levels_byte_size;
841 const int64_t data_size = page.size() - levels_byte_size;
842
843 if (data_size < 0) {
844 throw ParquetException("Page smaller than size of encoded levels");
845 }
846
847 Encoding::type encoding = page.encoding();
848 if (IsDictionaryIndexEncoding(encoding)) {
849 // Normalizing the PLAIN_DICTIONARY to RLE_DICTIONARY encoding
850 // in decoder.
851 encoding = Encoding::RLE_DICTIONARY;
852 }
853
854 auto it = decoders_.find(static_cast<int>(encoding));
855 if (it != decoders_.end()) {
856 ARROW_DCHECK(it->second.get() != nullptr);
857 current_decoder_ = it->second.get();
858 } else {
859 switch (encoding) {
860 case Encoding::PLAIN:
861 case Encoding::BYTE_STREAM_SPLIT:
862 case Encoding::RLE:
863 case Encoding::DELTA_BINARY_PACKED:
864 case Encoding::DELTA_BYTE_ARRAY:
865 case Encoding::DELTA_LENGTH_BYTE_ARRAY: {
866 auto decoder = MakeTypedDecoder<DType>(encoding, descr_, pool_);
867 current_decoder_ = decoder.get();
868 decoders_[static_cast<int>(encoding)] = std::move(decoder);
869 break;
870 }
871
872 case Encoding::RLE_DICTIONARY:
873 throw ParquetException("Dictionary page must be before data page.");
874
875 default:
876 throw ParquetException("Unknown encoding type.");
877 }
878 }
879 current_encoding_ = encoding;
880 current_decoder_->SetData(static_cast<int>(num_buffered_values_), buffer,
881 static_cast<int>(data_size));
882 }
883
884 // Available values in the current data page, value includes repeated values
885 // 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