private CloseableIterable<Element> doOperation(final GetElements operation, final ParquetStore store, final User user) throws OperationException { try { return new ParquetElementRetriever(operation.getView(), store, operation.getDirectedType(), operation.getIncludeIncomingOutGoing(), operation.getSeedMatching(), operation.getInput(), user); } catch (final StoreException e) { throw new OperationException("Failed to getGroup elements", e); } } }
public CloseableIterable<? extends Element> doOperation(final GetElements operation, final User user, final AccumuloStore store) throws OperationException { if (null != operation.getOption("accumulostore.operation.return_matched_id_as_edge_source")) { throw new IllegalArgumentException("The accumulostore.operation.return_matched_id_as_edge_source option has been removed. Instead of flipping the Edges around the result Edges will have a matchedVertex field set specifying if the SOURCE or DESTINATION was matched."); } if (null == operation.getInput()) { throw new OperationException("Operation input is undefined - please specify an input."); } try { return new AccumuloElementsRetriever(store, operation, user); } catch (final IteratorSettingException | StoreException e) { throw new OperationException("Failed to get elements", e); } } }
public AccumuloElementsRetriever(final AccumuloStore store, final GetElements operation, final User user) throws IteratorSettingException, StoreException { super(store, operation, user, SeedMatching.SeedMatchingType.EQUAL != operation.getSeedMatching(), store.getKeyPackage().getIteratorFactory().getElementPreAggregationFilterIteratorSetting(operation.getView(), store), store.getKeyPackage().getIteratorFactory().getElementPostAggregationFilterIteratorSetting(operation.getView(), store), store.getKeyPackage().getIteratorFactory().getEdgeEntityDirectionFilterIteratorSetting(operation), store.getKeyPackage().getIteratorFactory().getQueryTimeAggregatorIteratorSetting(operation.getView(), store)); } }
@Override public CloseableIterable<? extends Element> doOperation(final GetElements operation, final Context context, final Store store) throws OperationException { final CloseableIterable<? extends Element> result; final Iterable<? extends ElementId> input = operation.getInput(); if (null == input) { throw new OperationException("Operation input is undefined - please specify an input."); } else { final Iterator<? extends ElementId> inputIter = input.iterator(); if (inputIter.hasNext()) { result = doOperation(operation, (ParquetStore) store, context.getUser()); } else { result = new EmptyClosableIterable<>(); } if (inputIter instanceof CloseableIterator) { ((CloseableIterator) inputIter).close(); } } if (input instanceof CloseableIterable) { ((CloseableIterable) input).close(); } return result; }
private CloseableIterable<Element> doOperation(final GetElements operation, final MapStore mapStore) throws OperationException { final MapImpl mapImpl = mapStore.getMapImpl(); if (!mapImpl.isMaintainIndex()) { throw new OperationException("Cannot execute getElements if the properties request that an index is not created"); } final Iterable<? extends ElementId> seeds = operation.getInput(); if (null == seeds) { return new EmptyClosableIterable<>(); } return new ElementsIterable(mapImpl, operation, mapStore.getSchema()); }
@Override public CloseableIterator<Element> iterator() { Stream<Element> elements = Streams.toStream(getElements.getInput()) .flatMap(elementId -> GetElementsUtil.getRelevantElements(mapImpl, elementId, getElements.getView(), getElements.getDirectedType(), getElements.getIncludeIncomingOutGoing(), getElements.getSeedMatching()).stream()); elements = elements.flatMap(e -> Streams.toStream(mapImpl.getElements(e))); elements = GetElementsUtil.applyView(elements, schema, getElements.getView()); elements = elements.map(element -> mapImpl.cloneElement(element, schema)); elements = elements.map(element -> { ViewUtil.removeProperties(getElements.getView(), element); return element; }); return new WrappedCloseableIterator<>(elements.iterator()); } }