Search in sources :

Example 41 with Routing

use of io.crate.metadata.Routing in project crate by crate.

the class RoutingBuilder method allocateRouting.

Routing allocateRouting(TableInfo tableInfo, WhereClause where, RoutingProvider.ShardSelection shardSelection, SessionContext sessionContext) {
    Routing routing = tableInfo.getRouting(clusterState, routingProvider, where, shardSelection, sessionContext);
    Map<RelationName, List<Routing>> routingListByTable = routingListByTableStack.peekLast();
    if (routingListByTable == null) {
        return routing;
    }
    List<Routing> existingRoutings = routingListByTable.get(tableInfo.ident());
    if (existingRoutings == null) {
        existingRoutings = new ArrayList<>();
        routingListByTable.put(tableInfo.ident(), existingRoutings);
    }
    existingRoutings.add(routing);
    return routing;
}
Also used : ShardRouting(org.elasticsearch.cluster.routing.ShardRouting) Routing(io.crate.metadata.Routing) RelationName(io.crate.metadata.RelationName) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

Routing (io.crate.metadata.Routing)41 Test (org.junit.Test)23 RoutedCollectPhase (io.crate.execution.dsl.phases.RoutedCollectPhase)18 Reference (io.crate.metadata.Reference)9 RelationName (io.crate.metadata.RelationName)8 RoutedCollectPhase (io.crate.planner.node.dql.RoutedCollectPhase)8 ArrayList (java.util.ArrayList)7 Symbol (io.crate.expression.symbol.Symbol)6 ColumnIdent (io.crate.metadata.ColumnIdent)6 List (java.util.List)6 Map (java.util.Map)6 UUID (java.util.UUID)6 IntIndexedContainer (com.carrotsearch.hppc.IntIndexedContainer)5 Row (io.crate.data.Row)5 EvaluatingNormalizer (io.crate.expression.eval.EvaluatingNormalizer)5 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)5 ShardRouting (org.elasticsearch.cluster.routing.ShardRouting)5 ImmutableList (com.google.common.collect.ImmutableList)4 WhereClause (io.crate.analyze.WhereClause)4 TableInfo (io.crate.metadata.table.TableInfo)4