Search in sources :

Example 16 with ParametricScalar

use of com.facebook.presto.operator.scalar.ParametricScalar in project presto by prestodb.

the class TestAnnotationEngineForScalars method testFixedTypeParameterParse.

@Test
public void testFixedTypeParameterParse() {
    Signature expectedSignature = new Signature(QualifiedObjectName.valueOf(DEFAULT_NAMESPACE, "fixed_type_parameter_scalar_function"), FunctionKind.SCALAR, ImmutableList.of(), ImmutableList.of(), BIGINT.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature()), false);
    List<SqlScalarFunction> functions = ScalarFromAnnotationsParser.parseFunctionDefinition(FixedTypeParameterScalarFunction.class);
    assertEquals(functions.size(), 1);
    ParametricScalar scalar = (ParametricScalar) functions.get(0);
    assertImplementationCount(scalar, 1, 0, 0);
    assertEquals(scalar.getSignature(), expectedSignature);
    assertTrue(scalar.isDeterministic());
    assertEquals(scalar.getVisibility(), PUBLIC);
    assertEquals(scalar.getDescription(), "Parametric scalar that uses TypeParameter with fixed type");
}
Also used : TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) Signature(com.facebook.presto.spi.function.Signature) ParametricScalar(com.facebook.presto.operator.scalar.ParametricScalar) SqlScalarFunction(com.facebook.presto.metadata.SqlScalarFunction) Test(org.testng.annotations.Test)

Aggregations

ParametricScalar (com.facebook.presto.operator.scalar.ParametricScalar)16 SqlScalarFunction (com.facebook.presto.metadata.SqlScalarFunction)14 Test (org.testng.annotations.Test)14 Signature (com.facebook.presto.spi.function.Signature)12 TypeSignature.parseTypeSignature (com.facebook.presto.common.type.TypeSignature.parseTypeSignature)11 ImplementationDependency (com.facebook.presto.operator.annotations.ImplementationDependency)4 LiteralImplementationDependency (com.facebook.presto.operator.annotations.LiteralImplementationDependency)4 TypeImplementationDependency (com.facebook.presto.operator.annotations.TypeImplementationDependency)4 BuiltInScalarFunctionImplementation (com.facebook.presto.operator.scalar.BuiltInScalarFunctionImplementation)4 ParametricScalarImplementationChoice (com.facebook.presto.operator.scalar.annotations.ParametricScalarImplementation.ParametricScalarImplementationChoice)4 ImmutableList (com.google.common.collect.ImmutableList)2 QualifiedObjectName (com.facebook.presto.common.QualifiedObjectName)1 Block (com.facebook.presto.common.block.Block)1 BIGINT (com.facebook.presto.common.type.BigintType.BIGINT)1 BOOLEAN (com.facebook.presto.common.type.BooleanType.BOOLEAN)1 DOUBLE (com.facebook.presto.common.type.DoubleType.DOUBLE)1 StandardTypes (com.facebook.presto.common.type.StandardTypes)1 Type (com.facebook.presto.common.type.Type)1 BoundVariables (com.facebook.presto.metadata.BoundVariables)1 DEFAULT_NAMESPACE (com.facebook.presto.metadata.BuiltInTypeAndFunctionNamespaceManager.DEFAULT_NAMESPACE)1