Search in sources :

Example 6 with BitVector

use of org.apache.drill.exec.vector.BitVector in project drill by apache.

the class TestAllocators method testClearBitVector.

@Test
public void testClearBitVector() {
    final Properties props = new Properties() {

        {
            put(RootAllocatorFactory.TOP_LEVEL_MAX_ALLOC, "1000000");
        }
    };
    final DrillConfig config = DrillConfig.create(props);
    final BufferAllocator allc = RootAllocatorFactory.newRoot(config);
    final TypeProtos.MajorType.Builder builder = TypeProtos.MajorType.newBuilder();
    builder.setMinorType(TypeProtos.MinorType.BIT);
    builder.setMode(TypeProtos.DataMode.REQUIRED);
    final BitVector bv = new BitVector(MaterializedField.create("Field", builder.build()), allc);
    bv.getMutator().setValueCount(1);
    assertEquals(bv.getAccessor().getValueCount(), 1);
    bv.clear();
    assertEquals(bv.getAccessor().getValueCount(), 0);
}
Also used : BitVector(org.apache.drill.exec.vector.BitVector) DrillConfig(org.apache.drill.common.config.DrillConfig) Properties(java.util.Properties) DrillTest(org.apache.drill.test.DrillTest) Test(org.junit.Test)

Aggregations

BitVector (org.apache.drill.exec.vector.BitVector)6 Test (org.junit.Test)4 ExecTest (org.apache.drill.exec.ExecTest)3 MaterializedField (org.apache.drill.exec.record.MaterializedField)3 Properties (java.util.Properties)1 DrillConfig (org.apache.drill.common.config.DrillConfig)1 SchemaPath (org.apache.drill.common.expression.SchemaPath)1 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)1 FragmentContext (org.apache.drill.exec.ops.FragmentContext)1 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)1 FragmentRoot (org.apache.drill.exec.physical.base.FragmentRoot)1 SimpleRootExec (org.apache.drill.exec.physical.impl.SimpleRootExec)1 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)1 BaseValueVector (org.apache.drill.exec.vector.BaseValueVector)1 IntVector (org.apache.drill.exec.vector.IntVector)1 NullableUInt4Vector (org.apache.drill.exec.vector.NullableUInt4Vector)1 NullableVarCharVector (org.apache.drill.exec.vector.NullableVarCharVector)1 UInt4Vector (org.apache.drill.exec.vector.UInt4Vector)1 ValueVector (org.apache.drill.exec.vector.ValueVector)1 VarCharVector (org.apache.drill.exec.vector.VarCharVector)1