@Override public Iterator<String> iterator() { try { return values.iterator(); } finally { values = null; } }
@Override public ListenableFuture<Statement> getStatementAsync(final DBSession dbSession) { Function<CounterMutation, ListenableFuture<Statement>> statementFetcher = new Function<CounterMutation, ListenableFuture<Statement>>() { public ListenableFuture<Statement> apply(CounterMutation batchable) { return batchable.getStatementAsync(dbSession); }; }; return mergeToBatch(Type.COUNTER, batchables.iterator(), statementFetcher); }
private RelationPlan planCrossJoinUnnest(RelationPlan leftPlan, Join joinNode, Unnest node) { TupleDescriptor outputDescriptor = analysis.getOutputDescriptor(joinNode); TupleDescriptor unnestOutputDescriptor = analysis.getOutputDescriptor(node); // Create symbols for the result of unnesting ImmutableList.Builder<Symbol> unnestedSymbolsBuilder = ImmutableList.builder(); for (Field field : unnestOutputDescriptor.getVisibleFields()) { Symbol symbol = symbolAllocator.newSymbol(field); unnestedSymbolsBuilder.add(symbol); } ImmutableList<Symbol> unnestedSymbols = unnestedSymbolsBuilder.build(); // Add a projection for all the unnest arguments PlanBuilder planBuilder = initializePlanBuilder(leftPlan); planBuilder = appendProjections(planBuilder, node.getExpressions()); TranslationMap translations = planBuilder.getTranslations(); ProjectNode projectNode = checkType(planBuilder.getRoot(), ProjectNode.class, "planBuilder.getRoot()"); ImmutableMap.Builder<Symbol, List<Symbol>> unnestSymbols = ImmutableMap.builder(); UnmodifiableIterator<Symbol> unnestedSymbolsIterator = unnestedSymbols.iterator(); for (Expression expression : node.getExpressions()) { Type type = analysis.getType(expression); Symbol inputSymbol = translations.get(expression); if (type instanceof ArrayType) { unnestSymbols.put(inputSymbol, ImmutableList.of(unnestedSymbolsIterator.next())); } else if (type instanceof MapType) { unnestSymbols.put( inputSymbol, ImmutableList.of(unnestedSymbolsIterator.next(), unnestedSymbolsIterator.next())); } else { throw new IllegalArgumentException("Unsupported type for UNNEST: " + type); } } Optional<Symbol> ordinalitySymbol = node.isWithOrdinality() ? Optional.of(unnestedSymbolsIterator.next()) : Optional.empty(); checkState( !unnestedSymbolsIterator.hasNext(), "Not all output symbols were matched with input symbols"); UnnestNode unnestNode = new UnnestNode( idAllocator.getNextId(), projectNode, leftPlan.getOutputSymbols(), unnestSymbols.build(), ordinalitySymbol); return new RelationPlan( unnestNode, outputDescriptor, unnestNode.getOutputSymbols(), Optional.empty()); }
/** * Computes a path between two ConnectPoints. * * @param intent intent on which behalf path is being computed * @param one start of the path * @param two end of the path * @return Path between the two * @throws PathNotFoundException if a path cannot be found */ protected Path getPath(ConnectivityIntent intent, ElementId one, ElementId two) { Set<Path> paths = pathService.getPaths(one, two, weight(intent.constraints())); final List<Constraint> constraints = intent.constraints(); ImmutableList<Path> filtered = FluentIterable.from(paths) .filter( new Predicate<Path>() { @Override public boolean apply(Path path) { return checkPath(path, constraints); } }) .toList(); if (filtered.isEmpty()) { throw new PathNotFoundException("No packet path from " + one + " to " + two); } // TODO: let's be more intelligent about this eventually return filtered.iterator().next(); }
/** * Returns a string representation of this collation, suitably terse given that it will appear in * plan traces. Examples: "[]", "[2]", "[0 DESC, 1]", "[0 DESC, 1 ASC NULLS LAST]". */ public String toString() { Iterator<RelFieldCollation> it = fieldCollations.iterator(); if (!it.hasNext()) { return "[]"; } StringBuilder sb = new StringBuilder(); sb.append('['); for (; ; ) { RelFieldCollation e = it.next(); sb.append(e.getFieldIndex()); if (e.direction != RelFieldCollation.Direction.ASCENDING || e.nullDirection != RelFieldCollation.NullDirection.UNSPECIFIED) { sb.append(' ').append(e.shortString()); } if (!it.hasNext()) { return sb.append(']').toString(); } sb.append(',').append(' '); } }
/** @inheritDoc */ @Override public Iterator<T> iterator() { return mSinks.iterator(); }
@Override public void dispatch(Object resource, HttpContext context) { new ResourceMethodDispatchWrapperChainImpl(wrappers.iterator(), wrappedDispatcher) .wrapDispatch(resource, context); }
@Override public Iterator<ShardRouting> iterator() { return shards.iterator(); }
@Override public Iterator<String> iterator() { return elements.iterator(); }
@Override public Iterator<RelOptRule> iterator() { return rules.iterator(); }