| 21 | #include <iostream> |
| 22 | |
| 23 | void scanFile(std::ostream& out, const char* filename, uint64_t batchSize, |
| 24 | const orc::RowReaderOptions& rowReaderOpts, bool showMetrics) { |
| 25 | orc::ReaderOptions readerOpts; |
| 26 | if (showMetrics) { |
| 27 | readerOpts.setReaderMetrics(orc::getDefaultReaderMetrics()); |
| 28 | } |
| 29 | std::unique_ptr<orc::Reader> reader = |
| 30 | orc::createReader(orc::readFile(filename, readerOpts.getReaderMetrics()), readerOpts); |
| 31 | std::unique_ptr<orc::RowReader> rowReader = reader->createRowReader(rowReaderOpts); |
| 32 | std::unique_ptr<orc::ColumnVectorBatch> batch = rowReader->createRowBatch(batchSize); |
| 33 | |
| 34 | unsigned long rows = 0; |
| 35 | unsigned long batches = 0; |
| 36 | while (rowReader->next(*batch)) { |
| 37 | batches += 1; |
| 38 | rows += batch->numElements; |
| 39 | } |
| 40 | out << "Rows: " << rows << std::endl; |
| 41 | out << "Batches: " << batches << std::endl; |
| 42 | if (showMetrics) { |
| 43 | printReaderMetrics(out, reader->getReaderMetrics()); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | int main(int argc, char* argv[]) { |
| 48 | uint64_t batchSize = 1024; |
no test coverage detected