@Test public void testBeginRowHelp() { assertTrue("-b should say it is exclusive", new CompactCommand().getOptions().getOption("b").getDescription().contains("(exclusive)")); }
@Override public Options getOptions() { final Options opts = super.getOptions(); opts.addOption(OptUtil.startRowOpt()); opts.addOption(OptUtil.endRowOpt()); noFlushOption = new Option("nf", "noFlush", false, "do not flush table data in memory before compacting."); opts.addOption(noFlushOption); waitOpt = new Option("w", "wait", false, "wait for compact to finish"); opts.addOption(waitOpt); profileOpt = new Option("pn", "profile", true, "Iterator profile name."); profileOpt.setArgName("profile"); opts.addOption(profileOpt); strategyOpt = new Option("s", "strategy", true, "compaction strategy class name"); opts.addOption(strategyOpt); strategyConfigOpt = new Option("sc", "strategyConfig", true, "Key value options for compaction strategy. Expects <prop>=<value>{,<prop>=<value>}"); opts.addOption(strategyConfigOpt); cancelOpt = new Option(null, "cancel", false, "cancel user initiated compactions"); opts.addOption(cancelOpt); enoSummaryOption = new Option(null, "sf-no-summary", false, "Select files that do not have the summaries specified in the table configuration."); opts.addOption(enoSummaryOption); extraSummaryOption = new Option(null, "sf-extra-summary", false, "Select files that have summary information which exceeds the tablets boundries."); opts.addOption(extraSummaryOption); enoSampleOption = new Option(null, "sf-no-sample", false, "Select files that have no sample data or sample data that differes" + " from the table configuration."); opts.addOption(enoSampleOption); enameOption = newLAO("sf-ename", "Select files using regular expression to match file names. Only" + " matches against last part of path."); opts.addOption(enameOption); epathOption = newLAO("sf-epath", "Select files using regular expression to match file paths to compact." + " Matches against full path."); opts.addOption(epathOption); sizeLtOption = newLAO("sf-lt-esize", "Selects files less than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeLtOption); sizeGtOption = newLAO("sf-gt-esize", "Selects files greater than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeGtOption); minFilesOption = newLAO("min-files", "Only compacts if at least the specified number of files are selected." + " When no file selection criteria are given, all files are selected."); opts.addOption(minFilesOption); outBlockSizeOpt = newLAO("out-data-bs", "Rfile data block size to use for compaction output file. Can use K,M," + " and G suffixes. Uses table settings if not specified."); opts.addOption(outBlockSizeOpt); outHdfsBlockSizeOpt = newLAO("out-hdfs-bs", "HDFS block size to use for compaction output file. Can use K,M, and G" + " suffixes. Uses table settings if not specified."); opts.addOption(outHdfsBlockSizeOpt); outIndexBlockSizeOpt = newLAO("out-index-bs", "Rfile index block size to use for compaction output file. Can use" + " K,M, and G suffixes. Uses table settings if not specified."); opts.addOption(outIndexBlockSizeOpt); outCompressionOpt = newLAO("out-compress", "Compression to use for compaction output file. Either snappy, gz, lzo," + " or none. Uses table settings if not specified."); opts.addOption(outCompressionOpt); outReplication = newLAO("out-replication", "HDFS replication to use for compaction output file. Uses table" + " settings if not specified."); opts.addOption(outReplication); return opts; }
CompactCommand extends TableOperation { @Override public Options getOptions() { final Options opts = super.getOptions(); opts.addOption(OptUtil.startRowOpt()); opts.addOption(OptUtil.endRowOpt()); noFlushOption = new Option("nf", "noFlush", false, "do not flush table data in memory before compacting."); opts.addOption(noFlushOption); waitOpt = new Option("w", "wait", false, "wait for compact to finish"); opts.addOption(waitOpt); profileOpt = new Option("pn", "profile", true, "Iterator profile name."); profileOpt.setArgName("profile"); opts.addOption(profileOpt); strategyOpt = new Option("s", "strategy", true, "compaction strategy class name"); opts.addOption(strategyOpt); strategyConfigOpt = new Option("sc", "strategyConfig", true, "Key value options for compaction strategy. Expects <prop>=<value>{,<prop>=<value>}"); opts.addOption(strategyConfigOpt); cancelOpt = new Option(null, "cancel", false, "cancel user initiated compactions"); opts.addOption(cancelOpt); enoSummaryOption = new Option(null, "sf-no-summary", false, "Select files that do not have the summaries specified in the table configuration."); opts.addOption(enoSummaryOption); extraSummaryOption = new Option(null, "sf-extra-summary", false, "Select files that have summary information which exceeds the tablets boundries."); opts.addOption(extraSummaryOption); enoSampleOption = new Option(null, "sf-no-sample", false, "Select files that have no sample data or sample data that differes" + " from the table configuration."); opts.addOption(enoSampleOption); enameOption = newLAO("sf-ename", "Select files using regular expression to match file names. Only" + " matches against last part of path."); opts.addOption(enameOption); epathOption = newLAO("sf-epath", "Select files using regular expression to match file paths to compact." + " Matches against full path."); opts.addOption(epathOption); sizeLtOption = newLAO("sf-lt-esize", "Selects files less than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeLtOption); sizeGtOption = newLAO("sf-gt-esize", "Selects files greater than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeGtOption); minFilesOption = newLAO("min-files", "Only compacts if at least the specified number of files are selected." + " When no file selection criteria are given, all files are selected."); opts.addOption(minFilesOption); outBlockSizeOpt = newLAO("out-data-bs", "Rfile data block size to use for compaction output file. Can use K,M," + " and G suffixes. Uses table settings if not specified."); opts.addOption(outBlockSizeOpt); outHdfsBlockSizeOpt = newLAO("out-hdfs-bs", "HDFS block size to use for compaction output file. Can use K,M, and G" + " suffixes. Uses table settings if not specified."); opts.addOption(outHdfsBlockSizeOpt); outIndexBlockSizeOpt = newLAO("out-index-bs", "Rfile index block size to use for compaction output file. Can use" + " K,M, and G suffixes. Uses table settings if not specified."); opts.addOption(outIndexBlockSizeOpt); outCompressionOpt = newLAO("out-compress", "Compression to use for compaction output file. Either snappy, gz, lzo," + " or none. Uses table settings if not specified."); opts.addOption(outCompressionOpt); outReplication = newLAO("out-replication", "HDFS replication to use for compaction output file. Uses table" + " settings if not specified."); opts.addOption(outReplication); return opts; } }
CompactCommand extends TableOperation { @Override public Options getOptions() { final Options opts = super.getOptions(); opts.addOption(OptUtil.startRowOpt()); opts.addOption(OptUtil.endRowOpt()); noFlushOption = new Option("nf", "noFlush", false, "do not flush table data in memory before compacting."); opts.addOption(noFlushOption); waitOpt = new Option("w", "wait", false, "wait for compact to finish"); opts.addOption(waitOpt); profileOpt = new Option("pn", "profile", true, "Iterator profile name."); profileOpt.setArgName("profile"); opts.addOption(profileOpt); strategyOpt = new Option("s", "strategy", true, "compaction strategy class name"); opts.addOption(strategyOpt); strategyConfigOpt = new Option("sc", "strategyConfig", true, "Key value options for compaction strategy. Expects <prop>=<value>{,<prop>=<value>}"); opts.addOption(strategyConfigOpt); cancelOpt = new Option(null, "cancel", false, "cancel user initiated compactions"); opts.addOption(cancelOpt); enoSummaryOption = new Option(null, "sf-no-summary", false, "Select files that do not have the summaries specified in the table configuration."); opts.addOption(enoSummaryOption); extraSummaryOption = new Option(null, "sf-extra-summary", false, "Select files that have summary information which exceeds the tablets boundries."); opts.addOption(extraSummaryOption); enoSampleOption = new Option(null, "sf-no-sample", false, "Select files that have no sample data or sample data that differes" + " from the table configuration."); opts.addOption(enoSampleOption); enameOption = newLAO("sf-ename", "Select files using regular expression to match file names. Only" + " matches against last part of path."); opts.addOption(enameOption); epathOption = newLAO("sf-epath", "Select files using regular expression to match file paths to compact." + " Matches against full path."); opts.addOption(epathOption); sizeLtOption = newLAO("sf-lt-esize", "Selects files less than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeLtOption); sizeGtOption = newLAO("sf-gt-esize", "Selects files greater than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeGtOption); minFilesOption = newLAO("min-files", "Only compacts if at least the specified number of files are selected." + " When no file selection criteria are given, all files are selected."); opts.addOption(minFilesOption); outBlockSizeOpt = newLAO("out-data-bs", "Rfile data block size to use for compaction output file. Can use K,M," + " and G suffixes. Uses table settings if not specified."); opts.addOption(outBlockSizeOpt); outHdfsBlockSizeOpt = newLAO("out-hdfs-bs", "HDFS block size to use for compaction output file. Can use K,M, and G" + " suffixes. Uses table settings if not specified."); opts.addOption(outHdfsBlockSizeOpt); outIndexBlockSizeOpt = newLAO("out-index-bs", "Rfile index block size to use for compaction output file. Can use" + " K,M, and G suffixes. Uses table settings if not specified."); opts.addOption(outIndexBlockSizeOpt); outCompressionOpt = newLAO("out-compress", "Compression to use for compaction output file. Either snappy, gz, lzo," + " or none. Uses table settings if not specified."); opts.addOption(outCompressionOpt); outReplication = newLAO("out-replication", "HDFS replication to use for compaction output file. Uses table" + " settings if not specified."); opts.addOption(outReplication); return opts; }  }
CompactCommand extends TableOperation { @Override public Options getOptions() { final Options opts = super.getOptions(); opts.addOption(OptUtil.startRowOpt()); opts.addOption(OptUtil.endRowOpt()); noFlushOption = new Option("nf", "noFlush", false, "do not flush table data in memory before compacting."); opts.addOption(noFlushOption); waitOpt = new Option("w", "wait", false, "wait for compact to finish"); opts.addOption(waitOpt); profileOpt = new Option("pn", "profile", true, "Iterator profile name."); profileOpt.setArgName("profile"); opts.addOption(profileOpt); strategyOpt = new Option("s", "strategy", true, "compaction strategy class name"); opts.addOption(strategyOpt); strategyConfigOpt = new Option("sc", "strategyConfig", true, "Key value options for compaction strategy. Expects <prop>=<value>{,<prop>=<value>}"); opts.addOption(strategyConfigOpt); cancelOpt = new Option(null, "cancel", false, "cancel user initiated compactions"); opts.addOption(cancelOpt); enoSummaryOption = new Option(null, "sf-no-summary", false, "Select files that do not have the summaries specified in the table configuration."); opts.addOption(enoSummaryOption); extraSummaryOption = new Option(null, "sf-extra-summary", false, "Select files that have summary information which exceeds the tablets boundries."); opts.addOption(extraSummaryOption); enoSampleOption = new Option(null, "sf-no-sample", false, "Select files that have no sample data or sample data that differes" + " from the table configuration."); opts.addOption(enoSampleOption); enameOption = newLAO("sf-ename", "Select files using regular expression to match file names. Only" + " matches against last part of path."); opts.addOption(enameOption); epathOption = newLAO("sf-epath", "Select files using regular expression to match file paths to compact." + " Matches against full path."); opts.addOption(epathOption); sizeLtOption = newLAO("sf-lt-esize", "Selects files less than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeLtOption); sizeGtOption = newLAO("sf-gt-esize", "Selects files greater than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeGtOption); minFilesOption = newLAO("min-files", "Only compacts if at least the specified number of files are selected." + " When no file selection criteria are given, all files are selected."); opts.addOption(minFilesOption); outBlockSizeOpt = newLAO("out-data-bs", "Rfile data block size to use for compaction output file. Can use K,M," + " and G suffixes. Uses table settings if not specified."); opts.addOption(outBlockSizeOpt); outHdfsBlockSizeOpt = newLAO("out-hdfs-bs", "HDFS block size to use for compaction output file. Can use K,M, and G" + " suffixes. Uses table settings if not specified."); opts.addOption(outHdfsBlockSizeOpt); outIndexBlockSizeOpt = newLAO("out-index-bs", "Rfile index block size to use for compaction output file. Can use" + " K,M, and G suffixes. Uses table settings if not specified."); opts.addOption(outIndexBlockSizeOpt); outCompressionOpt = newLAO("out-compress", "Compression to use for compaction output file. Either snappy, gz, lzo," + " or none. Uses table settings if not specified."); opts.addOption(outCompressionOpt); outReplication = newLAO("out-replication", "HDFS replication to use for compaction output file. Uses table" + " settings if not specified."); opts.addOption(outReplication); return opts; }  @Override String description(); @Override int execute(final String fullCommand, final CommandLine cl, final Shell shellState); @Override Options getOptions(); }
CompactCommand extends TableOperation { @Override public Options getOptions() { final Options opts = super.getOptions(); opts.addOption(OptUtil.startRowOpt()); opts.addOption(OptUtil.endRowOpt()); noFlushOption = new Option("nf", "noFlush", false, "do not flush table data in memory before compacting."); opts.addOption(noFlushOption); waitOpt = new Option("w", "wait", false, "wait for compact to finish"); opts.addOption(waitOpt); profileOpt = new Option("pn", "profile", true, "Iterator profile name."); profileOpt.setArgName("profile"); opts.addOption(profileOpt); strategyOpt = new Option("s", "strategy", true, "compaction strategy class name"); opts.addOption(strategyOpt); strategyConfigOpt = new Option("sc", "strategyConfig", true, "Key value options for compaction strategy. Expects <prop>=<value>{,<prop>=<value>}"); opts.addOption(strategyConfigOpt); cancelOpt = new Option(null, "cancel", false, "cancel user initiated compactions"); opts.addOption(cancelOpt); enoSummaryOption = new Option(null, "sf-no-summary", false, "Select files that do not have the summaries specified in the table configuration."); opts.addOption(enoSummaryOption); extraSummaryOption = new Option(null, "sf-extra-summary", false, "Select files that have summary information which exceeds the tablets boundries."); opts.addOption(extraSummaryOption); enoSampleOption = new Option(null, "sf-no-sample", false, "Select files that have no sample data or sample data that differes" + " from the table configuration."); opts.addOption(enoSampleOption); enameOption = newLAO("sf-ename", "Select files using regular expression to match file names. Only" + " matches against last part of path."); opts.addOption(enameOption); epathOption = newLAO("sf-epath", "Select files using regular expression to match file paths to compact." + " Matches against full path."); opts.addOption(epathOption); sizeLtOption = newLAO("sf-lt-esize", "Selects files less than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeLtOption); sizeGtOption = newLAO("sf-gt-esize", "Selects files greater than specified size. Uses the estimated size of" + " file in metadata table. Can use K,M, and G suffixes"); opts.addOption(sizeGtOption); minFilesOption = newLAO("min-files", "Only compacts if at least the specified number of files are selected." + " When no file selection criteria are given, all files are selected."); opts.addOption(minFilesOption); outBlockSizeOpt = newLAO("out-data-bs", "Rfile data block size to use for compaction output file. Can use K,M," + " and G suffixes. Uses table settings if not specified."); opts.addOption(outBlockSizeOpt); outHdfsBlockSizeOpt = newLAO("out-hdfs-bs", "HDFS block size to use for compaction output file. Can use K,M, and G" + " suffixes. Uses table settings if not specified."); opts.addOption(outHdfsBlockSizeOpt); outIndexBlockSizeOpt = newLAO("out-index-bs", "Rfile index block size to use for compaction output file. Can use" + " K,M, and G suffixes. Uses table settings if not specified."); opts.addOption(outIndexBlockSizeOpt); outCompressionOpt = newLAO("out-compress", "Compression to use for compaction output file. Either snappy, gz, lzo," + " or none. Uses table settings if not specified."); opts.addOption(outCompressionOpt); outReplication = newLAO("out-replication", "HDFS replication to use for compaction output file. Uses table" + " settings if not specified."); opts.addOption(outReplication); return opts; }  @Override String description(); @Override int execute(final String fullCommand, final CommandLine cl, final Shell shellState); @Override Options getOptions();  }