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

Method getRowGroupIndex

c++/src/Reader.cc:1726–1767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1724 }
1725
1726 std::map<uint32_t, RowGroupIndex> ReaderImpl::getRowGroupIndex(
1727 uint32_t stripeIndex, const std::set<uint32_t>& included) const {
1728 std::map<uint32_t, RowGroupIndex> ret;
1729 uint64_t offset;
1730 auto currentStripeFooter = loadCurrentStripeFooter(stripeIndex, offset);
1731
1732 // iterate stripe footer to get stream of row_index
1733 for (int i = 0; i < currentStripeFooter.streams_size(); i++) {
1734 const proto::Stream& stream = currentStripeFooter.streams(i);
1735 uint32_t column = static_cast<uint32_t>(stream.column());
1736 uint64_t length = static_cast<uint64_t>(stream.length());
1737 RowGroupIndex& rowGroupIndex = ret[column];
1738
1739 if (stream.kind() == proto::Stream_Kind_ROW_INDEX &&
1740 (included.empty() || included.find(column) != included.end())) {
1741 std::unique_ptr<SeekableInputStream> pbStream =
1742 createDecompressor(contents_->compression,
1743 std::make_unique<SeekableFileInputStream>(
1744 contents_->stream.get(), offset, length, *contents_->pool),
1745 contents_->blockSize, *(contents_->pool), contents_->readerMetrics);
1746
1747 proto::RowIndex pbRowIndex;
1748 if (!pbRowIndex.ParseFromZeroCopyStream(pbStream.get())) {
1749 std::stringstream errMsgBuffer;
1750 errMsgBuffer << "Failed to parse RowIndex at column " << column << " in stripe "
1751 << stripeIndex;
1752 throw ParseError(errMsgBuffer.str());
1753 }
1754
1755 // add rowGroupIndex to result for one column
1756 for (auto& rowIndexEntry : pbRowIndex.entry()) {
1757 std::vector<uint64_t> posVector;
1758 for (auto& position : rowIndexEntry.positions()) {
1759 posVector.push_back(position);
1760 }
1761 rowGroupIndex.positions.push_back(posVector);
1762 }
1763 }
1764 offset += length;
1765 }
1766 return ret;
1767 }
1768
1769 void ReaderImpl::releaseBuffer(uint64_t boundary) {
1770 contents_->evictCache(boundary);

Callers 1

Calls 6

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

Tested by 1