From 77ac67eba8b1d28a5f6dde5c0a77df96ba4861f3 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Tue, 8 Oct 2019 07:50:13 +0300 Subject: [PATCH] Fixed toTimeZone implementation --- dbms/src/Functions/toTimeZone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbms/src/Functions/toTimeZone.cpp b/dbms/src/Functions/toTimeZone.cpp index a23b7cd549f..022fdd650f1 100644 --- a/dbms/src/Functions/toTimeZone.cpp +++ b/dbms/src/Functions/toTimeZone.cpp @@ -39,7 +39,7 @@ public: ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); const auto which_type = WhichDataType(arguments[0].type); - if (!which_type.isDateTime() || !which_type.isDateTime64()) + if (!which_type.isDateTime() && !which_type.isDateTime64()) throw Exception{"Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() + ". Should be DateTime or DateTime64", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT}; @@ -47,7 +47,7 @@ public: if (which_type.isDateTime()) return std::make_shared(time_zone_name); - const auto * date_time64 = assert_cast(arguments[0].type); + const auto * date_time64 = assert_cast(arguments[0].type.get()); return std::make_shared(date_time64->getScale(), time_zone_name); }