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

Method ConfigureDictionary

cpp/src/parquet/column_reader.cc:829–863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827 }
828
829 void ConfigureDictionary(const DictionaryPage* page) {
830 int encoding = static_cast<int>(page->encoding());
831 if (page->encoding() == Encoding::PLAIN_DICTIONARY ||
832 page->encoding() == Encoding::PLAIN) {
833 encoding = static_cast<int>(Encoding::RLE_DICTIONARY);
834 }
835
836 auto it = decoders_.find(encoding);
837 if (it != decoders_.end()) {
838 throw ParquetException("Column cannot have more than one dictionary.");
839 }
840
841 if (page->encoding() == Encoding::PLAIN_DICTIONARY ||
842 page->encoding() == Encoding::PLAIN) {
843 auto dictionary = MakeTypedDecoder<DType>(Encoding::PLAIN, descr_, pool_);
844 dictionary->SetData(page->num_values(), page->data(), page->size());
845
846 // The dictionary is fully decoded during DictionaryDecoder::Init, so the
847 // DictionaryPage buffer is no longer required after this step
848 //
849 // TODO(wesm): investigate whether this all-or-nothing decoding of the
850 // dictionary makes sense and whether performance can be improved
851
852 std::unique_ptr<DictDecoder<DType>> decoder = MakeDictDecoder<DType>(descr_, pool_);
853 decoder->SetDict(dictionary.get());
854 decoders_[encoding] =
855 std::unique_ptr<DecoderType>(dynamic_cast<DecoderType*>(decoder.release()));
856 } else {
857 ParquetException::NYI("only plain dictionary encoding has been implemented");
858 }
859
860 new_dictionary_ = true;
861 current_decoder_.SetDecoder(decoders_[encoding].get());
862 ARROW_DCHECK(current_decoder_);
863 }
864
865 // Initialize repetition and definition level decoders on the next data page.
866

Callers

nothing calls this directly

Calls 13

ParquetExceptionFunction · 0.85
NYIFunction · 0.85
SetDictMethod · 0.80
encodingMethod · 0.45
findMethod · 0.45
endMethod · 0.45
SetDataMethod · 0.45
num_valuesMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected