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

Method main

java/tools/src/java/org/apache/orc/tools/RowCount.java:40–72  ·  view source on GitHub ↗
(Configuration conf, String[] args)

Source from the content-addressed store, hash-verified

38 */
39public class RowCount {
40 public static void main(Configuration conf, String[] args) throws Exception {
41 Options opts = createOptions();
42 CommandLine cli = new DefaultParser().parse(opts, args);
43 if (cli.hasOption('h')) {
44 HelpFormatter formatter = new HelpFormatter();
45 formatter.printHelp("count", opts);
46 return;
47 }
48 boolean ignoreExtension = cli.hasOption("ignoreExtension");
49 String[] files = cli.getArgs();
50
51 int bad = 0;
52 for(String root: files) {
53 Path rootPath = new Path(root);
54 FileSystem fs = rootPath.getFileSystem(conf);
55 for(RemoteIterator<LocatedFileStatus> itr = fs.listFiles(rootPath, true); itr.hasNext(); ) {
56 LocatedFileStatus status = itr.next();
57 if (status.isFile() && (ignoreExtension || status.getPath().getName().endsWith(".orc"))) {
58 Path filename = status.getPath();
59 try (Reader reader = OrcFile.createReader(filename, OrcFile.readerOptions(conf))) {
60 System.out.println(String.format("%s %d",
61 filename.toString(), reader.getNumberOfRows()));
62 } catch (IOException ioe) {
63 bad += 1;
64 System.err.println("Failed to read " + filename);
65 }
66 }
67 }
68 }
69 if (bad > 0) {
70 System.exit(1);
71 }
72 }
73
74 public static void main(String[] args) throws Exception {
75 Configuration conf = new Configuration();

Callers 2

testCountMethod · 0.95
mainMethod · 0.95

Calls 12

createOptionsMethod · 0.95
createReaderMethod · 0.95
readerOptionsMethod · 0.95
printHelpMethod · 0.80
versionMethod · 0.80
hasNextMethod · 0.65
nextMethod · 0.65
getNameMethod · 0.65
getNumberOfRowsMethod · 0.65
getFileSystemMethod · 0.45
getPathMethod · 0.45
toStringMethod · 0.45

Tested by 1

testCountMethod · 0.76