presto-main/src/main/java/io/prestosql/metadata/FunctionRegistry.java/FunctionRegistry/getFunctionMetadata
class FunctionRegistry:    public FunctionMetadata getFunctionMetadata(ResolvedFunction resolvedFunction)
    {
        FunctionMetadata functionMetadata = getSpecializedFunctionKey(resolvedFunction).getFunction().getFunctionMetadata();

        // specialize function metadata to resolvedFunction
        List<FunctionArgumentDefinition> argumentDefinitions;
        if (functionMetadata.getSignature().isVariableArity()) {
            List<FunctionArgumentDefinition> fixedArguments = functionMetadata.getArgumentDefinitions().subList(0, functionMetadata.getArgumentDefinitions().size() - 1);
            int variableArgumentCount = resolvedFunction.getSignature().getArgumentTypes().size() - fixedArguments.size();
            argumentDefinitions = ImmutableList.<FunctionArgumentDefinition>builder()
                    .addAll(fixedArguments)
                    .addAll(nCopies(variableArgumentCount, functionMetadata.getArgumentDefinitions().get(functionMetadata.getArgumentDefinitions().size() - 1)))
                    .build();
        }
        else {
            argumentDefinitions = functionMetadata.getArgumentDefinitions();
        }
        return new FunctionMetadata(
                functionMetadata.getFunctionId(),
                resolvedFunction.getSignature(),
                functionMetadata.isNullable(),
                argumentDefinitions,
                functionMetadata.isHidden(),
                functionMetadata.isDeterministic(),
                functionMetadata.getDescription(),
                functionMetadata.getKind());
    }