use of org.apache.accumulo.core.client.mapreduce.RangeInputSplit in project accumulo by apache.
the class AccumuloInputFormatIT method testCorrectRangeInputSplits.
@Test
public void testCorrectRangeInputSplits() throws Exception {
Job job = Job.getInstance();
String table = getUniqueNames(1)[0];
Authorizations auths = new Authorizations("foo");
Collection<Pair<Text, Text>> fetchColumns = Collections.singleton(new Pair<>(new Text("foo"), new Text("bar")));
boolean isolated = true, localIters = true;
Level level = Level.WARN;
Connector connector = getConnector();
connector.tableOperations().create(table);
AccumuloInputFormat.setConnectionInfo(job, getConnectionInfo());
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setScanAuthorizations(job, auths);
AccumuloInputFormat.setScanIsolation(job, isolated);
AccumuloInputFormat.setLocalIterators(job, localIters);
AccumuloInputFormat.fetchColumns(job, fetchColumns);
AccumuloInputFormat.setLogLevel(job, level);
AccumuloInputFormat aif = new AccumuloInputFormat();
List<InputSplit> splits = aif.getSplits(job);
Assert.assertEquals(1, splits.size());
InputSplit split = splits.get(0);
Assert.assertEquals(RangeInputSplit.class, split.getClass());
RangeInputSplit risplit = (RangeInputSplit) split;
Assert.assertEquals(getAdminPrincipal(), risplit.getPrincipal());
Assert.assertEquals(table, risplit.getTableName());
Assert.assertEquals(getAdminToken(), risplit.getToken());
Assert.assertEquals(auths, risplit.getAuths());
Assert.assertEquals(getConnector().getInstance().getInstanceName(), risplit.getInstanceName());
Assert.assertEquals(isolated, risplit.isIsolatedScan());
Assert.assertEquals(localIters, risplit.usesLocalIterators());
Assert.assertEquals(fetchColumns, risplit.getFetchedColumns());
Assert.assertEquals(level, risplit.getLogLevel());
}
use of org.apache.accumulo.core.client.mapreduce.RangeInputSplit in project incubator-rya by apache.
the class MergeToolMapper method setupScanner.
private static Scanner setupScanner(final Context context, final String tableName, final Configuration config) throws IOException {
final RangeInputSplit split = (RangeInputSplit) context.getInputSplit();
final Range splitRange = split.getRange();
final Scanner scanner = AccumuloRyaUtils.getScanner(tableName, config);
scanner.setRange(splitRange);
return scanner;
}
Aggregations