| 24 | #include <string> |
| 25 | |
| 26 | void printContents(const char* filename, const orc::RowReaderOptions& rowReaderOpts) { |
| 27 | orc::ReaderOptions readerOpts; |
| 28 | std::unique_ptr<orc::Reader> reader; |
| 29 | std::unique_ptr<orc::RowReader> rowReader; |
| 30 | reader = orc::createReader(orc::readFile(std::string(filename), readerOpts.getReaderMetrics()), |
| 31 | readerOpts); |
| 32 | rowReader = reader->createRowReader(rowReaderOpts); |
| 33 | |
| 34 | std::unique_ptr<orc::ColumnVectorBatch> batch = rowReader->createRowBatch(1000); |
| 35 | std::string line; |
| 36 | orc::ColumnPrinter::Param param; |
| 37 | param.printDecimalAsString = true; |
| 38 | param.printDecimalTrimTrailingZeros = true; |
| 39 | std::unique_ptr<orc::ColumnPrinter> printer = |
| 40 | createColumnPrinter(line, &rowReader->getSelectedType(), param); |
| 41 | |
| 42 | while (rowReader->next(*batch)) { |
| 43 | printer->reset(*batch); |
| 44 | for (unsigned long i = 0; i < batch->numElements; ++i) { |
| 45 | line.clear(); |
| 46 | printer->printRow(i); |
| 47 | line += "\n"; |
| 48 | const char* str = line.c_str(); |
| 49 | fwrite(str, 1, strlen(str), stdout); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | int main(int argc, char* argv[]) { |
| 55 | uint64_t batchSize; // not used |
no test coverage detected