mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Code review feedback - used removeNullable()
This commit is contained in:
parent
7f005a6ca4
commit
b82c231886
@ -177,15 +177,10 @@ ASTPtr ConstantNode::toASTImpl(const ConvertToASTOptions & options) const
|
||||
* It could also lead to ambiguous parsing because we don't know if the string literal represents a date or a Decimal64 literal.
|
||||
* For this reason, we use a string literal representing a date instead of a Decimal64 literal.
|
||||
*/
|
||||
if ((WhichDataType(constant_value_type->getTypeId()).isDateTime64()) ||
|
||||
(WhichDataType(constant_value_type->getTypeId()).isNullable() && WhichDataType((typeid_cast<const DataTypeNullable *>(constant_value_type.get()))->getNestedType()->getTypeId()).isDateTime64()))
|
||||
const auto & constant_value_end_type = removeNullable(constant_value_type); /// if Nullable
|
||||
if (WhichDataType(constant_value_end_type->getTypeId()).isDateTime64())
|
||||
{
|
||||
const DataTypeDateTime64 * date_time_type = nullptr;
|
||||
if (WhichDataType(constant_value_type->getTypeId()).isNullable())
|
||||
date_time_type = typeid_cast<const DataTypeDateTime64 *>((typeid_cast<const DataTypeNullable *>(constant_value_type.get()))->getNestedType().get());
|
||||
else
|
||||
date_time_type = typeid_cast<const DataTypeDateTime64 *>(constant_value_type.get());
|
||||
|
||||
const auto * date_time_type = typeid_cast<const DataTypeDateTime64 *>(constant_value_end_type.get());
|
||||
DecimalField<Decimal64> decimal_value;
|
||||
if (constant_value_literal.tryGet<DecimalField<Decimal64>>(decimal_value))
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ create table shard_0.dt64_03222(id UInt64, dt DateTime64(3)) engine = MergeTree
|
||||
create table shard_1.dt64_03222(id UInt64, dt DateTime64(3)) engine = MergeTree order by id;
|
||||
create table distr_03222_dt64 (id UInt64, dt DateTime64(3)) engine = Distributed(test_cluster_two_shards_different_databases, '', dt64_03222);
|
||||
|
||||
insert into shard_0.dt64_03222 values(1, toDateTime64('1970-01-01 00:00:00.000',3))
|
||||
insert into shard_0.dt64_03222 values(1, toDateTime64('1970-01-01 00:00:00.000',3));
|
||||
insert into shard_0.dt64_03222 values(2, toDateTime64('1970-01-01 00:00:02.456',3));
|
||||
insert into shard_1.dt64_03222 values(3, toDateTime64('1970-01-01 00:00:04.811',3));
|
||||
insert into shard_1.dt64_03222 values(4, toDateTime64('1970-01-01 00:10:05',3));
|
||||
|
Loading…
Reference in New Issue
Block a user