mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 21:20:49 +00:00
Fixed converting DateTime64-Field on client into DataTypeDateTime64-field type.
Since DateTime64 is just a typedef, and there is no explicit Field-type for it, we have to solely rely on type_hint provided by origin column. If the hint is missing, there is no way of distinguishing DateTime64 from Decimal64. Alternative could be having explicit converting code, (and it looks like it has to be added at some point).
This commit is contained in:
parent
a3548b08a9
commit
1069812d88
@ -163,8 +163,17 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
|
|||||||
WhichDataType which_type(type);
|
WhichDataType which_type(type);
|
||||||
WhichDataType which_from_type;
|
WhichDataType which_from_type;
|
||||||
if (from_type_hint)
|
if (from_type_hint)
|
||||||
|
{
|
||||||
which_from_type = WhichDataType(*from_type_hint);
|
which_from_type = WhichDataType(*from_type_hint);
|
||||||
|
|
||||||
|
// This was added to mitigate converting DateTime64-Field (a typedef to a Decimal64) to DataTypeDate64-compatitable type.
|
||||||
|
if (which_type.idx == which_from_type.idx)
|
||||||
|
{
|
||||||
|
// TODO (vnemkov): looks dangerous and requires more testing, as it could break some assumptions in subtle ways.
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Conversion between Date and DateTime and vice versa.
|
/// Conversion between Date and DateTime and vice versa.
|
||||||
if (which_type.isDate() && which_from_type.isDateTime())
|
if (which_type.isDate() && which_from_type.isDateTime())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user