From d227712f848d8f78eaaa82f5dc5881710ad04a8a Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Mon, 11 Nov 2019 08:18:34 +0300 Subject: [PATCH] Fixed build errors for GCC-9 and Apple Clang. --- dbms/src/DataTypes/DataTypeDateTime64.cpp | 12 ++++++------ dbms/src/Functions/FunctionsConversion.h | 10 +++++----- dbms/src/IO/parseDateTimeBestEffort.cpp | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dbms/src/DataTypes/DataTypeDateTime64.cpp b/dbms/src/DataTypes/DataTypeDateTime64.cpp index af92d446f55..fa2cd3d18ee 100644 --- a/dbms/src/DataTypes/DataTypeDateTime64.cpp +++ b/dbms/src/DataTypes/DataTypeDateTime64.cpp @@ -69,7 +69,7 @@ void DataTypeDateTime64::serializeText(const IColumn & column, size_t row_num, W void DataTypeDateTime64::deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &) const { - DateTime64 result; + DateTime64 result = 0; readDateTime64Text(result, this->getScale(), istr, time_zone); assert_cast(column).getData().push_back(result); } @@ -86,7 +86,7 @@ void DataTypeDateTime64::serializeTextEscaped(const IColumn & column, size_t row void DataTypeDateTime64::deserializeTextEscaped(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const { - DateTime64 x; + DateTime64 x = 0; ::readText(x, scale, istr, settings, time_zone, utc_time_zone); assert_cast(column).getData().push_back(x); } @@ -100,7 +100,7 @@ void DataTypeDateTime64::serializeTextQuoted(const IColumn & column, size_t row_ void DataTypeDateTime64::deserializeTextQuoted(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const { - DateTime64 x; + DateTime64 x = 0; if (checkChar('\'', istr)) /// Cases: '2017-08-31 18:36:48' or '1504193808' { ::readText(x, scale, istr, settings, time_zone, utc_time_zone); @@ -122,7 +122,7 @@ void DataTypeDateTime64::serializeTextJSON(const IColumn & column, size_t row_nu void DataTypeDateTime64::deserializeTextJSON(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const { - DateTime64 x; + DateTime64 x = 0; if (checkChar('"', istr)) { ::readText(x, scale, istr, settings, time_zone, utc_time_zone); @@ -144,7 +144,7 @@ void DataTypeDateTime64::serializeTextCSV(const IColumn & column, size_t row_num void DataTypeDateTime64::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const { - DateTime64 x; + DateTime64 x = 0; if (istr.eof()) throwReadAfterEOF(); @@ -172,7 +172,7 @@ void DataTypeDateTime64::serializeProtobuf(const IColumn & column, size_t row_nu void DataTypeDateTime64::deserializeProtobuf(IColumn & column, ProtobufReader & protobuf, bool allow_add_row, bool & row_added) const { row_added = false; - DateTime64 t; + DateTime64 t = 0; if (!protobuf.readDateTime64(t, scale)) return; diff --git a/dbms/src/Functions/FunctionsConversion.h b/dbms/src/Functions/FunctionsConversion.h index 60059b00762..5b5f385427d 100644 --- a/dbms/src/Functions/FunctionsConversion.h +++ b/dbms/src/Functions/FunctionsConversion.h @@ -641,7 +641,7 @@ struct ConvertThroughParsing { if constexpr (std::is_same_v) { - DateTime64 res; + DateTime64 res = 0; parseDateTime64BestEffort(res, vec_to.getScale(), read_buffer, *local_time_zone, *utc_time_zone); vec_to[i] = res; } @@ -656,7 +656,7 @@ struct ConvertThroughParsing { if constexpr (std::is_same_v) { - DateTime64 value; + DateTime64 value = 0; readDateTime64Text(value, vec_to.getScale(), read_buffer, *local_time_zone); vec_to[i] = value; } @@ -677,7 +677,7 @@ struct ConvertThroughParsing { if constexpr (std::is_same_v) { - DateTime64 res; + DateTime64 res = 0; parsed = tryParseDateTime64BestEffort(res, vec_to.getScale(), read_buffer, *local_time_zone, *utc_time_zone); vec_to[i] = res; } @@ -692,7 +692,7 @@ struct ConvertThroughParsing { if constexpr (std::is_same_v) { - DateTime64 value; + DateTime64 value = 0; parsed = tryReadDateTime64Text(value, vec_to.getScale(), read_buffer, *local_time_zone); vec_to[i] = value; } @@ -1132,7 +1132,7 @@ public: res = std::make_shared(extractTimeZoneNameFromFunctionArguments(arguments, 1, 0)); else if constexpr (to_decimal) { - UInt64 scale = extractToDecimalScale(arguments[1]); + UInt64 scale [[maybe_unused]] = extractToDecimalScale(arguments[1]); if constexpr (std::is_same_v>) res = createDecimal(9, scale); diff --git a/dbms/src/IO/parseDateTimeBestEffort.cpp b/dbms/src/IO/parseDateTimeBestEffort.cpp index e2eaecfc68c..29137cc63de 100644 --- a/dbms/src/IO/parseDateTimeBestEffort.cpp +++ b/dbms/src/IO/parseDateTimeBestEffort.cpp @@ -543,7 +543,7 @@ bool tryParseDateTimeBestEffort(time_t & res, ReadBuffer & in, const DateLUTImpl void parseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone) { - DateTime64::NativeType whole; + time_t whole; DateTime64::NativeType fractional; parseDateTimeBestEffortImpl(whole, in, local_time_zone, utc_time_zone, &fractional);