Search in sources :

Example 16 with FunctionMetadata

use of io.prestosql.spi.function.FunctionMetadata in project hetu-core by openlookeng.

the class SpatialJoinUtils method getFlippedFunctionHandle.

public static FunctionHandle getFlippedFunctionHandle(CallExpression callExpression, FunctionAndTypeManager functionAndTypeManager) {
    FunctionMetadata callExpressionMetadata = functionAndTypeManager.getFunctionMetadata(callExpression.getFunctionHandle());
    checkArgument(callExpressionMetadata.getOperatorType().isPresent());
    OperatorType operatorType = flip(callExpressionMetadata.getOperatorType().get());
    List<TypeSignatureProvider> typeProviderList = fromTypes(callExpression.getArguments().stream().map(RowExpression::getType).collect(toImmutableList()));
    checkArgument(typeProviderList.size() == 2, "Expected there to be only two arguments in type provider");
    return functionAndTypeManager.resolveOperatorFunctionHandle(operatorType, ImmutableList.of(typeProviderList.get(1), typeProviderList.get(0)));
}
Also used : TypeSignatureProvider(io.prestosql.sql.analyzer.TypeSignatureProvider) FunctionMetadata(io.prestosql.spi.function.FunctionMetadata) RowExpression(io.prestosql.spi.relation.RowExpression) OperatorType(io.prestosql.spi.function.OperatorType)

Aggregations

FunctionMetadata (io.prestosql.spi.function.FunctionMetadata)16 OperatorType (io.prestosql.spi.function.OperatorType)10 PrestoException (io.prestosql.spi.PrestoException)9 CallExpression (io.prestosql.spi.relation.CallExpression)8 RowExpression (io.prestosql.spi.relation.RowExpression)8 FunctionHandle (io.prestosql.spi.function.FunctionHandle)7 Type (io.prestosql.spi.type.Type)6 ConstantExpression (io.prestosql.spi.relation.ConstantExpression)5 String.format (java.lang.String.format)5 List (java.util.List)5 Map (java.util.Map)5 Optional (java.util.Optional)5 Collectors (java.util.stream.Collectors)5 Joiner (com.google.common.base.Joiner)4 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)4 ConfigSupplier (io.prestosql.configmanager.ConfigSupplier)4 DefaultUdfRewriteConfigSupplier (io.prestosql.configmanager.DefaultUdfRewriteConfigSupplier)4 BaseJdbcRowExpressionConverter (io.prestosql.plugin.jdbc.optimization.BaseJdbcRowExpressionConverter)4 JdbcConverterContext (io.prestosql.plugin.jdbc.optimization.JdbcConverterContext)4 NOT_SUPPORTED (io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED)4