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

Method readMetadata

c++/src/Reader.cc:884–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882 }
883
884 void ReaderImpl::readMetadata() const {
885 uint64_t metadataSize = contents_->postscript->metadata_length();
886 uint64_t footerLength = contents_->postscript->footer_length();
887 if (fileLength_ < metadataSize + footerLength + postscriptLength_ + 1) {
888 std::stringstream msg;
889 msg << "Invalid Metadata length: fileLength=" << fileLength_
890 << ", metadataLength=" << metadataSize << ", footerLength=" << footerLength
891 << ", postscriptLength=" << postscriptLength_;
892 throw ParseError(msg.str());
893 }
894 uint64_t metadataStart = fileLength_ - metadataSize - footerLength - postscriptLength_ - 1;
895 if (metadataSize != 0) {
896 std::unique_ptr<SeekableInputStream> pbStream = createDecompressor(
897 contents_->compression,
898 std::make_unique<SeekableFileInputStream>(contents_->stream.get(), metadataStart,
899 metadataSize, *contents_->pool),
900 contents_->blockSize, *contents_->pool, contents_->readerMetrics);
901 contents_->metadata.reset(new proto::Metadata());
902 if (!contents_->metadata->ParseFromZeroCopyStream(pbStream.get())) {
903 throw ParseError("Failed to parse the metadata");
904 }
905 }
906 isMetadataLoaded_ = true;
907 }
908
909 bool ReaderImpl::hasCorrectStatistics() const {
910 return !WriterVersionImpl::VERSION_HIVE_8732().compareGT(getWriterVersion());

Callers

nothing calls this directly

Calls 4

ParseErrorClass · 0.85
createDecompressorFunction · 0.85
resetMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected