Example usage for com.google.common.collect ImmutableMultimap.Builder containsKey

List of usage examples for com.google.common.collect ImmutableMultimap.Builder containsKey

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMultimap.Builder containsKey.

Prototype

@Override
    public boolean containsKey(@Nullable Object key) 

Source Link

Usage

From source file:io.prestosql.sql.planner.optimizations.joins.JoinGraph.java

private JoinGraph joinWith(JoinGraph other, List<JoinNode.EquiJoinClause> joinClauses, Context context,
        PlanNodeId newRoot) {//from w ww  . j a va2 s  .  c o  m
    for (PlanNode node : other.nodes) {
        checkState(!edges.containsKey(node.getId()), format("Node [%s] appeared in two JoinGraphs", node));
    }

    List<PlanNode> nodes = ImmutableList.<PlanNode>builder().addAll(this.nodes).addAll(other.nodes).build();

    ImmutableMultimap.Builder<PlanNodeId, Edge> edges = ImmutableMultimap.<PlanNodeId, Edge>builder()
            .putAll(this.edges).putAll(other.edges);

    List<Expression> joinedFilters = ImmutableList.<Expression>builder().addAll(this.filters)
            .addAll(other.filters).build();

    for (JoinNode.EquiJoinClause edge : joinClauses) {
        Symbol leftSymbol = edge.getLeft();
        Symbol rightSymbol = edge.getRight();
        checkState(context.containsSymbol(leftSymbol));
        checkState(context.containsSymbol(rightSymbol));

        PlanNode left = context.getSymbolSource(leftSymbol);
        PlanNode right = context.getSymbolSource(rightSymbol);
        edges.put(left.getId(), new Edge(right, leftSymbol, rightSymbol));
        edges.put(right.getId(), new Edge(left, rightSymbol, leftSymbol));
    }

    return new JoinGraph(nodes, edges.build(), newRoot, joinedFilters, Optional.empty());
}