luffy-zh commented on code in PR #2005:
URL: https://github.com/apache/orc/pull/2005#discussion_r1818725629
##########
c++/src/Reader.cc:
##########
@@ -1491,6 +1467,59 @@ namespace orc {
return ret;
}
+ proto::StripeFooter ReaderImpl::loadCurrentStripeFooter(uint32_t stripeIndex,
+ uint64_t& offset)
const {
+ // find stripe info
+ if (stripeIndex >= static_cast<uint32_t>(footer_->stripes_size())) {
+ throw std::logic_error("Illegal stripe index: " +
+ to_string(static_cast<int64_t>(stripeIndex)));
+ }
+ const proto::StripeInformation currentStripeInfo =
+ footer_->stripes(static_cast<int>(stripeIndex));
+ offset = static_cast<uint64_t>(currentStripeInfo.offset());
+ return getStripeFooter(currentStripeInfo, *contents_);
+ }
+
+ std::map<uint32_t, RowGroupIndex> ReaderImpl::getRowGroupIndex(
+ uint32_t stripeIndex, const std::set<uint32_t>& included) const {
+ std::map<uint32_t, RowGroupIndex> ret;
+ uint64_t offset;
+ auto currentStripeFooter = loadCurrentStripeFooter(stripeIndex, offset);
+
+ // iterate stripe footer to get stream of row_index
+ for (int i = 0; i < currentStripeFooter.streams_size(); i++) {
+ const proto::Stream& stream = currentStripeFooter.streams(i);
+ uint32_t column = static_cast<uint32_t>(stream.column());
+ uint64_t length = static_cast<uint64_t>(stream.length());
+ RowGroupIndex rowGroupIndex = ret[column];
Review Comment:
I added the RowGroupIndex size check in TestWriter.cc:97.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]