private void resolveViews(final Operations<?> operations) { for (final Operation operation : operations.getOperations()) { if (operation instanceof OperationView) { final OperationView opView = ((OperationView) operation); if (opView.getView() instanceof NamedView) { opView.setView(resolveView((NamedView) opView.getView())); } } else if (operation instanceof Operations) { resolveViews((Operations<?>) operation); } } }
@Override public void preExecute(final OperationChain<?> opChain, final Context context) { if (!edges.isEmpty() || !entities.isEmpty()) { final List<Operation> updatedOps = new ArrayList<>(); for (final Operation op : new ArrayList<>(opChain.flatten())) { updatedOps.add(op); if (OperationView.hasView(op)) { updatedOps.addAll(migrateOperation(op)); } } opChain.updateOperations(updatedOps); } }
protected final View.Builder mergeView(final OperationView operationView, final View viewToMerge) { View.Builder viewBuilder = new View.Builder() .merge(operationView.getView()); if (null != viewToMerge) { viewBuilder.merge(viewToMerge.clone()); } return viewBuilder; }
/** * Performs any transformations specified in a view on an element * * @param element the element to transform */ public void doTransformation(final Element element) { final ViewElementDefinition viewDef = operation.getView().getElement(element.getGroup()); if (null != viewDef) { transform(element, viewDef.getTransformer()); } }
private void updateView(final OperationChain<?> opChain) { for (final Operation operation : opChain.flatten()) { if (operation instanceof OperationView) { final OperationView operationView = (OperationView) operation; final View.Builder viewBuilder = mergeView(operationView, getViewToMerge()); if ((null != whiteListElementGroups && !whiteListElementGroups.isEmpty()) || (null != blackListElementGroups && !blackListElementGroups.isEmpty())) { viewBuilder.removeEntities(this::removeElementGroups); viewBuilder.removeEdges(this::removeElementGroups); } if (!addExtraGroups && null != operationView.getView()) { final Set<String> entityGroups = operationView.getView().getEntityGroups(); viewBuilder.removeEntities(grp -> null == entityGroups || !entityGroups.contains(grp.getKey())); final Set<String> edgeGroups = operationView.getView().getEdgeGroups(); viewBuilder.removeEdges(grp -> null == edgeGroups || !edgeGroups.contains(grp.getKey())); } viewBuilder.expandGlobalDefinitions(); operationView.setView(viewBuilder.build()); } } }
/** * Performs any post Filtering specified in a view on an element * * @param element the element to post Filter * @return the result of validating the element against the post filters */ public boolean doPostFilter(final Element element) { final ViewElementDefinition viewDef = operation.getView().getElement(element.getGroup()); if (null != viewDef) { return postFilter(element, viewDef.getPostTransformFilter()); } return true; }
private List<Operation> migrateOperation(final Operation op) { final OperationView opView = OperationView.class.cast(op); final Map<String, ViewMigration> migratedEntities = migrateViewElements(entities, opView.getView()::getEntity); final Map<String, ViewMigration> migratedEdges = migrateViewElements(edges, opView.getView()::getEdge); final View.Builder viewBuilder = new View.Builder().merge(opView.getView()); for (final Map.Entry<String, ViewMigration> entry : migratedEntities.entrySet()) { viewBuilder.entity(entry.getKey(), entry.getValue().buildViewElementDefinition()); } for (final Map.Entry<String, ViewMigration> entry : migratedEdges.entrySet()) { viewBuilder.edge(entry.getKey(), entry.getValue().buildViewElementDefinition()); } viewBuilder.config(ViewValidator.SKIP_VIEW_VALIDATION, TRUE); final View updatedView = viewBuilder.build(); LOGGER.debug("Migrated view: {}", updatedView); opView.setView(updatedView); final List<Operation> migrationOps = ViewMigration.createMigrationOps(aggregateAfter, migratedEdges.values(), migratedEntities.values()); if (LOGGER.isDebugEnabled()) { try { LOGGER.debug("Migrated operations: {}", StringUtil.toString(JSONSerialiser.serialise(new OperationChain<>(migrationOps), true))); } catch (final SerialisationException e) { LOGGER.debug("Failed to json serialise the migration operations: {}", new OperationChain<>(migrationOps)); } } return migrationOps; }
public AccumuloSingleIDRetriever(final AccumuloStore store, final OP operation, final User user) throws IteratorSettingException, StoreException { this(store, operation, user, store.getKeyPackage().getIteratorFactory().getElementPreAggregationFilterIteratorSetting(operation.getView(), store), store.getKeyPackage().getIteratorFactory().getElementPostAggregationFilterIteratorSetting(operation.getView(), store), store.getKeyPackage().getIteratorFactory().getEdgeEntityDirectionFilterIteratorSetting(operation)); }
LOGGER.debug("Added {} ranges to BatchScanner", ranges.size()); for (final String col : operation.getView().getEdgeGroups()) { scanner.fetchColumnFamily(new Text(col)); LOGGER.debug("Added {} as a column family to fetch", col); for (final String col : operation.getView().getEntityGroups()) { scanner.fetchColumnFamily(new Text(col)); LOGGER.debug("Added {} as a column family to fetch", col);
private static void updateOperationChainViews(final Operations<?> operations, final Schema schema) { for (final Operation operation : operations.getOperations()) { if (operation instanceof Operations) { updateOperationChainViews((Operations) operation, schema); } else if (operation instanceof OperationView) { View opView = ((OperationView) operation).getView(); if (null == opView) { opView = createView(schema); } else if (!(opView instanceof NamedView) && !opView.hasGroups() && !opView.isAllEdges() && !opView.isAllEntities()) { opView = new View.Builder() .merge(createView(schema)) .merge(opView) .build(); } else if (opView.isAllEdges() || opView.isAllEntities()) { View.Builder opViewBuilder = new View.Builder() .merge(opView); if (opView.isAllEdges()) { opViewBuilder.edges(schema.getEdgeGroups()); } if (opView.isAllEntities()) { opViewBuilder.entities(schema.getEntityGroups()); } opView = opViewBuilder.build(); } opView.expandGlobalDefinitions(); ((OperationView) operation).setView(opView); } } }
private GetAllElements getGetAllElements(final OP getRDDOfAllElements) { return new GetAllElements.Builder() .view(getRDDOfAllElements.getView()) .directedType(getRDDOfAllElements.getDirectedType()) .options(getRDDOfAllElements.getOptions()) .build(); }
private void updateOperationChainView(final Operations<?> operations) { for (final Operation operation : operations.getOperations()) { if (operation instanceof Operations) { updateOperationChainView((Operations) operation); } else if (operation instanceof OperationView) { View opView = ((OperationView) operation).getView(); if (null == opView) { opView = config.getView(); } else if (!(opView instanceof NamedView) && !opView.hasGroups() && !opView.isAllEdges() && !opView.isAllEntities()) { opView = new View.Builder() .merge(config.getView()) .merge(opView) .build(); } else if (opView.isAllEdges() || opView.isAllEntities()) { View.Builder opViewBuilder = new View.Builder() .merge(opView); if (opView.isAllEdges()) { opViewBuilder.edges(getSchema().getEdgeGroups()); } if (opView.isAllEntities()) { opViewBuilder.entities(getSchema().getEntityGroups()); } opView = opViewBuilder.build(); } opView.expandGlobalDefinitions(); ((OperationView) operation).setView(opView); } } }
public AccumuloRangeIDRetriever(final AccumuloStore store, final OP operation, final User user) throws IteratorSettingException, StoreException { this(store, operation, user, store.getKeyPackage().getIteratorFactory().getElementPreAggregationFilterIteratorSetting(operation.getView(), store), store.getKeyPackage().getIteratorFactory().getEdgeEntityDirectionFilterIteratorSetting(operation), store.getKeyPackage().getIteratorFactory().getElementPropertyRangeQueryFilter(operation)); }
.getQueryTimeAggregatorIteratorSetting(operation.getView(), accumuloStore); if (null != queryTimeAggregator) { InputConfigurator.addIterator(AccumuloInputFormat.class, conf, queryTimeAggregator);