linkedin / transport

A framework for writing performant user-defined functions (UDFs) that are portable across a variety of engines including Apache Spark, Apache Hive, and Presto.
BSD 2-Clause "Simplified" License
291 stars 72 forks source link

Remove some internal Trino API dependencies #145

Closed weijiii closed 9 months ago

weijiii commented 1 year ago

Summary

Then look at its getScalarFunctionImplementation (code). Since there is only one choice and the given constraints on instanceFactory and lambdaInterfaces, this method is equivalent to

MethodHandle methodHandle = functionAdapter.adapt(
                bestChoice.getMethodHandle(),
                boundSignature.getArgumentTypes(),
                bestChoice.getInvocationConvention(),
                invocationConvention);
ScalarFunctionImplementation.Builder builder = ScalarFunctionImplementation.builder()
                .methodHandle(methodHandle);
builder.lambdaInterfaces(ImmutableList.of());
return builder.build();

Then look at how the only ScalarImplementationChoice is constructed ref, where

invocationConvention = new InvocationConvention(
                    argumentConventions,
                    returnConvention,
                    hasSession,
                    instanceFactory.isPresent());

can be simplified to the following since Transport does not support session functions.

invocationConvention = new InvocationConvention(argumentConventions, returnConvention, false, false);