use of org.apache.accumulo.core.client.sample.SamplerConfiguration in project accumulo by apache.
the class ScanCommand method setupSampling.
protected void setupSampling(final String tableName, final CommandLine cl, final Shell shellState, ScannerBase scanner) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
if (getUseSample(cl)) {
SamplerConfiguration samplerConfig = shellState.getConnector().tableOperations().getSamplerConfiguration(tableName);
if (samplerConfig == null) {
throw new SampleNotPresentException("Table " + tableName + " does not have sampling configured");
}
Shell.log.debug("Using sampling configuration : " + samplerConfig);
scanner.setSamplerConfiguration(samplerConfig);
}
}
use of org.apache.accumulo.core.client.sample.SamplerConfiguration in project accumulo-examples by apache.
the class Query method main.
public static void main(String[] args) throws Exception {
Opts opts = new Opts();
BatchScannerOpts bsOpts = new BatchScannerOpts();
opts.parseArgs(Query.class.getName(), args, bsOpts);
Connector conn = opts.getConnector();
BatchScanner bs = conn.createBatchScanner(opts.getTableName(), opts.auths, bsOpts.scanThreads);
bs.setTimeout(bsOpts.scanTimeout, TimeUnit.MILLISECONDS);
if (opts.useSample) {
SamplerConfiguration samplerConfig = conn.tableOperations().getSamplerConfiguration(opts.getTableName());
CutoffIntersectingIterator.validateSamplerConfig(conn.tableOperations().getSamplerConfiguration(opts.getTableName()));
bs.setSamplerConfiguration(samplerConfig);
}
for (String entry : query(bs, opts.terms, opts.sampleCutoff)) System.out.println(" " + entry);
bs.close();
}
Aggregations