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

Method main

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

Source from the content-addressed store, hash-verified

57 private static final String CHECK_TYPE_BLOOM_FILTER = "bloom-filter";
58
59 public static void main(Configuration conf, String[] args) throws Exception {
60 Options opts = createOptions();
61 CommandLine cli = new DefaultParser().parse(opts, args);
62 HelpFormatter formatter = new HelpFormatter();
63 if (cli.hasOption('h')) {
64 formatter.printHelp("check", opts);
65 return;
66 }
67
68 String type = cli.getOptionValue("type");
69 if (type == null ||
70 (!type.equals(CHECK_TYPE_PREDICATE) &&
71 !type.equals(CHECK_TYPE_STAT) &&
72 !type.equals(CHECK_TYPE_BLOOM_FILTER))) {
73 System.err.printf("type %s not support %n", type);
74 formatter.printHelp("check", opts);
75 return;
76 }
77 String column = cli.getOptionValue("column");
78 if (column == null || column.isEmpty()) {
79 System.err.println("column is null");
80 formatter.printHelp("check", opts);
81 return;
82 }
83 String[] values = cli.getOptionValues("values");
84 if (values == null || values.length == 0) {
85 System.err.println("values is null");
86 formatter.printHelp("check", opts);
87 return;
88 }
89 boolean ignoreExtension = cli.hasOption("ignoreExtension");
90
91 List<Path> inputFiles = new ArrayList<>();
92 String[] files = cli.getArgs();
93 for (String root : files) {
94 Path rootPath = new Path(root);
95 FileSystem fs = rootPath.getFileSystem(conf);
96 for (RemoteIterator<LocatedFileStatus> itr = fs.listFiles(rootPath, true); itr.hasNext(); ) {
97 LocatedFileStatus status = itr.next();
98 if (status.isFile() && (ignoreExtension || status.getPath().getName().endsWith(".orc"))) {
99 inputFiles.add(status.getPath());
100 }
101 }
102 }
103 if (inputFiles.isEmpty()) {
104 System.err.println("No files found.");
105 System.exit(1);
106 }
107
108 for (Path inputFile : inputFiles) {
109 System.out.println("input file: " + inputFile);
110 FileSystem fs = inputFile.getFileSystem(conf);
111 try (Reader reader = OrcFile.createReader(inputFile,
112 OrcFile.readerOptions(conf).filesystem(fs))) {
113 RecordReaderImpl rows = (RecordReaderImpl) reader.rows();
114 TypeDescription schema = reader.getSchema();
115 boolean[] includedColumns = OrcUtils.includeColumns(column, schema);
116 int colIndex = -1;

Callers 4

testPredicateMethod · 0.95
testStatisticsMethod · 0.95
testBloomFilterMethod · 0.95
mainMethod · 0.95

Calls 15

createOptionsMethod · 0.95
createReaderMethod · 0.95
readerOptionsMethod · 0.95
includeColumnsMethod · 0.95
readStripeFooterMethod · 0.95
getCategoryMethod · 0.95
readRowIndexMethod · 0.95
checkBloomFilterMethod · 0.95
checkStatOrPredicateMethod · 0.95
printHelpMethod · 0.80
filesystemMethod · 0.80
hasNextMethod · 0.65

Tested by 3

testPredicateMethod · 0.76
testStatisticsMethod · 0.76
testBloomFilterMethod · 0.76