Search in sources :

Example 6 with TypedNullConstant

use of org.apache.drill.common.expression.TypedNullConstant in project drill by apache.

the class TestSimpleFunctions method testHashFunctionResolution.

@Test
public void testHashFunctionResolution() throws JClassAlreadyExistsException, IOException {
    final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
    // test required vs nullable Int input
    resolveHash(new TypedNullConstant(Types.optional(TypeProtos.MinorType.INT)), TypeProtos.DataMode.OPTIONAL, registry);
    resolveHash(new ValueExpressions.IntExpression(1, ExpressionPosition.UNKNOWN), TypeProtos.DataMode.REQUIRED, registry);
    // test required vs nullable float input
    resolveHash(new TypedNullConstant(Types.optional(TypeProtos.MinorType.FLOAT4)), TypeProtos.DataMode.OPTIONAL, registry);
    resolveHash(new ValueExpressions.FloatExpression(5.0f, ExpressionPosition.UNKNOWN), TypeProtos.DataMode.REQUIRED, registry);
    // test required vs nullable long input
    resolveHash(new TypedNullConstant(Types.optional(TypeProtos.MinorType.BIGINT)), TypeProtos.DataMode.OPTIONAL, registry);
    resolveHash(new ValueExpressions.LongExpression(100L, ExpressionPosition.UNKNOWN), TypeProtos.DataMode.REQUIRED, registry);
    // test required vs nullable double input
    resolveHash(new TypedNullConstant(Types.optional(TypeProtos.MinorType.FLOAT8)), TypeProtos.DataMode.OPTIONAL, registry);
    resolveHash(new ValueExpressions.DoubleExpression(100.0, ExpressionPosition.UNKNOWN), TypeProtos.DataMode.REQUIRED, registry);
}
Also used : ValueExpressions(org.apache.drill.common.expression.ValueExpressions) TypedNullConstant(org.apache.drill.common.expression.TypedNullConstant) FunctionImplementationRegistry(org.apache.drill.exec.expr.fn.FunctionImplementationRegistry) ExecTest(org.apache.drill.exec.ExecTest) Test(org.junit.Test)

Aggregations

TypedNullConstant (org.apache.drill.common.expression.TypedNullConstant)6 ExecTest (org.apache.drill.exec.ExecTest)5 Test (org.junit.Test)5 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)4 ErrorCollector (org.apache.drill.common.expression.ErrorCollector)3 ExpressionPosition (org.apache.drill.common.expression.ExpressionPosition)3 FieldReference (org.apache.drill.common.expression.FieldReference)3 FunctionCall (org.apache.drill.common.expression.FunctionCall)3 SchemaPath (org.apache.drill.common.expression.SchemaPath)3 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)3 Range (com.google.common.collect.Range)2 VectorTest (org.apache.drill.categories.VectorTest)2 ValueExpressions (org.apache.drill.common.expression.ValueExpressions)2 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)2 MockUp (mockit.MockUp)1 NonStrictExpectations (mockit.NonStrictExpectations)1 Range (org.apache.drill.shaded.guava.com.google.common.collect.Range)1 Logger (org.slf4j.Logger)1