Search in sources :

Example 21 with RowConsumer

use of io.crate.data.RowConsumer in project crate by crate.

the class DistributingConsumerFactoryTest method testCreateDownstreamMultipleNode.

@Test
public void testCreateDownstreamMultipleNode() throws Exception {
    RowConsumer downstream = createDownstream(Set.of("downstream_node1", "downstream_node2"));
    assertThat(((DistributingConsumer) downstream).multiBucketBuilder, instanceOf(ModuloBucketBuilder.class));
}
Also used : RowConsumer(io.crate.data.RowConsumer) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 22 with RowConsumer

use of io.crate.data.RowConsumer in project crate by crate.

the class DistributingConsumerFactoryTest method testCreateDownstreamOneNode.

@Test
public void testCreateDownstreamOneNode() throws Exception {
    RowConsumer downstream = createDownstream(Set.of("downstream_node"));
    assertThat(downstream, instanceOf(DistributingConsumer.class));
    assertThat(((DistributingConsumer) downstream).multiBucketBuilder, instanceOf(BroadcastingBucketBuilder.class));
}
Also used : RowConsumer(io.crate.data.RowConsumer) Test(org.junit.Test) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest)

Example 23 with RowConsumer

use of io.crate.data.RowConsumer in project crate by crate.

the class ProjectingRowConsumerTest method testConsumerRequiresScrollAndProjectorsSupportScrolling.

@Test
public void testConsumerRequiresScrollAndProjectorsSupportScrolling() {
    GroupProjection groupProjection = new GroupProjection(new ArrayList<>(), new ArrayList<>(), AggregateMode.ITER_FINAL, RowGranularity.SHARD);
    RowConsumer delegateConsumerRequiresScroll = new DummyRowConsumer(true);
    RowConsumer projectingConsumer = ProjectingRowConsumer.create(delegateConsumerRequiresScroll, Collections.singletonList(groupProjection), UUID.randomUUID(), txnCtx, RamAccounting.NO_ACCOUNTING, memoryManager, projectorFactory);
    assertThat(projectingConsumer.requiresScroll(), is(false));
}
Also used : RowConsumer(io.crate.data.RowConsumer) TestingRowConsumer(io.crate.testing.TestingRowConsumer) GroupProjection(io.crate.execution.dsl.projection.GroupProjection) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Example 24 with RowConsumer

use of io.crate.data.RowConsumer in project crate by crate.

the class JobLauncher method execute.

public void execute(RowConsumer consumer, TransactionContext txnCtx) {
    assert nodeOperationTrees.size() == 1 : "must only have 1 NodeOperationTree for non-bulk operations";
    NodeOperationTree nodeOperationTree = nodeOperationTrees.get(0);
    Map<String, Collection<NodeOperation>> operationByServer = NodeOperationGrouper.groupByServer(nodeOperationTree.nodeOperations());
    List<ExecutionPhase> handlerPhases = Collections.singletonList(nodeOperationTree.leaf());
    List<RowConsumer> handlerConsumers = Collections.singletonList(consumer);
    try {
        setupTasks(txnCtx, operationByServer, handlerPhases, handlerConsumers);
    } catch (Throwable throwable) {
        consumer.accept(null, throwable);
    }
}
Also used : NodeOperationTree(io.crate.execution.dsl.phases.NodeOperationTree) Collection(java.util.Collection) ExecutionPhase(io.crate.execution.dsl.phases.ExecutionPhase) CollectingRowConsumer(io.crate.data.CollectingRowConsumer) RowConsumer(io.crate.data.RowConsumer)

Example 25 with RowConsumer

use of io.crate.data.RowConsumer in project crate by crate.

the class CreateAnalyzerPlan method executeOrFail.

@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
    ClusterUpdateSettingsRequest request = createRequest(createAnalyzer, plannerContext.transactionContext(), dependencies.nodeContext(), params, subQueryResults, dependencies.fulltextAnalyzerResolver());
    dependencies.transportActionProvider().transportClusterUpdateSettingsAction().execute(request, new OneRowActionListener<>(consumer, r -> new Row1(1L)));
}
Also used : TOKEN_FILTER(io.crate.metadata.FulltextAnalyzerResolver.CustomType.TOKEN_FILTER) Tuple(io.crate.common.collections.Tuple) HashMap(java.util.HashMap) GenericProperties(io.crate.sql.tree.GenericProperties) Function(java.util.function.Function) GenericProperty(io.crate.sql.tree.GenericProperty) DependencyCarrier(io.crate.planner.DependencyCarrier) SymbolEvaluator(io.crate.analyze.SymbolEvaluator) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest) Settings(org.elasticsearch.common.settings.Settings) Locale(java.util.Locale) Map(java.util.Map) GenericPropertiesConverter(io.crate.analyze.GenericPropertiesConverter) CHAR_FILTER(io.crate.metadata.FulltextAnalyzerResolver.CustomType.CHAR_FILTER) OneRowActionListener(io.crate.execution.support.OneRowActionListener) FulltextAnalyzerResolver(io.crate.metadata.FulltextAnalyzerResolver) Nullable(javax.annotation.Nullable) NodeContext(io.crate.metadata.NodeContext) AnalyzedCreateAnalyzer(io.crate.analyze.AnalyzedCreateAnalyzer) FulltextAnalyzerResolver.encodeSettings(io.crate.metadata.FulltextAnalyzerResolver.encodeSettings) TOKENIZER(io.crate.metadata.FulltextAnalyzerResolver.CustomType.TOKENIZER) RowConsumer(io.crate.data.RowConsumer) List(java.util.List) Row(io.crate.data.Row) Literal(io.crate.expression.symbol.Literal) Symbol(io.crate.expression.symbol.Symbol) ANALYZER(io.crate.metadata.FulltextAnalyzerResolver.CustomType.ANALYZER) PlannerContext(io.crate.planner.PlannerContext) Plan(io.crate.planner.Plan) SubQueryResults(io.crate.planner.operators.SubQueryResults) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) Row1(io.crate.data.Row1) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) Row1(io.crate.data.Row1) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Aggregations

RowConsumer (io.crate.data.RowConsumer)37 Row (io.crate.data.Row)26 Row1 (io.crate.data.Row1)24 SubQueryResults (io.crate.planner.operators.SubQueryResults)24 OneRowActionListener (io.crate.execution.support.OneRowActionListener)22 DependencyCarrier (io.crate.planner.DependencyCarrier)22 PlannerContext (io.crate.planner.PlannerContext)22 Plan (io.crate.planner.Plan)21 Symbol (io.crate.expression.symbol.Symbol)18 SymbolEvaluator (io.crate.analyze.SymbolEvaluator)17 Function (java.util.function.Function)17 VisibleForTesting (io.crate.common.annotations.VisibleForTesting)12 NodeContext (io.crate.metadata.NodeContext)11 List (java.util.List)10 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)9 ArrayList (java.util.ArrayList)9 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)8 Test (org.junit.Test)8 DocTableInfo (io.crate.metadata.doc.DocTableInfo)7 Settings (org.elasticsearch.common.settings.Settings)7