Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions c++/src/Reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ namespace orc {
return std::unique_ptr<StripeInformation>(new StripeInformationImpl(
stripeInfo.offset(), stripeInfo.indexlength(), stripeInfo.datalength(),
stripeInfo.footerlength(), stripeInfo.numberofrows(), contents->stream.get(),
*contents->pool, contents->compression, contents->blockSize, contents->readerMetrics));
*contents->pool, contents->compression, contents->blockSize, contents->readerMetrics, nullptr));
}

FileVersion ReaderImpl::getFormatVersion() const {
Expand Down Expand Up @@ -1185,7 +1185,7 @@ namespace orc {
currentStripeInfo.offset(), currentStripeInfo.indexlength(),
currentStripeInfo.datalength(), currentStripeInfo.footerlength(),
currentStripeInfo.numberofrows(), contents->stream.get(), *contents->pool,
contents->compression, contents->blockSize, contents->readerMetrics));
contents->compression, contents->blockSize, contents->readerMetrics, &currentStripeFooter));
contents->stream->beforeReadStripe(std::move(currentStripeInformation), selectedColumns);

if (sargsApplier) {
Expand Down Expand Up @@ -1216,11 +1216,6 @@ namespace orc {

if (stringDictFilter != nullptr) {
std::list<std::string> dictFilterColumnNames;
std::unique_ptr<StripeInformation> currentStripeInformation(new StripeInformationImpl(
currentStripeInfo.offset(), currentStripeInfo.indexlength(),
currentStripeInfo.datalength(), currentStripeInfo.footerlength(),
currentStripeInfo.numberofrows(), contents->stream.get(), *contents->pool,
contents->compression, contents->blockSize, contents->readerMetrics));
stringDictFilter->fillDictFilterColumnNames(std::move(currentStripeInformation),
dictFilterColumnNames);
std::unordered_map<uint64_t, std::string> columnIdToNameMap;
Expand Down
5 changes: 3 additions & 2 deletions c++/src/StripeStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ namespace orc {
}

void StripeInformationImpl::ensureStripeFooterLoaded() const {
if (stripeFooter.get() == nullptr) {
if (stripeFooter == nullptr && managedStripeFooter.get() == nullptr) {
std::unique_ptr<SeekableInputStream> pbStream =
createDecompressor(compression,
std::make_unique<SeekableFileInputStream>(
stream, offset + indexLength + dataLength, footerLength, memory),
blockSize, memory, metrics);
stripeFooter = std::make_unique<proto::StripeFooter>();
managedStripeFooter = std::make_unique<proto::StripeFooter>();
stripeFooter = managedStripeFooter.get();
if (!stripeFooter->ParseFromZeroCopyStream(pbStream.get())) {
throw ParseError("Failed to parse the stripe footer");
}
Expand Down
8 changes: 5 additions & 3 deletions c++/src/StripeStream.hh
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ namespace orc {
MemoryPool& memory;
CompressionKind compression;
uint64_t blockSize;
mutable std::unique_ptr<proto::StripeFooter> stripeFooter;
ReaderMetrics* metrics;
mutable proto::StripeFooter* stripeFooter;
mutable std::unique_ptr<proto::StripeFooter> managedStripeFooter;
void ensureStripeFooterLoaded() const;

public:
StripeInformationImpl(uint64_t _offset, uint64_t _indexLength, uint64_t _dataLength,
uint64_t _footerLength, uint64_t _numRows, InputStream* _stream,
MemoryPool& _memory, CompressionKind _compression, uint64_t _blockSize,
ReaderMetrics* _metrics)
ReaderMetrics* _metrics, proto::StripeFooter* _stripeFooter)
: offset(_offset),
indexLength(_indexLength),
dataLength(_dataLength),
Expand All @@ -150,7 +151,8 @@ namespace orc {
memory(_memory),
compression(_compression),
blockSize(_blockSize),
metrics(_metrics) {
metrics(_metrics),
stripeFooter(_stripeFooter) {
// PASS
}

Expand Down