| 77 | } |
| 78 | |
| 79 | public static void main(String[] args) throws Exception { |
| 80 | System.setProperty("org.slf4j.simpleLogger.log.org.apache.hadoop", "error"); |
| 81 | DriverOptions options = new DriverOptions(args); |
| 82 | |
| 83 | if (options.command == null) { |
| 84 | System.err.println("ORC Java Tools"); |
| 85 | System.err.println(); |
| 86 | System.err.println("usage: java -jar orc-tools-*.jar [--help]" + |
| 87 | " [--define X=Y] <command> <args>"); |
| 88 | System.err.println(); |
| 89 | System.err.println("Commands:"); |
| 90 | System.err.println(" check - check the index of the specified column"); |
| 91 | System.err.println(" convert - convert CSV/JSON/ORC files to ORC"); |
| 92 | System.err.println(" count - recursively find *.orc and print the number of rows"); |
| 93 | System.err.println(" data - print the data from the ORC file"); |
| 94 | System.err.println(" json-schema - scan JSON files to determine their schema"); |
| 95 | System.err.println(" key - print information about the keys"); |
| 96 | System.err.println(" merge - merge multiple ORC files into a single ORC file"); |
| 97 | System.err.println(" meta - print the metadata about the ORC file"); |
| 98 | System.err.println(" scan - scan the ORC file"); |
| 99 | System.err.println(" sizes - list size on disk of each column"); |
| 100 | System.err.println(" version - print the version of this ORC tool"); |
| 101 | System.err.println(); |
| 102 | System.err.println("To get more help, provide -h to the command"); |
| 103 | System.exit(1); |
| 104 | } |
| 105 | Configuration conf = new Configuration(); |
| 106 | if (Runtime.version().feature() > 21) { |
| 107 | conf.setIfUnset("fs.file.impl.disable.cache", "true"); |
| 108 | } |
| 109 | Properties confSettings = options.genericOptions.getOptionProperties("D"); |
| 110 | for(Map.Entry pair: confSettings.entrySet()) { |
| 111 | conf.set(pair.getKey().toString(), pair.getValue().toString()); |
| 112 | } |
| 113 | switch (options.command) { |
| 114 | case "check": |
| 115 | CheckTool.main(conf, options.commandArgs); |
| 116 | break; |
| 117 | case "convert": |
| 118 | ConvertTool.main(conf, options.commandArgs); |
| 119 | break; |
| 120 | case "count": |
| 121 | RowCount.main(conf, options.commandArgs); |
| 122 | break; |
| 123 | case "data": |
| 124 | PrintData.main(conf, options.commandArgs); |
| 125 | break; |
| 126 | case "json-schema": |
| 127 | JsonSchemaFinder.main(conf, options.commandArgs); |
| 128 | break; |
| 129 | case "key": |
| 130 | KeyTool.main(conf, options.commandArgs); |
| 131 | break; |
| 132 | case "merge": |
| 133 | MergeFiles.main(conf, options.commandArgs); |
| 134 | break; |
| 135 | case "meta": |
| 136 | FileDump.main(conf, options.commandArgs); |