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

Method ConfigureDictionary

cpp/src/parquet/column_reader.cc:737–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735 }
736
737 void ConfigureDictionary(const DictionaryPage* page) {
738 int encoding = static_cast<int>(page->encoding());
739 if (page->encoding() == Encoding::PLAIN_DICTIONARY ||
740 page->encoding() == Encoding::PLAIN) {
741 encoding = static_cast<int>(Encoding::RLE_DICTIONARY);
742 }
743
744 auto it = decoders_.find(encoding);
745 if (it != decoders_.end()) {
746 throw ParquetException("Column cannot have more than one dictionary.");
747 }
748
749 if (page->encoding() == Encoding::PLAIN_DICTIONARY ||
750 page->encoding() == Encoding::PLAIN) {
751 auto dictionary = MakeTypedDecoder<DType>(Encoding::PLAIN, descr_, pool_);
752 dictionary->SetData(page->num_values(), page->data(), page->size());
753
754 // The dictionary is fully decoded during DictionaryDecoder::Init, so the
755 // DictionaryPage buffer is no longer required after this step
756 //
757 // TODO(wesm): investigate whether this all-or-nothing decoding of the
758 // dictionary makes sense and whether performance can be improved
759
760 std::unique_ptr<DictDecoder<DType>> decoder = MakeDictDecoder<DType>(descr_, pool_);
761 decoder->SetDict(dictionary.get());
762 decoders_[encoding] =
763 std::unique_ptr<DecoderType>(dynamic_cast<DecoderType*>(decoder.release()));
764 } else {
765 ParquetException::NYI("only plain dictionary encoding has been implemented");
766 }
767
768 new_dictionary_ = true;
769 current_decoder_ = decoders_[encoding].get();
770 ARROW_DCHECK(current_decoder_);
771 }
772
773 // Initialize repetition and definition level decoders on the next data page.
774

Callers

nothing calls this directly

Calls 12

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