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

Function scanFile

tools/src/FileScan.cc:23–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include <iostream>
22
23void 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
47int main(int argc, char* argv[]) {
48 uint64_t batchSize = 1024;

Callers 1

mainFunction · 0.85

Calls 8

getDefaultReaderMetricsFunction · 0.85
readFileFunction · 0.85
printReaderMetricsFunction · 0.85
nextMethod · 0.65
createReaderFunction · 0.50
getReaderMetricsMethod · 0.45
createRowReaderMethod · 0.45
createRowBatchMethod · 0.45

Tested by

no test coverage detected