presto-main/src/main/java/io/prestosql/metadata/FunctionRegistry.java/FunctionRegistry/returnsNullOnGivenInputTypes
class FunctionRegistry:    private boolean returnsNullOnGivenInputTypes(ApplicableFunction applicableFunction, List<Type> parameterTypes)
    {
        ResolvedFunction resolvedFunction = applicableFunction.getResolvedFunction();
        FunctionMetadata functionMetadata = getSpecializedFunctionKey(resolvedFunction).getFunction().getFunctionMetadata();
        // Window and Aggregation functions have fixed semantic where NULL values are always skipped
        if (functionMetadata.getKind() != SCALAR) {
            return true;
        }

        List<FunctionArgumentDefinition> argumentDefinitions = functionMetadata.getArgumentDefinitions();
        for (int i = 0; i < parameterTypes.size(); i++) {
            // if the argument value will always be null and the function argument is not nullable, the function will always return null
            if (parameterTypes.get(i).equals(UNKNOWN) && !argumentDefinitions.get(i).isNullable()) {
                return true;
            }
        }
        return false;
    }