@@ -0,0 +1,3108 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.facebook.presto.sql.gen;%0A%0Aimport com.facebook.presto.byteCode.ByteCodeNode;%0Aimport com.facebook.presto.byteCode.MethodGenerationContext;%0Aimport com.facebook.presto.byteCode.Scope;%0Aimport com.facebook.presto.byteCode.expression.ByteCodeExpression;%0Aimport com.facebook.presto.metadata.FunctionInfo;%0Aimport com.google.common.base.Joiner;%0Aimport com.google.common.collect.ImmutableList;%0A%0Aimport java.util.List;%0A%0Aimport static com.facebook.presto.byteCode.ParameterizedType.type;%0Aimport static com.facebook.presto.sql.gen.ByteCodeUtils.generateInvocation;%0Aimport static com.facebook.presto.util.ImmutableCollectors.toImmutableList;%0Aimport static java.util.Objects.requireNonNull;%0A%0Apublic class InvokeFunctionByteCodeExpression%0A        extends ByteCodeExpression%0A%7B%0A    public static ByteCodeExpression invokeFunction(Scope scope, CallSiteBinder callSiteBinder, FunctionInfo functionInfo, ByteCodeExpression... parameters)%0A    %7B%0A        return invokeFunction(scope, callSiteBinder, functionInfo, ImmutableList.copyOf(parameters));%0A    %7D%0A%0A    public static ByteCodeExpression invokeFunction(Scope scope, CallSiteBinder callSiteBinder, FunctionInfo functionInfo, List%3CByteCodeExpression%3E parameters)%0A    %7B%0A        requireNonNull(scope, %22scope is null%22);%0A        requireNonNull(callSiteBinder, %22callSiteBinder is null%22);%0A        requireNonNull(functionInfo, %22functionInfo is null%22);%0A%0A        Binding binding = callSiteBinder.bind(functionInfo.getMethodHandle());%0A        return new InvokeFunctionByteCodeExpression(scope, binding, functionInfo, parameters);%0A    %7D%0A%0A    private final ByteCodeNode invocation;%0A    private final String oneLineDescription;%0A%0A    private InvokeFunctionByteCodeExpression(%0A            Scope scope,%0A            Binding binding,%0A            FunctionInfo functionInfo,%0A            List%3CByteCodeExpression%3E parameters)%0A    %7B%0A        super(type(functionInfo.getMethodHandle().type().returnType()));%0A%0A        this.invocation = generateInvocation(scope, functionInfo, parameters.stream().map(ByteCodeNode.class::cast).collect(toImmutableList()), binding);%0A        this.oneLineDescription = functionInfo.getSignature().getName() + %22(%22 + Joiner.on(%22, %22).join(parameters) + %22)%22;%0A    %7D%0A%0A    @Override%0A    public ByteCodeNode getByteCode(MethodGenerationContext generationContext)%0A    %7B%0A        return invocation;%0A    %7D%0A%0A    @Override%0A    public List%3CByteCodeNode%3E getChildNodes()%0A    %7B%0A        return ImmutableList.of();%0A    %7D%0A%0A    @Override%0A    protected String formatOneLine()%0A    %7B%0A        return oneLineDescription;%0A    %7D%0A%7D%0A

Add InvokeFunctionByteCodeExpression