MCPcopy Create free account
hub / github.com/apache/orc / main

Method main

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

Source from the content-addressed store, hash-verified

165 }
166
167 public static void main(Configuration conf, String[] args) throws Exception {
168 Options opts = createOptions();
169 CommandLine cli = new DefaultParser().parse(opts, args);
170 if (cli.hasOption('h')) {
171 HelpFormatter formatter = new HelpFormatter();
172 formatter.printHelp("sizes", opts);
173 return;
174 }
175 boolean ignoreExtension = cli.hasOption("ignoreExtension");
176 boolean summary = cli.hasOption("summary");
177 String[] files = cli.getArgs();
178
179 ColumnSizes result = null;
180 int totalFiles = 0;
181 int badFiles = 0;
182 for(String root: files) {
183 Path rootPath = new Path(root);
184 FileSystem fs = rootPath.getFileSystem(conf);
185 for(RemoteIterator<LocatedFileStatus> itr = fs.listFiles(rootPath, true); itr.hasNext(); ) {
186 LocatedFileStatus status = itr.next();
187 if (status.isFile() && (ignoreExtension || status.getPath().getName().endsWith(".orc"))) {
188 totalFiles += 1;
189 try {
190 if (result == null) {
191 result = new ColumnSizes(conf, status);
192 } else {
193 if (!result.addFile(status)) {
194 badFiles += 1;
195 }
196 }
197 } catch (IOException err) {
198 badFiles += 1;
199 System.err.println("Failed to read " + status.getPath());
200 }
201 }
202 }
203 }
204 if (result == null) {
205 System.err.println("No files found");
206 } else {
207 if (summary) {
208 System.out.printf("Total Files: %d%n", totalFiles);
209 }
210 result.printResults(System.out, summary);
211 }
212 if (badFiles > 0) {
213 System.err.println(badFiles + " bad ORC files found.");
214 System.exit(1);
215 }
216 }
217
218 public static void main(String[] args) throws Exception {
219 Configuration conf = new Configuration();

Callers 2

testSizesMethod · 0.95
mainMethod · 0.95

Calls 10

createOptionsMethod · 0.95
addFileMethod · 0.95
printResultsMethod · 0.95
printHelpMethod · 0.80
versionMethod · 0.80
hasNextMethod · 0.65
nextMethod · 0.65
getNameMethod · 0.65
getFileSystemMethod · 0.45
getPathMethod · 0.45

Tested by 1

testSizesMethod · 0.76