Reproduction steps:
```
CREATE TABLE table_left                                                                                                                                                                                              
(                                                                                                                                                                                                                    
    `date` Date,                                                                                                                                                                                                     
    `uid` String                                                                                                                                                                                                     
)                                                                                                                                                                                                                    
ENGINE = MergeTree()                                                                                                                                                                                                 
ORDER BY (date, uid)          
                                                                                                                                                                                       
CREATE TABLE table_right                                                                                                                                                                                             
(                                                                                                                                                                                                                    
    `date` Date,                                                                                                                                                                                                     
    `value` Decimal(18, 10)                                                                                                                                                                                          
)                                                                                                                                                                                                                    
ENGINE = MergeTree()                                                                                                                                                                                                 
ORDER BY date

INSERT INTO table_left values(toDate('2019-10-01'), 'hello');
INSERT INTO table_right values (toDate('2019-10-01'), 1), (toDate('2029-10-01'), 2);

SET join_use_nulls = 1;

SELECT ifNull(subquery_right.alias_value, 0)
FROM table_left
FULL OUTER JOIN 
(
    SELECT
        date,
        value AS alias_value
    FROM table_right
) AS subquery_right
ON table_left.date = subquery_right.date

Received exception from server (version 21.3.1):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Incompatible types of arguments corresponding to two conditional branches: while executing 'FUNCTION ifNull(alias_value :: 0, 0 :: 1) -> ifNull(alias_value, 0) Decimal(18, 10) : 2'. 
```
{
        return name;
    }
    size_t getNumberOfArguments() const override { return 3; }
    bool useDefaultImplementationForNulls() const override { return false; }
    ColumnNumbers getArgumentsThatDontImplyNullableReturnType(size_t ) const override { return {0}; }
    
    DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
    {
        if (arguments[0]->onlyNull())
            return arguments[2];
        if (arguments[0]->isNullable())
            return getReturnTypeImpl({
                removeNullable(arguments[0]), arguments[1], arguments[2]});
        if (!WhichDataType(arguments[0]).isUInt8())
            throw Exception("Illegal type " + arguments[0]->getName() + " of first argument (condition) of function if. Must be UInt8.",
                ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
        return getLeastSupertype({arguments[1], arguments[2]});
    }
    ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override
    {
        ColumnPtr res;
        if (   (res = executeForConstAndNullableCondition(arguments, result_type, input_rows_count))
            || (res = executeForNullThenElse(arguments, result_type, input_rows_count))
            || (res = executeForNullableThenElse(arguments, result_type, input_rows_count)))
            return res;
        const ColumnWithTypeAndName & arg_cond = arguments[0];