use of org.apache.accumulo.shell.format.DeleterFormatter in project accumulo by apache.
the class DeleteManyCommand method execute.
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
final String tableName = OptUtil.getTableOpt(cl, shellState);
final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
// handle first argument, if present, the authorizations list to
// scan with
final Authorizations auths = getAuths(cl, shellState);
final Scanner scanner = shellState.getConnector().createScanner(tableName, auths);
scanner.addScanIterator(new IteratorSetting(Integer.MAX_VALUE, "NOVALUE", SortedKeyIterator.class));
// handle session-specific scan iterators
addScanIterators(shellState, cl, scanner, tableName);
// handle remaining optional arguments
scanner.setRange(getRange(cl, interpeter));
scanner.setTimeout(getTimeout(cl), TimeUnit.MILLISECONDS);
// handle columns
fetchColumns(cl, scanner, interpeter);
// output / delete the records
final BatchWriter writer = shellState.getConnector().createBatchWriter(tableName, new BatchWriterConfig().setTimeout(getTimeout(cl), TimeUnit.MILLISECONDS));
FormatterConfig config = new FormatterConfig();
config.setPrintTimestamps(cl.hasOption(timestampOpt.getOpt()));
shellState.printLines(new DeleterFormatter(writer, scanner, config, shellState, cl.hasOption(forceOpt.getOpt())), false);
return 0;
}
Aggregations