| 31 | #include <google/protobuf/text_format.h> |
| 32 | |
| 33 | void printStripeInformation(std::ostream& out, uint64_t index, uint64_t columns, |
| 34 | std::unique_ptr<orc::StripeInformation> stripe, bool verbose) { |
| 35 | out << " { \"stripe\": " << index << ", \"rows\": " << stripe->getNumberOfRows() << ",\n"; |
| 36 | out << " \"offset\": " << stripe->getOffset() << ", \"length\": " << stripe->getLength() |
| 37 | << ",\n"; |
| 38 | out << " \"index\": " << stripe->getIndexLength() |
| 39 | << ", \"data\": " << stripe->getDataLength() << ", \"footer\": " << stripe->getFooterLength(); |
| 40 | if (verbose) { |
| 41 | out << ",\n \"encodings\": [\n"; |
| 42 | for (uint64_t col = 0; col < columns; ++col) { |
| 43 | if (col != 0) { |
| 44 | out << ",\n"; |
| 45 | } |
| 46 | orc::ColumnEncodingKind encoding = stripe->getColumnEncoding(col); |
| 47 | out << " { \"column\": " << col << ", \"encoding\": \"" |
| 48 | << columnEncodingKindToString(encoding) << "\""; |
| 49 | if (encoding == orc::ColumnEncodingKind_DICTIONARY || |
| 50 | encoding == orc::ColumnEncodingKind_DICTIONARY_V2) { |
| 51 | out << ", \"count\": " << stripe->getDictionarySize(col); |
| 52 | } |
| 53 | out << " }"; |
| 54 | } |
| 55 | out << "\n ],\n"; |
| 56 | out << " \"streams\": [\n"; |
| 57 | for (uint64_t str = 0; str < stripe->getNumberOfStreams(); ++str) { |
| 58 | if (str != 0) { |
| 59 | out << ",\n"; |
| 60 | } |
| 61 | std::unique_ptr<orc::StreamInformation> stream = stripe->getStreamInformation(str); |
| 62 | out << " { \"id\": " << str << ", \"column\": " << stream->getColumnId() |
| 63 | << ", \"kind\": \"" << streamKindToString(stream->getKind()) |
| 64 | << "\", \"offset\": " << stream->getOffset() << ", \"length\": " << stream->getLength() |
| 65 | << " }"; |
| 66 | } |
| 67 | out << "\n ]"; |
| 68 | std::string tz = stripe->getWriterTimezone(); |
| 69 | if (tz.length() != 0) { |
| 70 | out << ",\n \"timezone\": \"" << tz << "\""; |
| 71 | } |
| 72 | } |
| 73 | out << "\n }"; |
| 74 | } |
| 75 | |
| 76 | void printRawTail(std::ostream& out, const char* filename) { |
| 77 | out << "Raw file tail: " << filename << "\n"; |
no test coverage detected