Search in sources :

Example 1 with IntCursor

use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.

the class NodeFetchRequest method writeTo.

@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeLong(jobId.getMostSignificantBits());
    out.writeLong(jobId.getLeastSignificantBits());
    out.writeVInt(fetchPhaseId);
    out.writeBoolean(closeContext);
    if (toFetch == null) {
        out.writeVInt(0);
    } else {
        out.writeVInt(toFetch.size());
        for (IntObjectCursor<? extends IntContainer> toFetchCursor : toFetch) {
            out.writeVInt(toFetchCursor.key);
            out.writeVInt(toFetchCursor.value.size());
            for (IntCursor docCursor : toFetchCursor.value) {
                out.writeInt(docCursor.value);
            }
        }
    }
}
Also used : IntCursor(com.carrotsearch.hppc.cursors.IntCursor)

Example 2 with IntCursor

use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.

the class ContextPreparer method prepareOnRemote.

public List<CompletableFuture<Bucket>> prepareOnRemote(Iterable<? extends NodeOperation> nodeOperations, JobExecutionContext.Builder contextBuilder, SharedShardContexts sharedShardContexts) {
    ContextPreparer.PreparerContext preparerContext = new PreparerContext(clusterService.localNode().getId(), contextBuilder, logger, distributingDownstreamFactory, nodeOperations, sharedShardContexts);
    registerContextPhases(nodeOperations, preparerContext);
    logger.trace("prepareOnRemote: nodeOperations={}, targetSourceMap={}", nodeOperations, preparerContext.opCtx.targetToSourceMap);
    for (IntCursor cursor : preparerContext.opCtx.findLeafs()) {
        prepareSourceOperations(cursor.value, preparerContext);
    }
    assert preparerContext.opCtx.allNodeOperationContextsBuilt() : "some nodeOperations haven't been processed";
    return preparerContext.directResponseFutures;
}
Also used : IntCursor(com.carrotsearch.hppc.cursors.IntCursor)

Example 3 with IntCursor

use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.

the class ContextPreparer method prepareOnHandler.

public List<CompletableFuture<Bucket>> prepareOnHandler(Iterable<? extends NodeOperation> nodeOperations, JobExecutionContext.Builder contextBuilder, List<Tuple<ExecutionPhase, BatchConsumer>> handlerPhases, SharedShardContexts sharedShardContexts) {
    ContextPreparer.PreparerContext preparerContext = new PreparerContext(clusterService.localNode().getId(), contextBuilder, logger, distributingDownstreamFactory, nodeOperations, sharedShardContexts);
    for (Tuple<ExecutionPhase, BatchConsumer> handlerPhase : handlerPhases) {
        preparerContext.registerLeaf(handlerPhase.v1(), handlerPhase.v2());
    }
    registerContextPhases(nodeOperations, preparerContext);
    logger.trace("prepareOnHandler: nodeOperations={}, handlerPhases={}, targetSourceMap={}", nodeOperations, handlerPhases, preparerContext.opCtx.targetToSourceMap);
    IntHashSet leafs = new IntHashSet();
    for (Tuple<ExecutionPhase, BatchConsumer> handlerPhase : handlerPhases) {
        ExecutionPhase phase = handlerPhase.v1();
        createContexts(phase, preparerContext);
        leafs.add(phase.phaseId());
    }
    leafs.addAll(preparerContext.opCtx.findLeafs());
    for (IntCursor cursor : leafs) {
        prepareSourceOperations(cursor.value, preparerContext);
    }
    assert preparerContext.opCtx.allNodeOperationContextsBuilt() : "some nodeOperations haven't been processed";
    return preparerContext.directResponseFutures;
}
Also used : IntCursor(com.carrotsearch.hppc.cursors.IntCursor) ExecutionPhase(io.crate.planner.node.ExecutionPhase) BatchConsumer(io.crate.data.BatchConsumer) ProjectingBatchConsumer(io.crate.operation.projectors.ProjectingBatchConsumer)

Example 4 with IntCursor

use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.

the class JobExecutionContext method start.

public void start() throws Throwable {
    for (IntCursor id : orderedContextIds) {
        ExecutionSubContext subContext = subContexts.get(id.value);
        if (subContext == null || closed.get()) {
            // got killed before start was called
            break;
        }
        subContext.start();
    }
    if (failure != null) {
        throw failure;
    }
}
Also used : IntCursor(com.carrotsearch.hppc.cursors.IntCursor)

Example 5 with IntCursor

use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.

the class FetchProjectorContext method nodeIdsToStreamers.

public Map<String, ? extends IntObjectMap<Streamer[]>> nodeIdsToStreamers() {
    if (nodeIdToReaderIdToStreamers == null) {
        nodeIdToReaderIdToStreamers = new HashMap<>(nodeToReaderIds.size(), 1.0f);
        for (Map.Entry<String, IntSet> entry : nodeToReaderIds.entrySet()) {
            IntObjectHashMap<Streamer[]> readerIdsToStreamers = new IntObjectHashMap<>();
            nodeIdToReaderIdToStreamers.put(entry.getKey(), readerIdsToStreamers);
            for (IntCursor readerIdCursor : entry.getValue()) {
                FetchSource fetchSource = getFetchSource(readerIdCursor.value);
                if (fetchSource == null) {
                    continue;
                }
                readerIdsToStreamers.put(readerIdCursor.value, Symbols.streamerArray(fetchSource.references()));
            }
        }
    }
    return nodeIdToReaderIdToStreamers;
}
Also used : FetchSource(io.crate.planner.node.fetch.FetchSource) IntSet(com.carrotsearch.hppc.IntSet) IntObjectHashMap(com.carrotsearch.hppc.IntObjectHashMap) IntCursor(com.carrotsearch.hppc.cursors.IntCursor) HashMap(java.util.HashMap) IntObjectMap(com.carrotsearch.hppc.IntObjectMap) TreeMap(java.util.TreeMap) IntObjectHashMap(com.carrotsearch.hppc.IntObjectHashMap) Map(java.util.Map)

Aggregations

IntCursor (com.carrotsearch.hppc.cursors.IntCursor)37 Map (java.util.Map)11 IntIndexedContainer (com.carrotsearch.hppc.IntIndexedContainer)8 ArrayList (java.util.ArrayList)7 GraphHopperStorage (com.graphhopper.storage.GraphHopperStorage)5 HashMap (java.util.HashMap)5 IndexMetadata (org.elasticsearch.cluster.metadata.IndexMetadata)5 Index (org.elasticsearch.index.Index)5 IndexNotFoundException (org.elasticsearch.index.IndexNotFoundException)5 IntArrayList (com.carrotsearch.hppc.IntArrayList)4 TreeMap (java.util.TreeMap)4 Metadata (org.elasticsearch.cluster.metadata.Metadata)4 IntObjectHashMap (com.carrotsearch.hppc.IntObjectHashMap)3 ConnectedComponents (com.graphhopper.routing.subnetwork.EdgeBasedTarjanSCC.ConnectedComponents)3 GraphBuilder (com.graphhopper.storage.GraphBuilder)3 ShardCollectorProvider (io.crate.execution.engine.collect.ShardCollectorProvider)3 RelationName (io.crate.metadata.RelationName)3 TransactionContext (io.crate.metadata.TransactionContext)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3