use of io.crate.data.BatchIterator in project crate by crate.
the class HashInnerJoinBatchIteratorTest method testInnerHashJoinWithHashCollisions.
@Test
public void testInnerHashJoinWithHashCollisions() throws Exception {
Supplier<BatchIterator<Row>> batchIteratorSupplier = () -> new HashInnerJoinBatchIterator(leftIterator.get(), rightIterator.get(), mock(RowAccounting.class), new CombinedRow(1, 1), getCol0EqCol1JoinCondition(), getHashWithCollisions(), getHashWithCollisions(), () -> 5);
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.data.BatchIterator in project crate by crate.
the class HashInnerJoinBatchIteratorTest method testInnerHashJoinWithBlockSizeBiggerThanIteratorBatchSize.
@Test
public void testInnerHashJoinWithBlockSizeBiggerThanIteratorBatchSize() throws Exception {
Supplier<BatchIterator<Row>> batchIteratorSupplier = () -> new HashInnerJoinBatchIterator(leftIterator.get(), rightIterator.get(), mock(RowAccounting.class), new CombinedRow(1, 1), getCol0EqCol1JoinCondition(), getHashForLeft(), getHashForRight(), () -> 3);
BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier);
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.data.BatchIterator in project crate by crate.
the class SortingProjectorTest method testOrderBy.
@Test
public void testOrderBy() throws Exception {
SortingProjector projector = createProjector(2, 0);
BatchIterator batchIterator = projector.apply(TestingBatchIterators.range(1, 11));
consumer.accept(batchIterator, null);
Bucket rows = consumer.getBucket();
assertThat(rows.size(), is(10));
int iterateLength = 1;
for (Row row : rows) {
assertThat(row, isRow(iterateLength++, true));
}
}
use of io.crate.data.BatchIterator in project crate by crate.
the class SortingProjectorTest method testOrderByWithOffset.
@Test
public void testOrderByWithOffset() throws Exception {
SortingProjector projector = createProjector(2, 5);
BatchIterator batchIterator = projector.apply(TestingBatchIterators.range(1, 11));
consumer.accept(batchIterator, null);
Bucket rows = consumer.getBucket();
assertThat(rows.size(), is(5));
int iterateLength = 6;
for (Row row : rows) {
assertThat(row, isRow(iterateLength++, true));
}
}
use of io.crate.data.BatchIterator in project crate by crate.
the class ExplainPlannerTest method testExplainAnalyzeMultiPhasePlanNotSupported.
@Test
public void testExplainAnalyzeMultiPhasePlanNotSupported() {
ExplainPlan plan = e.plan("EXPLAIN ANALYZE SELECT * FROM users WHERE name = (SELECT 'crate') or id = (SELECT 1)");
PlannerContext plannerContext = e.getPlannerContext(clusterService.state());
CountDownLatch counter = new CountDownLatch(1);
AtomicReference<BatchIterator<Row>> itRef = new AtomicReference<>();
AtomicReference<Throwable> failureRef = new AtomicReference<>();
plan.execute(null, plannerContext, new RowConsumer() {
@Override
public void accept(BatchIterator<Row> iterator, @Nullable Throwable failure) {
itRef.set(iterator);
failureRef.set(failure);
counter.countDown();
}
@Override
public CompletableFuture<?> completionFuture() {
return null;
}
}, Row.EMPTY, SubQueryResults.EMPTY);
assertNull(itRef.get());
assertNotNull(failureRef.get());
assertThat(failureRef.get().getMessage(), containsString("EXPLAIN ANALYZE does not support profiling multi-phase plans, such as queries with scalar subselects."));
}
Aggregations