presto-main/src/main/java/io/prestosql/sql/gen/NullIfCodeGenerator.java/NullIfCodeGenerator/cast
class NullIfCodeGenerator:    private static BytecodeNode cast(
            BytecodeGeneratorContext generatorContext,
            BytecodeNode argument,
            Type actualType,
            Type requiredType)
    {
        if (actualType.equals(requiredType)) {
            return argument;
        }

        ResolvedFunction function = generatorContext
                .getMetadata()
                .getCoercion(actualType, requiredType);

        // TODO: do we need a full function call? (nullability checks, etc)
        return generatorContext.generateCall(
                function.getSignature().getName(),
                generatorContext.getMetadata().getScalarFunctionImplementation(function),
                ImmutableList.of(argument));
    }