From 45e9e9f8bb02343ab7970dd795ab0e21f49e6d91 Mon Sep 17 00:00:00 2001 From: "neng.liu" <1398775315@qq.com> Date: Thu, 17 Jun 2021 08:08:29 -0700 Subject: [PATCH] fix some compile problem --- .../AggregateFunctionSequenceMatch.cpp | 4 ++-- .../AggregateFunctionWindowFunnel.cpp | 4 ++-- src/DataStreams/PostgreSQLBlockInputStream.cpp | 3 +++ src/Functions/DateTimeTransforms.h | 2 +- .../FunctionDateOrDateTimeAddInterval.h | 17 ++++++++++++++--- .../FunctionDateOrDateTimeToSomething.h | 1 + 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp b/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp index 95ee775fe29..75c3fcbc984 100644 --- a/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp +++ b/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp @@ -63,8 +63,8 @@ AggregateFunctionPtr createAggregateFunctionSequenceBase(const std::string & nam return std::make_shared>>(argument_types, params, pattern); else if (which.isDate()) return std::make_shared>>(argument_types, params, pattern); - else if (which.isDate32()) - return std::make_shared>>(argument_types, params, pattern); +// else if (which.isDate32()) +// return std::make_shared>>(argument_types, params, pattern); throw Exception{"Illegal type " + time_arg->getName() + " of first argument of aggregate function " + name + ", must be DateTime", diff --git a/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp b/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp index 1f55a57651b..9f882075ca0 100644 --- a/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp +++ b/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp @@ -46,8 +46,8 @@ AggregateFunctionPtr createAggregateFunctionWindowFunnel(const std::string & nam return res; else if (which.isDate()) return std::make_shared>>(arguments, params); - else if (which.isDate32()) - return std::make_shared>>(arguments, params); +// else if (which.isDate32()) +// return std::make_shared>>(arguments, params); else if (which.isDateTime()) return std::make_shared>>(arguments, params); diff --git a/src/DataStreams/PostgreSQLBlockInputStream.cpp b/src/DataStreams/PostgreSQLBlockInputStream.cpp index 9ef0a45acc0..e817d7c60f4 100644 --- a/src/DataStreams/PostgreSQLBlockInputStream.cpp +++ b/src/DataStreams/PostgreSQLBlockInputStream.cpp @@ -166,6 +166,9 @@ void PostgreSQLBlockInputStream::insertValue(IColumn & column, std::string_view case ValueType::vtDate: assert_cast(column).insertValue(UInt16{LocalDate{std::string(value)}.getDayNum()}); break; + case ValueType::vtDate32: + assert_cast(column).insertValue(Int32{LocalDate{std::string(value)}.getExtenedDayNum()}); + break; case ValueType::vtDateTime: { ReadBufferFromString in(value); diff --git a/src/Functions/DateTimeTransforms.h b/src/Functions/DateTimeTransforms.h index b5cb3ae4718..c922b047fb2 100644 --- a/src/Functions/DateTimeTransforms.h +++ b/src/Functions/DateTimeTransforms.h @@ -61,7 +61,7 @@ struct ToDateImpl { return UInt16(time_zone.toDayNum(t)); } - static inline UInt16 execute(Int32 t, const DateLUTImpl & time_zone) + static inline UInt16 execute(Int32, const DateLUTImpl &) { return dateIsNotSupported(name); } diff --git a/src/Functions/FunctionDateOrDateTimeAddInterval.h b/src/Functions/FunctionDateOrDateTimeAddInterval.h index 051ce096f3e..a3dd761ba46 100644 --- a/src/Functions/FunctionDateOrDateTimeAddInterval.h +++ b/src/Functions/FunctionDateOrDateTimeAddInterval.h @@ -51,7 +51,10 @@ struct AddSecondsImpl { return t + delta; } - + static inline NO_SANITIZE_UNDEFINED UInt32 execute(Int32 d, Int64 delta, const DateLUTImpl & time_zone) + { + return time_zone.fromDayNum(ExtendedDayNum(d)) + delta; + } static inline NO_SANITIZE_UNDEFINED UInt32 execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) { return time_zone.fromDayNum(ExtendedDayNum(d)) + delta; @@ -72,7 +75,10 @@ struct AddMinutesImpl { return t + delta * 60; } - + static inline NO_SANITIZE_UNDEFINED UInt32 execute(Int32 d, Int64 delta, const DateLUTImpl & time_zone) + { + return time_zone.fromDayNum(ExtendedDayNum(d)) + delta * 60; + } static inline NO_SANITIZE_UNDEFINED UInt32 execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) { return time_zone.fromDayNum(ExtendedDayNum(d)) + delta * 60; @@ -92,7 +98,10 @@ struct AddHoursImpl { return t + delta * 3600; } - + static inline NO_SANITIZE_UNDEFINED UInt32 execute(Int32 d, Int64 delta, const DateLUTImpl & time_zone) + { + return time_zone.fromDayNum(ExtendedDayNum(d)) + delta * 3600; + } static inline NO_SANITIZE_UNDEFINED UInt32 execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) { return time_zone.fromDayNum(ExtendedDayNum(d)) + delta * 3600; @@ -424,6 +433,8 @@ public: { case TypeIndex::Date: return resolveReturnType(arguments); + case TypeIndex::Date32: + return resolveReturnType(arguments); case TypeIndex::DateTime: return resolveReturnType(arguments); case TypeIndex::DateTime64: diff --git a/src/Functions/FunctionDateOrDateTimeToSomething.h b/src/Functions/FunctionDateOrDateTimeToSomething.h index 04eb06bed7a..c877194771a 100644 --- a/src/Functions/FunctionDateOrDateTimeToSomething.h +++ b/src/Functions/FunctionDateOrDateTimeToSomething.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include #include