mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
IN operator support compare Date and Date32
This commit is contained in:
parent
0fbc9585f1
commit
203df96d5c
@ -237,6 +237,20 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
|
||||
return src;
|
||||
}
|
||||
|
||||
/// For toDate('xxx') in 1::Int64, we CAST `src` to UInt64, which may
|
||||
/// produce wrong result in some special cases.
|
||||
if (which_type.isDate() && src.getType() == Field::Types::Int64)
|
||||
{
|
||||
return convertNumericType<UInt64>(src, type);
|
||||
}
|
||||
|
||||
/// For toDate32('xxx') in 1, we CAST `src` to Int64. Also, it may
|
||||
/// produce wrong result in some special cases.
|
||||
if (which_type.isDate32() && src.getType() == Field::Types::UInt64)
|
||||
{
|
||||
return convertNumericType<Int64>(src, type);
|
||||
}
|
||||
|
||||
if (which_type.isDateTime64()
|
||||
&& (src.getType() == Field::Types::UInt64 || src.getType() == Field::Types::Int64 || src.getType() == Field::Types::Decimal64))
|
||||
{
|
||||
|
4
tests/queries/0_stateless/02714_date_date32_in.reference
Normal file
4
tests/queries/0_stateless/02714_date_date32_in.reference
Normal file
@ -0,0 +1,4 @@
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
4
tests/queries/0_stateless/02714_date_date32_in.sql
Normal file
4
tests/queries/0_stateless/02714_date_date32_in.sql
Normal file
@ -0,0 +1,4 @@
|
||||
select toDate32('2020-01-01') in (toDate('2020-01-01'));
|
||||
select toDate('2020-01-01') in (toDate32('2020-01-01'));
|
||||
select toDate('2020-01-01') in 1::Int64;
|
||||
select toDate32('2020-01-01') in 1::UInt64;
|
Loading…
Reference in New Issue
Block a user