Search in sources :

Example 21 with TypedFieldId

use of org.apache.drill.exec.record.TypedFieldId in project drill by apache.

the class ExpressionTest method testSpecial.

@Test
public void testSpecial(@Injectable final RecordBatch batch, @Injectable ValueVector vector) throws Exception {
    final TypeProtos.MajorType type = Types.optional(MinorType.INT);
    final TypedFieldId tfid = new TypedFieldId(type, false, 0);
    new NonStrictExpectations() {

        @NonStrict
        VectorWrapper<?> wrapper;

        {
            batch.getValueVectorId(new SchemaPath("alpha", ExpressionPosition.UNKNOWN));
            result = tfid;
            batch.getValueAccessorById(IntVector.class, tfid.getFieldIds());
            result = wrapper;
            wrapper.getValueVector();
            result = new IntVector(MaterializedField.create("result", type), RootAllocatorFactory.newRoot(c));
        }
    };
    System.out.println(getExpressionCode("1 + 1", batch));
}
Also used : IntVector(org.apache.drill.exec.vector.IntVector) SchemaPath(org.apache.drill.common.expression.SchemaPath) TypedFieldId(org.apache.drill.exec.record.TypedFieldId) VectorWrapper(org.apache.drill.exec.record.VectorWrapper) TypeProtos(org.apache.drill.common.types.TypeProtos) NonStrictExpectations(mockit.NonStrictExpectations) ExecTest(org.apache.drill.exec.ExecTest) Test(org.junit.Test)

Aggregations

TypedFieldId (org.apache.drill.exec.record.TypedFieldId)21 ErrorCollector (org.apache.drill.common.expression.ErrorCollector)10 ErrorCollectorImpl (org.apache.drill.common.expression.ErrorCollectorImpl)10 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)10 MaterializedField (org.apache.drill.exec.record.MaterializedField)9 ValueVector (org.apache.drill.exec.vector.ValueVector)9 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)8 SchemaPath (org.apache.drill.common.expression.SchemaPath)6 ValueVectorWriteExpression (org.apache.drill.exec.expr.ValueVectorWriteExpression)6 JVar (com.sun.codemodel.JVar)5 TransferPair (org.apache.drill.exec.record.TransferPair)5 IOException (java.io.IOException)4 NamedExpression (org.apache.drill.common.logical.data.NamedExpression)4 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)4 ClassTransformationException (org.apache.drill.exec.exception.ClassTransformationException)4 ValueVectorReadExpression (org.apache.drill.exec.expr.ValueVectorReadExpression)4 JExpression (com.sun.codemodel.JExpression)3 FieldReference (org.apache.drill.common.expression.FieldReference)3 TypeProtos (org.apache.drill.common.types.TypeProtos)3 HoldingContainer (org.apache.drill.exec.expr.ClassGenerator.HoldingContainer)3