use of org.apache.drill.exec.physical.impl.protocol.BatchAccessor in project drill by apache.
the class TestScanOperExecLimit method testLimitOnBatchEnd.
/**
* LIMIT 50, same as batch size, to check boundary conditions.
*/
@Test
public void testLimitOnBatchEnd() {
Mock50RowReader reader1 = new Mock50RowReader();
Mock50RowReader reader2 = new Mock50RowReader();
BaseScanFixtureBuilder builder = simpleBuilder(reader1, reader2);
builder.builder.limit(50);
ScanFixture scanFixture = builder.build();
ScanOperatorExec scan = scanFixture.scanOp;
assertTrue(scan.buildSchema());
assertTrue(scan.next());
BatchAccessor batch = scan.batchAccessor();
assertEquals(50, batch.rowCount());
batch.release();
// No second batch or second reader
assertFalse(scan.next());
scanFixture.close();
assertTrue(reader1.openCalled);
assertFalse(reader2.openCalled);
}
use of org.apache.drill.exec.physical.impl.protocol.BatchAccessor in project drill by apache.
the class TestScanOperExecLimit method testLimitOnSecondReader.
/**
* LIMIT 125: full first reader, limit on second
*/
@Test
public void testLimitOnSecondReader() {
Mock50RowReader reader1 = new Mock50RowReader();
Mock50RowReader reader2 = new Mock50RowReader();
BaseScanFixtureBuilder builder = simpleBuilder(reader1, reader2);
builder.builder.limit(125);
ScanFixture scanFixture = builder.build();
ScanOperatorExec scan = scanFixture.scanOp;
assertTrue(scan.buildSchema());
assertTrue(scan.next());
BatchAccessor batch = scan.batchAccessor();
assertEquals(50, batch.rowCount());
batch.release();
assertTrue(scan.next());
batch = scan.batchAccessor();
assertEquals(50, batch.rowCount());
batch.release();
// First batch, second reader
assertTrue(scan.next());
batch = scan.batchAccessor();
assertEquals(25, batch.rowCount());
batch.release();
// No second batch
assertFalse(scan.next());
scanFixture.close();
assertTrue(reader1.openCalled);
assertTrue(reader2.openCalled);
}
use of org.apache.drill.exec.physical.impl.protocol.BatchAccessor in project drill by apache.
the class TestScanOperExecLimit method testLimit1.
/**
* LIMIT 1, simplest case
*/
@Test
public void testLimit1() {
Mock50RowReader reader1 = new Mock50RowReader();
Mock50RowReader reader2 = new Mock50RowReader();
BaseScanFixtureBuilder builder = simpleBuilder(reader1, reader2);
builder.builder.limit(1);
ScanFixture scanFixture = builder.build();
ScanOperatorExec scan = scanFixture.scanOp;
assertTrue(scan.buildSchema());
assertTrue(scan.next());
BatchAccessor batch = scan.batchAccessor();
assertEquals(1, batch.rowCount());
batch.release();
// No second batch or second reader
assertFalse(scan.next());
scanFixture.close();
assertTrue(reader1.openCalled);
assertFalse(reader2.openCalled);
}
Aggregations