Search in sources :

Example 1 with ColumnIndexWriterProjector

use of io.crate.execution.engine.indexing.ColumnIndexWriterProjector in project crate by crate.

the class ProjectionToProjectorVisitor method visitColumnIndexWriterProjection.

@Override
public Projector visitColumnIndexWriterProjection(ColumnIndexWriterProjection projection, Context context) {
    InputFactory.Context<CollectExpression<Row, ?>> ctx = inputFactory.ctxForInputColumns(context.txnCtx);
    List<Input<?>> partitionedByInputs = new ArrayList<>(projection.partitionedBySymbols().size());
    for (Symbol partitionedBySymbol : projection.partitionedBySymbols()) {
        partitionedByInputs.add(ctx.add(partitionedBySymbol));
    }
    List<Input<?>> insertInputs = new ArrayList<>(projection.columnSymbolsExclPartition().size());
    for (Symbol symbol : projection.columnSymbolsExclPartition()) {
        insertInputs.add(ctx.add(symbol));
    }
    ClusterState state = clusterService.state();
    Settings tableSettings = TableSettingsResolver.get(state.getMetadata(), projection.tableIdent(), !projection.partitionedBySymbols().isEmpty());
    int targetTableNumShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(tableSettings);
    int targetTableNumReplicas = NumberOfReplicas.fromSettings(tableSettings, state.getNodes().getSize());
    return new ColumnIndexWriterProjector(clusterService, nodeJobsCounter, circuitBreakerService.getBreaker(HierarchyCircuitBreakerService.QUERY), context.ramAccounting, threadPool.scheduler(), threadPool.executor(ThreadPool.Names.SEARCH), context.txnCtx, nodeCtx, state.metadata().settings(), targetTableNumShards, targetTableNumReplicas, IndexNameResolver.create(projection.tableIdent(), projection.partitionIdent(), partitionedByInputs), transportActionProvider, projection.primaryKeys(), projection.ids(), projection.clusteredBy(), projection.clusteredByIdent(), projection.columnReferencesExclPartition(), insertInputs, ctx.expressions(), projection.isIgnoreDuplicateKeys(), projection.onDuplicateKeyAssignments(), projection.bulkActions(), projection.autoCreateIndices(), projection.returnValues(), context.jobId);
}
Also used : InputFactory(io.crate.expression.InputFactory) ClusterState(org.elasticsearch.cluster.ClusterState) Input(io.crate.data.Input) ColumnIndexWriterProjector(io.crate.execution.engine.indexing.ColumnIndexWriterProjector) Symbol(io.crate.expression.symbol.Symbol) ArrayList(java.util.ArrayList) NestableCollectExpression(io.crate.execution.engine.collect.NestableCollectExpression) CollectExpression(io.crate.execution.engine.collect.CollectExpression) Settings(org.elasticsearch.common.settings.Settings)

Aggregations

Input (io.crate.data.Input)1 CollectExpression (io.crate.execution.engine.collect.CollectExpression)1 NestableCollectExpression (io.crate.execution.engine.collect.NestableCollectExpression)1 ColumnIndexWriterProjector (io.crate.execution.engine.indexing.ColumnIndexWriterProjector)1 InputFactory (io.crate.expression.InputFactory)1 Symbol (io.crate.expression.symbol.Symbol)1 ArrayList (java.util.ArrayList)1 ClusterState (org.elasticsearch.cluster.ClusterState)1 Settings (org.elasticsearch.common.settings.Settings)1