This commit is contained in:
Pavel Kruglov 2021-06-07 15:13:26 +03:00
parent 01bd5cc998
commit 6da03935af

View File

@ -598,8 +598,8 @@ class FunctionBinaryArithmetic : public IFunction
static FunctionOverloadResolverPtr
getFunctionForIntervalArithmetic(const DataTypePtr & type0, const DataTypePtr & type1, ContextPtr context)
{
bool first_is_date_or_datetime = isDateOrDateTime(type0);
bool second_is_date_or_datetime = isDateOrDateTime(type1);
bool first_is_date_or_datetime = isDate(type0) || isDateTime(type0) || isDateTime64(type0);
bool second_is_date_or_datetime = isDate(type1) || isDateTime(type1) || isDateTime64(type1);
/// Exactly one argument must be Date or DateTime
if (first_is_date_or_datetime == second_is_date_or_datetime)
@ -774,7 +774,7 @@ class FunctionBinaryArithmetic : public IFunction
ColumnsWithTypeAndName new_arguments = arguments;
/// Interval argument must be second.
if (WhichDataType(arguments[1].type).isDateOrDateTime())
if (isDate(arguments[1].type) || isDateTime(arguments[1].type) || isDateTime64(arguments[1].type))
std::swap(new_arguments[0], new_arguments[1]);
/// Change interval argument type to its representation
@ -994,7 +994,7 @@ public:
new_arguments[i].type = arguments[i];
/// Interval argument must be second.
if (WhichDataType(new_arguments[1].type).isDateOrDateTime())
if (isDate(new_arguments[1].type) || isDateTime(new_arguments[1].type) || isDateTime64(new_arguments[1].type))
std::swap(new_arguments[0], new_arguments[1]);
/// Change interval argument to its representation