This commit is contained in:
feng lv 2021-12-07 15:51:47 +00:00
parent 57f5fdc2fa
commit 8ab2777dd5

View File

@ -687,7 +687,7 @@ private:
return (res = DecimalComparison<LeftDataType, RightDataType, Op, false>::apply(col_left, col_right)) != nullptr;
};
if (!callOnBasicTypes<true, true, true, true>(left_number, right_number, call))
if (!callOnBasicTypes<true, false, true, true>(left_number, right_number, call))
throw Exception("Wrong call for " + getName() + " with " + col_left.type->getName() + " and " + col_right.type->getName(),
ErrorCodes::LOGICAL_ERROR);
@ -1175,8 +1175,11 @@ public:
const bool left_is_num = col_left_untyped->isNumeric();
const bool right_is_num = col_right_untyped->isNumeric();
const bool left_is_string = isStringOrFixedString(which_left);
const bool right_is_string = isStringOrFixedString(which_right);
const bool left_is_float = which_left.isFloat();
const bool right_is_float = which_right.isFloat();
const bool left_is_string = which_left.isStringOrFixedString();
const bool right_is_string = which_right.isStringOrFixedString();
bool date_and_datetime = (which_left.idx != which_right.idx) && (which_left.isDate() || which_left.isDate32() || which_left.isDateTime() || which_left.isDateTime64())
&& (which_right.isDate() || which_right.isDate32() || which_right.isDateTime() || which_right.isDateTime64());
@ -1237,6 +1240,16 @@ public:
throw Exception(
"No operation " + getName() + " between " + left_type->getName() + " and " + right_type->getName(),
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
if (left_is_float)
{
ColumnPtr left_converted = castColumn(col_with_type_and_name_left, right_type);
return executeDecimal({left_converted, right_type, "left"}, col_with_type_and_name_right);
}
if (right_is_float)
{
ColumnPtr right_converted = castColumn(col_with_type_and_name_right, left_type);
return executeDecimal(col_with_type_and_name_left, {right_converted, left_type, "right"});
}
return executeDecimal(col_with_type_and_name_left, col_with_type_and_name_right);
}