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);
}
Aggregations