use of uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException in project Gaffer by gchq.
the class AccumuloRangeIDRetrieverTest method shouldRetieveElementsInRangeBetweenSeeds.
private void shouldRetieveElementsInRangeBetweenSeeds(final AccumuloStore store) throws StoreException {
// Create set to query for
final Set<Pair<ElementSeed>> simpleEntityRanges = new HashSet<>();
simpleEntityRanges.add(new Pair<ElementSeed>(new EntitySeed("0000"), new EntitySeed("0999")));
// Retrieve elements when less simple entities are provided than the max number of entries for the batch scanner
final GetElementsOperation<Pair<ElementSeed>, CloseableIterable<Element>> operation = new GetElementsInRanges<>(defaultView, simpleEntityRanges);
try {
final AccumuloRangeIDRetriever retriever = new AccumuloRangeIDRetriever(store, operation, new User());
assertEquals(numEntries, Iterables.size(retriever));
} catch (IteratorSettingException e) {
fail("Unable to construct Range Retriever");
}
}
use of uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException in project Gaffer by gchq.
the class AbstractGetRDDHandler method addIterators.
public void addIterators(final AccumuloStore accumuloStore, final Configuration conf, final User user, final GetElementsOperation<?, ?> operation) throws OperationException {
try {
// Update configuration with instance name, table name, zookeepers, and with view
accumuloStore.updateConfiguration(conf, operation.getView(), user);
// Add iterators based on operation-specific (i.e. not view related) options
final IteratorSetting edgeEntityDirectionFilter = accumuloStore.getKeyPackage().getIteratorFactory().getEdgeEntityDirectionFilterIteratorSetting(operation);
if (edgeEntityDirectionFilter != null) {
InputConfigurator.addIterator(AccumuloInputFormat.class, conf, edgeEntityDirectionFilter);
}
final IteratorSetting queryTimeAggregator = accumuloStore.getKeyPackage().getIteratorFactory().getQueryTimeAggregatorIteratorSetting(operation.getView(), accumuloStore);
if (queryTimeAggregator != null) {
InputConfigurator.addIterator(AccumuloInputFormat.class, conf, queryTimeAggregator);
}
} catch (final StoreException | IteratorSettingException e) {
throw new OperationException("Failed to update configuration", e);
}
}
use of uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException in project Gaffer by gchq.
the class GetAdjacentEntitySeedsHandler method doOperation.
public CloseableIterable<EntitySeed> doOperation(final GetAdjacentEntitySeeds operation, final User user, final AccumuloStore store) throws OperationException {
operation.addOption(AccumuloStoreConstants.OPERATION_RETURN_MATCHED_SEEDS_AS_EDGE_SOURCE, "true");
final AccumuloRetriever<?> edgeRetriever;
try {
operation.setIncludeEntities(false);
if (IncludeEdgeType.NONE == operation.getIncludeEdges()) {
operation.setIncludeEdges(IncludeEdgeType.ALL);
}
final IteratorSettingFactory iteratorFactory = store.getKeyPackage().getIteratorFactory();
edgeRetriever = new AccumuloSingleIDRetriever(store, operation, user, iteratorFactory.getElementPreAggregationFilterIteratorSetting(operation.getView(), store), iteratorFactory.getElementPostAggregationFilterIteratorSetting(operation.getView(), store), iteratorFactory.getEdgeEntityDirectionFilterIteratorSetting(operation), iteratorFactory.getQueryTimeAggregatorIteratorSetting(operation.getView(), store));
} catch (IteratorSettingException | StoreException e) {
throw new OperationException(e.getMessage(), e);
}
return new ExtractDestinationEntitySeed(edgeRetriever);
}
use of uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException in project Gaffer by gchq.
the class AccumuloSingleIDRetrieverTest method testUndirectedEdgeSeedQueries.
private void testUndirectedEdgeSeedQueries(final AccumuloStore store) throws AccumuloException, StoreException {
setupGraph(store, numEntries);
final User user = new User();
// Create set to query for
final Set<ElementSeed> ids = new HashSet<>();
for (int i = 0; i < numEntries; i++) {
ids.add(new EdgeSeed("" + i, "B", false));
ids.add(new EdgeSeed("" + i, "C", true));
}
final View view = new View.Builder().edge(TestGroups.EDGE).build();
AccumuloSingleIDRetriever retriever = null;
final GetElements<ElementSeed, ?> operation = new GetElements<>(view, ids);
operation.setIncludeEdges(IncludeEdgeType.UNDIRECTED);
try {
retriever = new AccumuloSingleIDRetriever(store, operation, user);
} catch (IteratorSettingException e) {
e.printStackTrace();
}
for (final Element element : retriever) {
Edge edge = (Edge) element;
assertEquals("B", edge.getDestination());
}
//We should have only 1000 returned the i-B edges that are undirected
assertEquals(numEntries, Iterables.size(retriever));
}
use of uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException in project Gaffer by gchq.
the class AccumuloSingleIDRetrieverTest method testEntitySeedQueryEdgesOnly.
private void testEntitySeedQueryEdgesOnly(final AccumuloStore store) throws AccumuloException, StoreException {
setupGraph(store, numEntries);
final User user = new User();
// Create set to query for
final Set<ElementSeed> ids = new HashSet<>();
for (int i = 0; i < numEntries; i++) {
ids.add(new EntitySeed("" + i));
}
final View view = new View.Builder().edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
AccumuloSingleIDRetriever retriever = null;
final GetElements<ElementSeed, ?> operation = new GetElements<>(view, ids);
operation.setIncludeEntities(false);
try {
retriever = new AccumuloSingleIDRetriever(store, operation, user);
} catch (IteratorSettingException e) {
e.printStackTrace();
}
//Should find both i-B and i-C edges.
assertEquals(numEntries * 2, Iterables.size(retriever));
}
Aggregations