```
SET compile_expressions = 1
SELECT GREATEST(2,0)
```

throw Exception("Cannot add aggregate states of different functions: "
                    + arguments[0]->getName() + " and " + arguments[1]->getName(), ErrorCodes::CANNOT_ADD_DIFFERENT_AGGREGATE_STATES);
            return arguments[0];
        }
        
        if (auto function_builder = getFunctionForIntervalArithmetic(arguments[0], arguments[1]))
        {
            ColumnsWithTypeAndName new_arguments(2);
            for (size_t i = 0; i < 2; ++i)
                new_arguments[i].type = arguments[i];
            
            if (WhichDataType(new_arguments[1].type).isDateOrDateTime())
                std::swap(new_arguments[0], new_arguments[1]);
            
            new_arguments[1].type = std::make_shared<DataTypeNumber<DataTypeInterval::FieldType>>();
            auto function = function_builder->build(new_arguments);
            return function->getReturnType();
        }
        DataTypePtr type_res;
        bool valid = castBothTypes(arguments[0].get(), arguments[1].get(), [&](const auto & left, const auto & right)
        {
            using LeftDataType = std::decay_t<decltype(left)>;
            using RightDataType = std::decay_t<decltype(right)>;
            if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> || std::is_same_v<DataTypeFixedString, RightDataType>)
            {
                if constexpr (!Op<DataTypeFixedString, DataTypeFixedString>::allow_fixed_string)
                    return false;
                else if constexpr (std::is_same_v<LeftDataType, RightDataType>)
                {
                   if (left.getN() == right.getN())