use of org.apache.drill.exec.physical.impl.protocol.VectorContainerAccessor.ContainerAndSv2Accessor in project drill by axbaretto.
the class TestOperatorRecordBatch method testSv2.
/**
* Test that an SV2 is properly handled by the proper container accessor.
*/
@Test
public void testSv2() {
BatchSchema schema = new SchemaBuilder().add("a", MinorType.INT).add("b", MinorType.VARCHAR).build();
SingleRowSet rs = fixture.rowSetBuilder(schema).addRow(10, "fred").addRow(20, "wilma").withSv2().build();
ContainerAndSv2Accessor accessor = new ContainerAndSv2Accessor();
accessor.setContainer(rs.container());
accessor.setSelectionVector(rs.getSv2());
MockOperatorExec opExec = new MockOperatorExec(accessor);
opExec.nextCalls = 1;
try (OperatorRecordBatch opBatch = makeOpBatch(opExec)) {
assertEquals(IterOutcome.OK_NEW_SCHEMA, opBatch.next());
assertSame(rs.getSv2(), opBatch.getSelectionVector2());
} catch (Exception e) {
fail();
}
assertTrue(opExec.closeCalled);
// Must release SV2
rs.clear();
}
Aggregations