From 82a7939a013ba27993385ff8a926d9ac70c766ad Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Tue, 10 Mar 2020 15:06:51 +0800 Subject: [PATCH] Fixed getting Timezone from DateTime64 --- .../Functions/extractTimeZoneFromFunctionArguments.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dbms/src/Functions/extractTimeZoneFromFunctionArguments.cpp b/dbms/src/Functions/extractTimeZoneFromFunctionArguments.cpp index b49ceeedab3..9402359dfd3 100644 --- a/dbms/src/Functions/extractTimeZoneFromFunctionArguments.cpp +++ b/dbms/src/Functions/extractTimeZoneFromFunctionArguments.cpp @@ -42,9 +42,9 @@ std::string extractTimeZoneNameFromFunctionArguments(const ColumnsWithTypeAndNam return {}; /// If time zone is attached to an argument of type DateTime. - if (const DataTypeDateTime * type = checkAndGetDataType(arguments[datetime_arg_num].type.get())) + if (const auto * type = checkAndGetDataType(arguments[datetime_arg_num].type.get())) return type->getTimeZone().getTimeZone(); - if (const DataTypeDateTime64 * type = checkAndGetDataType(arguments[datetime_arg_num].type.get())) + if (const auto * type = checkAndGetDataType(arguments[datetime_arg_num].type.get())) return type->getTimeZone().getTimeZone(); return {}; @@ -61,7 +61,9 @@ const DateLUTImpl & extractTimeZoneFromFunctionArguments(Block & block, const Co return DateLUT::instance(); /// If time zone is attached to an argument of type DateTime. - if (const DataTypeDateTime * type = checkAndGetDataType(block.getByPosition(arguments[datetime_arg_num]).type.get())) + if (const auto * type = checkAndGetDataType(block.getByPosition(arguments[datetime_arg_num]).type.get())) + return type->getTimeZone(); + if (const auto * type = checkAndGetDataType(block.getByPosition(arguments[datetime_arg_num]).type.get())) return type->getTimeZone(); return DateLUT::instance();