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

Method main

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

Source from the content-addressed store, hash-verified

79 }
80
81 public static void main(Configuration conf, String[] args) throws Exception {
82 List<Integer> rowIndexCols = new ArrayList<>(0);
83 Options opts = createOptions();
84 CommandLine cli = new DefaultParser().parse(opts, args);
85
86 if (cli.hasOption('h')) {
87 HelpFormatter formatter = new HelpFormatter();
88 formatter.printHelp("meta", opts);
89 return;
90 }
91
92 boolean dumpData = cli.hasOption('d');
93 boolean recover = cli.hasOption("recover");
94 boolean skipDump = cli.hasOption("skip-dump");
95 String backupPath = DEFAULT_BACKUP_PATH;
96 if (cli.hasOption("backup-path")) {
97 backupPath = cli.getOptionValue("backup-path");
98 }
99
100 if (cli.hasOption("r")) {
101 String val = cli.getOptionValue("r");
102 if (val != null && val.trim().equals("*")) {
103 rowIndexCols = null; // All the columns
104 } else {
105 String[] colStrs = cli.getOptionValue("r").split(",");
106 rowIndexCols = new ArrayList<>(colStrs.length);
107 for (String colStr : colStrs) {
108 rowIndexCols.add(Integer.parseInt(colStr));
109 }
110 }
111 }
112
113 boolean printTimeZone = cli.hasOption('t');
114 boolean jsonFormat = cli.hasOption('j');
115 String[] files = cli.getArgs();
116 if (files.length == 0) {
117 System.err.println("Error : ORC files are not specified");
118 return;
119 }
120
121 // if the specified path is directory, iterate through all files and print the file dump
122 List<String> filesInPath = new ArrayList<>();
123 for (String filename : files) {
124 Path path = new Path(filename);
125 filesInPath.addAll(getAllFilesInPath(path, conf));
126 }
127
128 if (dumpData) {
129 PrintData.main(conf, filesInPath.toArray(new String[filesInPath.size()]));
130 } else if (recover && skipDump) {
131 recoverFiles(filesInPath, conf, backupPath);
132 } else {
133 if (jsonFormat) {
134 boolean prettyPrint = cli.hasOption('p');
135 JsonFileDump.printJsonMetaData(filesInPath, conf, rowIndexCols, prettyPrint, printTimeZone);
136 } else {
137 boolean printColumnType = cli.hasOption("column-type");
138 printMetaData(filesInPath, conf, rowIndexCols, printTimeZone, recover, backupPath,

Callers 15

testJsonDumpMethod · 0.95
testDumpMethod · 0.95
testDataDumpMethod · 0.95
testBloomFilterMethod · 0.95
testBloomFilter2Method · 0.95
testHasNullMethod · 0.95
testRecoverMethod · 0.95
testDumpColumnTypeMethod · 0.95
testFixedDeltaZeroMethod · 0.95

Calls 12

createOptionsMethod · 0.95
getAllFilesInPathMethod · 0.95
mainMethod · 0.95
recoverFilesMethod · 0.95
printJsonMetaDataMethod · 0.95
printMetaDataMethod · 0.95
printHelpMethod · 0.80
parseIntMethod · 0.80
versionMethod · 0.80
addMethod · 0.65
sizeMethod · 0.65
equalsMethod · 0.45

Tested by 15

testJsonDumpMethod · 0.76
testDumpMethod · 0.76
testDataDumpMethod · 0.76
testBloomFilterMethod · 0.76
testBloomFilter2Method · 0.76
testHasNullMethod · 0.76
testRecoverMethod · 0.76
testDumpColumnTypeMethod · 0.76
testFixedDeltaZeroMethod · 0.76