mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 12:32:04 +00:00
Enable comparison betwwen Decimal and Float
add tests update test
This commit is contained in:
parent
2d7ff774fd
commit
f27699ccda
@ -487,7 +487,7 @@ inline bool isNotCreatable(const T & data_type)
|
||||
inline bool isNotDecimalButComparableToDecimal(const DataTypePtr & data_type)
|
||||
{
|
||||
WhichDataType which(data_type);
|
||||
return which.isInt() || which.isUInt();
|
||||
return which.isInt() || which.isUInt() || which.isFloat();
|
||||
}
|
||||
|
||||
inline bool isCompilableType(const DataTypePtr & data_type)
|
||||
|
@ -687,7 +687,7 @@ private:
|
||||
return (res = DecimalComparison<LeftDataType, RightDataType, Op, false>::apply(col_left, col_right)) != nullptr;
|
||||
};
|
||||
|
||||
if (!callOnBasicTypes<true, false, true, true>(left_number, right_number, call))
|
||||
if (!callOnBasicTypes<true, true, 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);
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
1
|
@ -0,0 +1,14 @@
|
||||
select CAST(1.0, 'Decimal(15,2)') > CAST(1, 'Float64');
|
||||
select CAST(1.0, 'Decimal(15,2)') = CAST(1, 'Float64');
|
||||
select CAST(1.0, 'Decimal(15,2)') < CAST(1, 'Float64');
|
||||
select CAST(1.0, 'Decimal(15,2)') > CAST(-1, 'Float64');
|
||||
select CAST(1.0, 'Decimal(15,2)') = CAST(-1, 'Float64');
|
||||
select CAST(1.0, 'Decimal(15,2)') < CAST(-1, 'Float64');
|
||||
select CAST(1.0, 'Decimal(15,2)') > CAST(1, 'Float32');
|
||||
select CAST(1.0, 'Decimal(15,2)') = CAST(1, 'Float32');
|
||||
select CAST(1.0, 'Decimal(15,2)') < CAST(1, 'Float32');
|
||||
select CAST(1.0, 'Decimal(15,2)') > CAST(-1, 'Float32');
|
||||
select CAST(1.0, 'Decimal(15,2)') = CAST(-1, 'Float32');
|
||||
select CAST(1.0, 'Decimal(15,2)') < CAST(-1, 'Float32');
|
||||
|
||||
SELECT toDecimal32('11.00', 2) > 1.;
|
Loading…
Reference in New Issue
Block a user