use of io.crate.testing.TestingRowConsumer in project crate by crate.
the class S3FileReadingCollectorTest method getObjects.
private TestingRowConsumer getObjects(Collection<String> fileUris, String compression, S3ObjectInputStream s3InputStream, boolean collectSourceUriFailure) throws Throwable {
TestingRowConsumer consumer = new TestingRowConsumer();
getObjects(fileUris, compression, s3InputStream, consumer, collectSourceUriFailure);
return consumer;
}
use of io.crate.testing.TestingRowConsumer in project crate by crate.
the class KillPlanTest method testKillTaskCallsBroadcastOnTransportKillAllNodeAction.
@Test
public void testKillTaskCallsBroadcastOnTransportKillAllNodeAction() {
AtomicInteger broadcastCalls = new AtomicInteger(0);
AtomicInteger nodeOperationCalls = new AtomicInteger(0);
TransportKillAllNodeAction killAllNodeAction = new TransportKillAllNodeAction(new TasksService(clusterService, new JobsLogs(() -> false)), clusterService, mock(TransportService.class)) {
@Override
public void broadcast(KillAllRequest request, ActionListener<Long> listener) {
broadcastCalls.incrementAndGet();
}
@Override
public CompletableFuture<KillResponse> nodeOperation(KillAllRequest request) {
nodeOperationCalls.incrementAndGet();
return super.nodeOperation(request);
}
};
KillPlan killPlan = new KillPlan(null);
killPlan.execute(null, "dummy-user", killAllNodeAction, mock(TransportKillJobsNodeAction.class), new TestingRowConsumer());
assertThat(broadcastCalls.get(), is(1));
assertThat(nodeOperationCalls.get(), is(0));
}
use of io.crate.testing.TestingRowConsumer in project crate by crate.
the class SQLIntegrationTestCase method execute.
public TestingRowConsumer execute(PlanForNode planForNode) {
DependencyCarrier dependencyCarrier = internalCluster().getInstance(DependencyCarrier.class, planForNode.nodeName);
TestingRowConsumer downstream = new TestingRowConsumer();
planForNode.plan.execute(dependencyCarrier, planForNode.plannerContext, downstream, Row.EMPTY, SubQueryResults.EMPTY);
return downstream;
}
use of io.crate.testing.TestingRowConsumer in project crate by crate.
the class DocValuesGroupByOptimizedIteratorTest method test_group_by_doc_values_optimized_iterator_for_single_numeric_key.
@Test
public void test_group_by_doc_values_optimized_iterator_for_single_numeric_key() throws Exception {
SumAggregation<?> sumAggregation = (SumAggregation<?>) functions.getQualified(Signature.aggregate(SumAggregation.NAME, DataTypes.LONG.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.LONG), DataTypes.LONG);
var sumDocValuesAggregator = sumAggregation.getDocValueAggregator(List.of(new Reference(new ReferenceIdent(RelationName.fromIndexName("test"), "z"), RowGranularity.DOC, DataTypes.LONG, ColumnPolicy.DYNAMIC, IndexType.PLAIN, true, true, 0, null)), mock(DocTableInfo.class), List.of());
var keyExpressions = List.of(new LongColumnReference("y"));
var it = DocValuesGroupByOptimizedIterator.GroupByIterator.forSingleKey(List.of(sumDocValuesAggregator), indexSearcher, new Reference(new ReferenceIdent(RelationName.fromIndexName("test"), "y"), RowGranularity.DOC, DataTypes.LONG, ColumnPolicy.DYNAMIC, IndexType.PLAIN, true, true, 0, null), keyExpressions, RamAccounting.NO_ACCOUNTING, null, null, new MatchAllDocsQuery(), new CollectorContext());
var rowConsumer = new TestingRowConsumer();
rowConsumer.accept(it, null);
assertThat(rowConsumer.getResult(), containsInAnyOrder(new Object[] { 0L, 6L }, new Object[] { 1L, 4L }));
}
use of io.crate.testing.TestingRowConsumer in project crate by crate.
the class DistributingConsumerTest method testDistributingConsumerForwardsFailure.
@Test
public void testDistributingConsumerForwardsFailure() throws Exception {
Streamer<?>[] streamers = { DataTypes.INTEGER.streamer() };
TestingRowConsumer collectingConsumer = new TestingRowConsumer();
DistResultRXTask distResultRXTask = createPageDownstreamContext(streamers, collectingConsumer);
TransportDistributedResultAction distributedResultAction = createFakeTransport(streamers, distResultRXTask);
DistributingConsumer distributingConsumer = createDistributingConsumer(streamers, distributedResultAction);
distributingConsumer.accept(null, new CompletionException(new IllegalArgumentException("foobar")));
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("foobar");
collectingConsumer.getResult();
}
Aggregations