MCPcopy Create free account
hub / github.com/apache/orc / getRowIndexStatistics

Method getRowIndexStatistics

c++/src/Reader.cc:783–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781 }
782
783 void ReaderImpl::getRowIndexStatistics(
784 const proto::StripeInformation& stripeInfo, uint64_t stripeIndex,
785 const proto::StripeFooter& currentStripeFooter,
786 std::vector<std::vector<proto::ColumnStatistics>>* indexStats) const {
787 int num_streams = currentStripeFooter.streams_size();
788 uint64_t offset = stripeInfo.offset();
789 uint64_t indexEnd = stripeInfo.offset() + stripeInfo.index_length();
790 for (int i = 0; i < num_streams; i++) {
791 const proto::Stream& stream = currentStripeFooter.streams(i);
792 StreamKind streamKind = static_cast<StreamKind>(stream.kind());
793 uint64_t length = static_cast<uint64_t>(stream.length());
794 if (streamKind == StreamKind::StreamKind_ROW_INDEX) {
795 if (offset + length > indexEnd) {
796 std::stringstream msg;
797 msg << "Malformed RowIndex stream meta in stripe " << stripeIndex
798 << ": streamOffset=" << offset << ", streamLength=" << length
799 << ", stripeOffset=" << stripeInfo.offset()
800 << ", stripeIndexLength=" << stripeInfo.index_length();
801 throw ParseError(msg.str());
802 }
803 std::unique_ptr<SeekableInputStream> pbStream =
804 createDecompressor(contents_->compression,
805 std::unique_ptr<SeekableInputStream>(new SeekableFileInputStream(
806 contents_->stream.get(), offset, length, *contents_->pool)),
807 contents_->blockSize, *(contents_->pool), contents_->readerMetrics);
808
809 proto::RowIndex rowIndex;
810 if (!rowIndex.ParseFromZeroCopyStream(pbStream.get())) {
811 throw ParseError("Failed to parse RowIndex from stripe footer");
812 }
813 int num_entries = rowIndex.entry_size();
814 size_t column = static_cast<size_t>(stream.column());
815 for (int j = 0; j < num_entries; j++) {
816 const proto::RowIndexEntry& entry = rowIndex.entry(j);
817 (*indexStats)[column].push_back(entry.statistics());
818 }
819 }
820 offset += length;
821 }
822 }
823
824 bool ReaderImpl::hasMetadataValue(const std::string& key) const {
825 for (int i = 0; i < footer_->metadata_size(); ++i) {

Callers 3

printStatisticsFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 5

ParseErrorClass · 0.85
createDecompressorFunction · 0.85
lengthMethod · 0.80
entryMethod · 0.80
getMethod · 0.45

Tested by 2

TESTFunction · 0.36
TESTFunction · 0.36