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

Method ConfigureDictionary

cpp/src/parquet/column_reader.cc:722–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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