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

Function printContents

tools/src/FileContents.cc:26–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24#include <string>
25
26void 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
54int main(int argc, char* argv[]) {
55 uint64_t batchSize; // not used

Callers 1

mainFunction · 0.85

Calls 10

readFileFunction · 0.85
createColumnPrinterFunction · 0.85
nextMethod · 0.65
resetMethod · 0.65
clearMethod · 0.65
createReaderFunction · 0.50
getReaderMetricsMethod · 0.45
createRowReaderMethod · 0.45
createRowBatchMethod · 0.45
printRowMethod · 0.45

Tested by

no test coverage detected