use of io.prestosql.metadata.FunctionInvoker in project hetu-core by openlookeng.
the class RowDistinctFromOperator method specialize.
@Override
public BuiltInScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, FunctionAndTypeManager functionAndTypeManager) {
ImmutableList.Builder<MethodHandle> argumentMethods = ImmutableList.builder();
Type type = boundVariables.getTypeVariable("T");
for (Type parameterType : type.getTypeParameters()) {
FunctionHandle operatorHandle = functionAndTypeManager.resolveOperatorFunctionHandle(IS_DISTINCT_FROM, TypeSignatureProvider.fromTypes(parameterType, parameterType));
FunctionInvoker functionInvoker = functionAndTypeManager.getFunctionInvokerProvider().createFunctionInvoker(operatorHandle, Optional.of(new InvocationConvention(ImmutableList.of(NULL_FLAG, NULL_FLAG), InvocationConvention.InvocationReturnConvention.FAIL_ON_NULL, false)));
argumentMethods.add(functionInvoker.methodHandle());
}
return new BuiltInScalarFunctionImplementation(ImmutableList.of(new ScalarImplementationChoice(false, ImmutableList.of(valueTypeArgumentProperty(USE_NULL_FLAG), valueTypeArgumentProperty(USE_NULL_FLAG)), BuiltInScalarFunctionImplementation.ReturnPlaceConvention.STACK, METHOD_HANDLE_NULL_FLAG.bindTo(type).bindTo(argumentMethods.build()), Optional.empty()), new ScalarImplementationChoice(false, ImmutableList.of(valueTypeArgumentProperty(BLOCK_AND_POSITION), valueTypeArgumentProperty(BLOCK_AND_POSITION)), BuiltInScalarFunctionImplementation.ReturnPlaceConvention.STACK, METHOD_HANDLE_BLOCK_POSITION.bindTo(type).bindTo(argumentMethods.build()), Optional.empty())));
}
Aggregations