MCPcopy Index your code
hub / github.com/apache/orc / readPostscript

Function readPostscript

c++/src/Reader.cc:1517–1536  ·  view source on GitHub ↗

* Read the file's postscript from the given buffer. * @param stream the file stream * @param buffer the buffer with the tail of the file. * @param postscriptSize the length of postscript in bytes */

Source from the content-addressed store, hash-verified

1515 * @param postscriptSize the length of postscript in bytes
1516 */
1517 std::unique_ptr<proto::PostScript> readPostscript(InputStream* stream, DataBuffer<char>* buffer,
1518 uint64_t postscriptSize) {
1519 char* ptr = buffer->data();
1520 uint64_t readSize = buffer->size();
1521
1522 ensureOrcFooter(stream, buffer, postscriptSize);
1523
1524 auto postscript = std::make_unique<proto::PostScript>();
1525 if (readSize < 1 + postscriptSize) {
1526 std::stringstream msg;
1527 msg << "Invalid ORC postscript length: " << postscriptSize
1528 << ", file length = " << stream->getLength();
1529 throw ParseError(msg.str());
1530 }
1531 if (!postscript->ParseFromArray(ptr + readSize - 1 - postscriptSize,
1532 static_cast<int>(postscriptSize))) {
1533 throw ParseError("Failed to parse the postscript from " + stream->getName());
1534 }
1535 return postscript;
1536 }
1537
1538 /**
1539 * Check that proto Types are valid. Indices in the type tree should be valid,

Callers 1

createReaderFunction · 0.85

Calls 6

ensureOrcFooterFunction · 0.85
ParseErrorClass · 0.85
sizeMethod · 0.65
getLengthMethod · 0.65
getNameMethod · 0.65
dataMethod · 0.45

Tested by

no test coverage detected