Update to clang-19

This commit is contained in:
Alexey Milovidov 2024-02-27 14:37:21 +01:00
parent c8db5403d7
commit c192a448d0
41 changed files with 360 additions and 407 deletions

View File

@ -185,7 +185,8 @@ inline bool memequalWide(const char * p1, const char * p2, size_t size)
{
case 3: if (!compare8(p1 + 32, p2 + 32)) return false; [[fallthrough]];
case 2: if (!compare8(p1 + 16, p2 + 16)) return false; [[fallthrough]];
case 1: if (!compare8(p1, p2)) return false;
case 1: if (!compare8(p1, p2)) return false; [[fallthrough]];
default: ;
}
return compare8(p1 + size - 16, p2 + size - 16);

View File

@ -68,7 +68,7 @@ public:
typedef typename Bucket::iterator BucketIterator;
typedef typename BucketVec::iterator BucketVecIterator;
class ConstIterator : public std::iterator<std::forward_iterator_tag, Value>
class ConstIterator
{
public:
ConstIterator() : _initialized(false) { }

View File

@ -46,5 +46,6 @@ if (COMPILER_CLANG)
no_warning(thread-safety-negative) # experimental flag, too many false positives
no_warning(enum-constexpr-conversion) # breaks magic-enum library in clang-16
no_warning(unsafe-buffer-usage) # too aggressive
no_warning(switch-default) # conflicts with "defaults in a switch covering all enum values"
# TODO Enable conversion, sign-conversion, double-promotion warnings.
endif ()

View File

@ -31,7 +31,7 @@ struct AuthResult
{
UUID user_id;
/// Session settings received from authentication server (if any)
SettingsChanges settings;
SettingsChanges settings{};
};
/// Contains entities, i.e. instances of classes derived from IAccessEntity.

View File

@ -504,7 +504,7 @@ std::optional<AuthResult> LDAPAccessStorage::authenticateImpl(
}
if (id)
return AuthResult{ .user_id = *id };
return AuthResult{ .user_id = *id, .settings = {} };
return std::nullopt;
}

View File

@ -16,26 +16,26 @@ CalendarTimeInterval::CalendarTimeInterval(const CalendarTimeInterval::Intervals
{
switch (kind.kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond:
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond:
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Sub-second intervals are not supported here");
case IntervalKind::Second:
case IntervalKind::Minute:
case IntervalKind::Hour:
case IntervalKind::Day:
case IntervalKind::Week:
case IntervalKind::Kind::Second:
case IntervalKind::Kind::Minute:
case IntervalKind::Kind::Hour:
case IntervalKind::Kind::Day:
case IntervalKind::Kind::Week:
seconds += val * kind.toAvgSeconds();
break;
case IntervalKind::Month:
case IntervalKind::Kind::Month:
months += val;
break;
case IntervalKind::Quarter:
case IntervalKind::Kind::Quarter:
months += val * 3;
break;
case IntervalKind::Year:
case IntervalKind::Kind::Year:
months += val * 12;
break;
}
@ -57,8 +57,8 @@ CalendarTimeInterval::Intervals CalendarTimeInterval::toIntervals() const
}
chassert(x == 0);
};
greedy(months, {{IntervalKind::Year, 12}, {IntervalKind::Month, 1}});
greedy(seconds, {{IntervalKind::Week, 3600*24*7}, {IntervalKind::Day, 3600*24}, {IntervalKind::Hour, 3600}, {IntervalKind::Minute, 60}, {IntervalKind::Second, 1}});
greedy(months, {{IntervalKind::Kind::Year, 12}, {IntervalKind::Kind::Month, 1}});
greedy(seconds, {{IntervalKind::Kind::Week, 3600*24*7}, {IntervalKind::Kind::Day, 3600*24}, {IntervalKind::Kind::Hour, 3600}, {IntervalKind::Kind::Minute, 60}, {IntervalKind::Kind::Second, 1}});
return res;
}

View File

@ -6,7 +6,7 @@
namespace DB
{
enum class ExternalLoaderStatus : Int8
enum class ExternalLoaderStatus : int8_t
{
NOT_LOADED, /// Object hasn't been tried to load. This is an initial state.
LOADED, /// Object has been loaded successfully.

View File

@ -18,11 +18,11 @@ Int64 IntervalKind::toAvgNanoseconds() const
switch (kind)
{
case IntervalKind::Millisecond:
case IntervalKind::Kind::Millisecond:
return NANOSECONDS_PER_MILLISECOND;
case IntervalKind::Microsecond:
case IntervalKind::Kind::Microsecond:
return NANOSECONDS_PER_MICROSECOND;
case IntervalKind::Nanosecond:
case IntervalKind::Kind::Nanosecond:
return 1;
default:
return toAvgSeconds() * NANOSECONDS_PER_SECOND;
@ -35,17 +35,17 @@ Int32 IntervalKind::toAvgSeconds() const
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond: return 0;
case IntervalKind::Second: return 1;
case IntervalKind::Minute: return 60;
case IntervalKind::Hour: return 3600;
case IntervalKind::Day: return 86400;
case IntervalKind::Week: return 604800;
case IntervalKind::Month: return 2629746; /// Exactly 1/12 of a year.
case IntervalKind::Quarter: return 7889238; /// Exactly 1/4 of a year.
case IntervalKind::Year: return 31556952; /// The average length of a Gregorian year is equal to 365.2425 days
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond: return 0;
case IntervalKind::Kind::Second: return 1;
case IntervalKind::Kind::Minute: return 60;
case IntervalKind::Kind::Hour: return 3600;
case IntervalKind::Kind::Day: return 86400;
case IntervalKind::Kind::Week: return 604800;
case IntervalKind::Kind::Month: return 2629746; /// Exactly 1/12 of a year.
case IntervalKind::Kind::Quarter: return 7889238; /// Exactly 1/4 of a year.
case IntervalKind::Kind::Year: return 31556952; /// The average length of a Gregorian year is equal to 365.2425 days
}
UNREACHABLE();
}
@ -54,21 +54,21 @@ Float64 IntervalKind::toSeconds() const
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Kind::Nanosecond:
return 0.000000001;
case IntervalKind::Microsecond:
case IntervalKind::Kind::Microsecond:
return 0.000001;
case IntervalKind::Millisecond:
case IntervalKind::Kind::Millisecond:
return 0.001;
case IntervalKind::Second:
case IntervalKind::Kind::Second:
return 1;
case IntervalKind::Minute:
case IntervalKind::Kind::Minute:
return 60;
case IntervalKind::Hour:
case IntervalKind::Kind::Hour:
return 3600;
case IntervalKind::Day:
case IntervalKind::Kind::Day:
return 86400;
case IntervalKind::Week:
case IntervalKind::Kind::Week:
return 604800;
default:
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Not possible to get precise number of seconds in non-precise interval");
@ -80,17 +80,17 @@ bool IntervalKind::isFixedLength() const
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond:
case IntervalKind::Second:
case IntervalKind::Minute:
case IntervalKind::Hour:
case IntervalKind::Day:
case IntervalKind::Week: return true;
case IntervalKind::Month:
case IntervalKind::Quarter:
case IntervalKind::Year: return false;
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond:
case IntervalKind::Kind::Second:
case IntervalKind::Kind::Minute:
case IntervalKind::Kind::Hour:
case IntervalKind::Kind::Day:
case IntervalKind::Kind::Week: return true;
case IntervalKind::Kind::Month:
case IntervalKind::Kind::Quarter:
case IntervalKind::Kind::Year: return false;
}
UNREACHABLE();
}
@ -100,21 +100,21 @@ IntervalKind IntervalKind::fromAvgSeconds(Int64 num_seconds)
if (num_seconds)
{
if (!(num_seconds % 31556952))
return IntervalKind::Year;
return IntervalKind::Kind::Year;
if (!(num_seconds % 7889238))
return IntervalKind::Quarter;
return IntervalKind::Kind::Quarter;
if (!(num_seconds % 2629746))
return IntervalKind::Month;
return IntervalKind::Kind::Month;
if (!(num_seconds % 604800))
return IntervalKind::Week;
return IntervalKind::Kind::Week;
if (!(num_seconds % 86400))
return IntervalKind::Day;
return IntervalKind::Kind::Day;
if (!(num_seconds % 3600))
return IntervalKind::Hour;
return IntervalKind::Kind::Hour;
if (!(num_seconds % 60))
return IntervalKind::Minute;
return IntervalKind::Kind::Minute;
}
return IntervalKind::Second;
return IntervalKind::Kind::Second;
}
@ -122,17 +122,17 @@ const char * IntervalKind::toKeyword() const
{
switch (kind)
{
case IntervalKind::Nanosecond: return "NANOSECOND";
case IntervalKind::Microsecond: return "MICROSECOND";
case IntervalKind::Millisecond: return "MILLISECOND";
case IntervalKind::Second: return "SECOND";
case IntervalKind::Minute: return "MINUTE";
case IntervalKind::Hour: return "HOUR";
case IntervalKind::Day: return "DAY";
case IntervalKind::Week: return "WEEK";
case IntervalKind::Month: return "MONTH";
case IntervalKind::Quarter: return "QUARTER";
case IntervalKind::Year: return "YEAR";
case IntervalKind::Kind::Nanosecond: return "NANOSECOND";
case IntervalKind::Kind::Microsecond: return "MICROSECOND";
case IntervalKind::Kind::Millisecond: return "MILLISECOND";
case IntervalKind::Kind::Second: return "SECOND";
case IntervalKind::Kind::Minute: return "MINUTE";
case IntervalKind::Kind::Hour: return "HOUR";
case IntervalKind::Kind::Day: return "DAY";
case IntervalKind::Kind::Week: return "WEEK";
case IntervalKind::Kind::Month: return "MONTH";
case IntervalKind::Kind::Quarter: return "QUARTER";
case IntervalKind::Kind::Year: return "YEAR";
}
UNREACHABLE();
}
@ -142,17 +142,17 @@ const char * IntervalKind::toLowercasedKeyword() const
{
switch (kind)
{
case IntervalKind::Nanosecond: return "nanosecond";
case IntervalKind::Microsecond: return "microsecond";
case IntervalKind::Millisecond: return "millisecond";
case IntervalKind::Second: return "second";
case IntervalKind::Minute: return "minute";
case IntervalKind::Hour: return "hour";
case IntervalKind::Day: return "day";
case IntervalKind::Week: return "week";
case IntervalKind::Month: return "month";
case IntervalKind::Quarter: return "quarter";
case IntervalKind::Year: return "year";
case IntervalKind::Kind::Nanosecond: return "nanosecond";
case IntervalKind::Kind::Microsecond: return "microsecond";
case IntervalKind::Kind::Millisecond: return "millisecond";
case IntervalKind::Kind::Second: return "second";
case IntervalKind::Kind::Minute: return "minute";
case IntervalKind::Kind::Hour: return "hour";
case IntervalKind::Kind::Day: return "day";
case IntervalKind::Kind::Week: return "week";
case IntervalKind::Kind::Month: return "month";
case IntervalKind::Kind::Quarter: return "quarter";
case IntervalKind::Kind::Year: return "year";
}
UNREACHABLE();
}
@ -162,27 +162,27 @@ const char * IntervalKind::toDateDiffUnit() const
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Kind::Nanosecond:
return "nanosecond";
case IntervalKind::Microsecond:
case IntervalKind::Kind::Microsecond:
return "microsecond";
case IntervalKind::Millisecond:
case IntervalKind::Kind::Millisecond:
return "millisecond";
case IntervalKind::Second:
case IntervalKind::Kind::Second:
return "second";
case IntervalKind::Minute:
case IntervalKind::Kind::Minute:
return "minute";
case IntervalKind::Hour:
case IntervalKind::Kind::Hour:
return "hour";
case IntervalKind::Day:
case IntervalKind::Kind::Day:
return "day";
case IntervalKind::Week:
case IntervalKind::Kind::Week:
return "week";
case IntervalKind::Month:
case IntervalKind::Kind::Month:
return "month";
case IntervalKind::Quarter:
case IntervalKind::Kind::Quarter:
return "quarter";
case IntervalKind::Year:
case IntervalKind::Kind::Year:
return "year";
}
UNREACHABLE();
@ -193,27 +193,27 @@ const char * IntervalKind::toNameOfFunctionToIntervalDataType() const
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Kind::Nanosecond:
return "toIntervalNanosecond";
case IntervalKind::Microsecond:
case IntervalKind::Kind::Microsecond:
return "toIntervalMicrosecond";
case IntervalKind::Millisecond:
case IntervalKind::Kind::Millisecond:
return "toIntervalMillisecond";
case IntervalKind::Second:
case IntervalKind::Kind::Second:
return "toIntervalSecond";
case IntervalKind::Minute:
case IntervalKind::Kind::Minute:
return "toIntervalMinute";
case IntervalKind::Hour:
case IntervalKind::Kind::Hour:
return "toIntervalHour";
case IntervalKind::Day:
case IntervalKind::Kind::Day:
return "toIntervalDay";
case IntervalKind::Week:
case IntervalKind::Kind::Week:
return "toIntervalWeek";
case IntervalKind::Month:
case IntervalKind::Kind::Month:
return "toIntervalMonth";
case IntervalKind::Quarter:
case IntervalKind::Kind::Quarter:
return "toIntervalQuarter";
case IntervalKind::Year:
case IntervalKind::Kind::Year:
return "toIntervalYear";
}
UNREACHABLE();
@ -224,30 +224,30 @@ const char * IntervalKind::toNameOfFunctionExtractTimePart() const
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Kind::Nanosecond:
return "toNanosecond";
case IntervalKind::Microsecond:
case IntervalKind::Kind::Microsecond:
return "toMicrosecond";
case IntervalKind::Millisecond:
case IntervalKind::Kind::Millisecond:
return "toMillisecond";
case IntervalKind::Second:
case IntervalKind::Kind::Second:
return "toSecond";
case IntervalKind::Minute:
case IntervalKind::Kind::Minute:
return "toMinute";
case IntervalKind::Hour:
case IntervalKind::Kind::Hour:
return "toHour";
case IntervalKind::Day:
case IntervalKind::Kind::Day:
return "toDayOfMonth";
case IntervalKind::Week:
case IntervalKind::Kind::Week:
// TODO: SELECT toRelativeWeekNum(toDate('2017-06-15')) - toRelativeWeekNum(toStartOfYear(toDate('2017-06-15')))
// else if (ParserKeyword("WEEK").ignore(pos, expected))
// function_name = "toRelativeWeekNum";
throw Exception(ErrorCodes::SYNTAX_ERROR, "The syntax 'EXTRACT(WEEK FROM date)' is not supported, cannot extract the number of a week");
case IntervalKind::Month:
case IntervalKind::Kind::Month:
return "toMonth";
case IntervalKind::Quarter:
case IntervalKind::Kind::Quarter:
return "toQuarter";
case IntervalKind::Year:
case IntervalKind::Kind::Year:
return "toYear";
}
UNREACHABLE();
@ -258,57 +258,57 @@ bool IntervalKind::tryParseString(const std::string & kind, IntervalKind::Kind &
{
if ("nanosecond" == kind)
{
result = IntervalKind::Nanosecond;
result = IntervalKind::Kind::Nanosecond;
return true;
}
if ("microsecond" == kind)
{
result = IntervalKind::Microsecond;
result = IntervalKind::Kind::Microsecond;
return true;
}
if ("millisecond" == kind)
{
result = IntervalKind::Millisecond;
result = IntervalKind::Kind::Millisecond;
return true;
}
if ("second" == kind)
{
result = IntervalKind::Second;
result = IntervalKind::Kind::Second;
return true;
}
if ("minute" == kind)
{
result = IntervalKind::Minute;
result = IntervalKind::Kind::Minute;
return true;
}
if ("hour" == kind)
{
result = IntervalKind::Hour;
result = IntervalKind::Kind::Hour;
return true;
}
if ("day" == kind)
{
result = IntervalKind::Day;
result = IntervalKind::Kind::Day;
return true;
}
if ("week" == kind)
{
result = IntervalKind::Week;
result = IntervalKind::Kind::Week;
return true;
}
if ("month" == kind)
{
result = IntervalKind::Month;
result = IntervalKind::Kind::Month;
return true;
}
if ("quarter" == kind)
{
result = IntervalKind::Quarter;
result = IntervalKind::Kind::Quarter;
return true;
}
if ("year" == kind)
{
result = IntervalKind::Year;
result = IntervalKind::Kind::Year;
return true;
}
return false;

View File

@ -8,7 +8,7 @@ namespace DB
/// Kind of a temporal interval.
struct IntervalKind
{
enum Kind
enum class Kind
{
Nanosecond,
Microsecond,
@ -22,9 +22,9 @@ struct IntervalKind
Quarter,
Year,
};
Kind kind = Second;
Kind kind = Kind::Second;
IntervalKind(Kind kind_ = Second) : kind(kind_) {} /// NOLINT
IntervalKind(Kind kind_ = Kind::Second) : kind(kind_) {} /// NOLINT
operator Kind() const { return kind; } /// NOLINT
constexpr std::string_view toString() const { return magic_enum::enum_name(kind); }

View File

@ -11,7 +11,6 @@
#include <Coordination/KeeperStateManager.h>
#include <Coordination/KeeperSnapshotManagerS3.h>
#include <Coordination/LoggerWrapper.h>
#include <Coordination/ReadBufferFromNuraftBuffer.h>
#include <Coordination/WriteBufferFromNuraftBuffer.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
@ -26,13 +25,16 @@
#include <Poco/Util/Application.h>
#include <Common/Exception.h>
#include <Common/LockMemoryExceptionInThread.h>
#include <Common/ZooKeeper/ZooKeeperIO.h>
#include <Common/Stopwatch.h>
#include <Common/getMultipleKeysFromConfig.h>
#include <Disks/DiskLocal.h>
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <fmt/chrono.h>
#include <libnuraft/req_msg.hxx>
namespace DB
{

View File

@ -23,7 +23,7 @@ namespace ProtocolText
ResultSetRow::ResultSetRow(const Serializations & serializations, const DataTypes & data_types, const Columns & columns_, size_t row_num_)
: columns(columns_), row_num(row_num_)
{
static FormatSettings format_settings = {.bool_true_representation = "1", .bool_false_representation = "0"};
FormatSettings format_settings = {.bool_true_representation = "1", .bool_false_representation = "0"};
for (size_t i = 0; i < columns.size(); ++i)
{

View File

@ -15,17 +15,17 @@ bool DataTypeInterval::equals(const IDataType & rhs) const
void registerDataTypeInterval(DataTypeFactory & factory)
{
factory.registerSimpleDataType("IntervalNanosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Nanosecond)); });
factory.registerSimpleDataType("IntervalMicrosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Microsecond)); });
factory.registerSimpleDataType("IntervalMillisecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Millisecond)); });
factory.registerSimpleDataType("IntervalSecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Second)); });
factory.registerSimpleDataType("IntervalMinute", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Minute)); });
factory.registerSimpleDataType("IntervalHour", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Hour)); });
factory.registerSimpleDataType("IntervalDay", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Day)); });
factory.registerSimpleDataType("IntervalWeek", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Week)); });
factory.registerSimpleDataType("IntervalMonth", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Month)); });
factory.registerSimpleDataType("IntervalQuarter", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Quarter)); });
factory.registerSimpleDataType("IntervalYear", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Year)); });
factory.registerSimpleDataType("IntervalNanosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Nanosecond)); });
factory.registerSimpleDataType("IntervalMicrosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Microsecond)); });
factory.registerSimpleDataType("IntervalMillisecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Millisecond)); });
factory.registerSimpleDataType("IntervalSecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Second)); });
factory.registerSimpleDataType("IntervalMinute", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Minute)); });
factory.registerSimpleDataType("IntervalHour", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Hour)); });
factory.registerSimpleDataType("IntervalDay", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Day)); });
factory.registerSimpleDataType("IntervalWeek", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Week)); });
factory.registerSimpleDataType("IntervalMonth", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Month)); });
factory.registerSimpleDataType("IntervalQuarter", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Quarter)); });
factory.registerSimpleDataType("IntervalYear", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Year)); });
}
}

View File

@ -9,7 +9,7 @@
#include <Parsers/queryToString.h>
#include <Common/Macros.h>
#include <Common/filesystemHelpers.h>
#include <Common/logger_useful.h>
namespace fs = std::filesystem;

View File

@ -35,7 +35,7 @@ public:
{
const String & engine_name;
ASTs & engine_args;
ASTStorage * storage;
ASTStorage * storage = nullptr;
const ASTCreateQuery & create_query;
const String & database_name;
const String & metadata_path;

View File

@ -213,7 +213,9 @@ PostgreSQLTableStructure::ColumnsInfoPtr readNamesAndTypesList(
PostgreSQLTableStructure::PGAttribute{
.atttypid = parse<int>(std::get<4>(row)),
.atttypmod = parse<int>(std::get<5>(row)),
.attgenerated = attgenerated.empty() ? char{} : char(attgenerated[0])
.atthasdef = false,
.attgenerated = attgenerated.empty() ? char{} : char(attgenerated[0]),
.attr_def = {}
});
++i;

View File

@ -9,7 +9,7 @@ using RegionID = UInt32;
using RegionDepth = UInt8;
using RegionPopulation = UInt32;
enum class RegionType : Int8
enum class RegionType : int8_t
{
Hidden = -1,
Continent = 1,

View File

@ -40,8 +40,8 @@ struct FormatSettings
UInt64 max_rows_to_read_for_schema_inference = 25000;
UInt64 max_bytes_to_read_for_schema_inference = 32 * 1024 * 1024;
String column_names_for_schema_inference;
String schema_inference_hints;
String column_names_for_schema_inference{};
String schema_inference_hints{};
bool try_infer_integers = false;
bool try_infer_dates = false;
@ -88,7 +88,7 @@ struct FormatSettings
struct
{
IntervalOutputFormat output_format = IntervalOutputFormat::Numeric;
} interval;
} interval{};
enum class DateTimeOverflowBehavior
{
@ -132,7 +132,7 @@ struct FormatSettings
bool output_string_as_string = false;
bool output_fixed_string_as_fixed_byte_array = true;
ArrowCompression output_compression_method = ArrowCompression::NONE;
} arrow;
} arrow{};
struct
{
@ -142,7 +142,7 @@ struct FormatSettings
bool allow_missing_fields = false;
String string_column_pattern;
UInt64 output_rows_in_file = 1;
} avro;
} avro{};
String bool_true_representation = "true";
String bool_false_representation = "false";
@ -169,7 +169,7 @@ struct FormatSettings
bool allow_variable_number_of_columns = false;
bool use_default_on_bad_values = false;
bool try_infer_numbers_from_strings = true;
} csv;
} csv{};
struct HiveText
{
@ -177,7 +177,7 @@ struct FormatSettings
char collection_items_delimiter = '\x02';
char map_keys_delimiter = '\x03';
Names input_field_names;
} hive_text;
} hive_text{};
struct Custom
{
@ -191,7 +191,7 @@ struct FormatSettings
bool try_detect_header = true;
bool skip_trailing_empty_lines = false;
bool allow_variable_number_of_columns = false;
} custom;
} custom{};
struct
{
@ -221,12 +221,12 @@ struct FormatSettings
bool try_infer_objects_as_tuples = false;
bool infer_incomplete_types_as_strings = true;
} json;
} json{};
struct
{
String column_for_object_name;
} json_object_each_row;
String column_for_object_name{};
} json_object_each_row{};
enum class ParquetVersion
{
@ -267,7 +267,7 @@ struct FormatSettings
size_t data_page_size = 1024 * 1024;
size_t write_batch_size = 1024;
size_t local_read_min_bytes_for_seek = 8192;
} parquet;
} parquet{};
struct Pretty
{
@ -285,7 +285,7 @@ struct FormatSettings
};
Charset charset = Charset::UTF8;
} pretty;
} pretty{};
struct
{
@ -302,7 +302,7 @@ struct FormatSettings
bool skip_fields_with_unsupported_types_in_schema_inference = false;
bool use_autogenerated_schema = true;
std::string google_protos_path;
} protobuf;
} protobuf{};
struct
{
@ -317,14 +317,14 @@ struct FormatSettings
* By default, use Text ResultSet.
*/
bool binary_protocol = false;
} mysql_wire;
} mysql_wire{};
struct
{
std::string regexp;
EscapingRule escaping_rule = EscapingRule::Raw;
bool skip_unmatched = false;
} regexp;
} regexp{};
struct
{
@ -332,7 +332,7 @@ struct FormatSettings
std::string format_schema_path;
bool is_server = false;
std::string output_format_schema;
} schema;
} schema{};
struct
{
@ -341,7 +341,7 @@ struct FormatSettings
String row_between_delimiter;
String row_format_template;
String resultset_format_template;
} template_settings;
} template_settings{};
struct
{
@ -354,7 +354,7 @@ struct FormatSettings
bool try_detect_header = true;
bool skip_trailing_empty_lines = false;
bool allow_variable_number_of_columns = false;
} tsv;
} tsv{};
struct
{
@ -363,7 +363,7 @@ struct FormatSettings
bool accurate_types_of_literals = true;
bool allow_data_after_semicolon = false;
bool escape_quote_with_quote = false;
} values;
} values{};
enum class ORCCompression
{
@ -386,7 +386,7 @@ struct FormatSettings
bool use_fast_decoder = true;
bool filter_push_down = true;
UInt64 output_row_index_stride = 10'000;
} orc;
} orc{};
/// For capnProto format we should determine how to
/// compare ClickHouse Enum and Enum from schema.
@ -402,7 +402,7 @@ struct FormatSettings
CapnProtoEnumComparingMode enum_comparing_mode = CapnProtoEnumComparingMode::BY_VALUES;
bool skip_fields_with_unsupported_types_in_schema_inference = false;
bool use_autogenerated_schema = true;
} capn_proto;
} capn_proto{};
enum class MsgPackUUIDRepresentation
{
@ -415,13 +415,13 @@ struct FormatSettings
{
UInt64 number_of_columns = 0;
MsgPackUUIDRepresentation output_uuid_representation = MsgPackUUIDRepresentation::EXT;
} msgpack;
} msgpack{};
struct MySQLDump
{
String table_name;
bool map_column_names = true;
} mysql_dump;
} mysql_dump{};
struct
{
@ -430,28 +430,28 @@ struct FormatSettings
bool include_column_names = true;
bool use_replace = false;
bool quote_names = true;
} sql_insert;
} sql_insert{};
struct
{
bool output_string_as_string;
bool skip_fields_with_unsupported_types_in_schema_inference;
} bson;
} bson{};
struct
{
bool allow_types_conversion = true;
} native;
} native{};
struct
{
bool valid_output_on_exception = false;
} xml;
} xml{};
struct
{
bool escape_special_characters = false;
} markdown;
} markdown{};
};
}

View File

@ -473,7 +473,7 @@ struct ToStartOfInterval;
static constexpr auto TO_START_OF_INTERVAL_NAME = "toStartOfInterval";
template <>
struct ToStartOfInterval<IntervalKind::Nanosecond>
struct ToStartOfInterval<IntervalKind::Kind::Nanosecond>
{
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
{
@ -508,7 +508,7 @@ struct ToStartOfInterval<IntervalKind::Nanosecond>
};
template <>
struct ToStartOfInterval<IntervalKind::Microsecond>
struct ToStartOfInterval<IntervalKind::Kind::Microsecond>
{
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
{
@ -551,7 +551,7 @@ struct ToStartOfInterval<IntervalKind::Microsecond>
};
template <>
struct ToStartOfInterval<IntervalKind::Millisecond>
struct ToStartOfInterval<IntervalKind::Kind::Millisecond>
{
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
{
@ -594,7 +594,7 @@ struct ToStartOfInterval<IntervalKind::Millisecond>
};
template <>
struct ToStartOfInterval<IntervalKind::Second>
struct ToStartOfInterval<IntervalKind::Kind::Second>
{
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
{
@ -615,7 +615,7 @@ struct ToStartOfInterval<IntervalKind::Second>
};
template <>
struct ToStartOfInterval<IntervalKind::Minute>
struct ToStartOfInterval<IntervalKind::Kind::Minute>
{
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
{
@ -636,7 +636,7 @@ struct ToStartOfInterval<IntervalKind::Minute>
};
template <>
struct ToStartOfInterval<IntervalKind::Hour>
struct ToStartOfInterval<IntervalKind::Kind::Hour>
{
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
{
@ -657,7 +657,7 @@ struct ToStartOfInterval<IntervalKind::Hour>
};
template <>
struct ToStartOfInterval<IntervalKind::Day>
struct ToStartOfInterval<IntervalKind::Kind::Day>
{
static UInt32 execute(UInt16 d, Int64 days, const DateLUTImpl & time_zone, Int64)
{
@ -678,7 +678,7 @@ struct ToStartOfInterval<IntervalKind::Day>
};
template <>
struct ToStartOfInterval<IntervalKind::Week>
struct ToStartOfInterval<IntervalKind::Kind::Week>
{
static UInt16 execute(UInt16 d, Int64 weeks, const DateLUTImpl & time_zone, Int64)
{
@ -699,7 +699,7 @@ struct ToStartOfInterval<IntervalKind::Week>
};
template <>
struct ToStartOfInterval<IntervalKind::Month>
struct ToStartOfInterval<IntervalKind::Kind::Month>
{
static UInt16 execute(UInt16 d, Int64 months, const DateLUTImpl & time_zone, Int64)
{
@ -720,7 +720,7 @@ struct ToStartOfInterval<IntervalKind::Month>
};
template <>
struct ToStartOfInterval<IntervalKind::Quarter>
struct ToStartOfInterval<IntervalKind::Kind::Quarter>
{
static UInt16 execute(UInt16 d, Int64 quarters, const DateLUTImpl & time_zone, Int64)
{
@ -741,7 +741,7 @@ struct ToStartOfInterval<IntervalKind::Quarter>
};
template <>
struct ToStartOfInterval<IntervalKind::Year>
struct ToStartOfInterval<IntervalKind::Kind::Year>
{
static UInt16 execute(UInt16 d, Int64 years, const DateLUTImpl & time_zone, Int64)
{

View File

@ -2019,7 +2019,7 @@ struct NameToDecimal256 { static constexpr auto name = "toDecimal256"; };
struct NameToInterval ## INTERVAL_KIND \
{ \
static constexpr auto name = "toInterval" #INTERVAL_KIND; \
static constexpr auto kind = IntervalKind::INTERVAL_KIND; \
static constexpr auto kind = IntervalKind::Kind::INTERVAL_KIND; \
};
DEFINE_NAME_TO_INTERVAL(Nanosecond)
@ -3448,7 +3448,7 @@ arguments, result_type, input_rows_count); \
}
#define GENERATE_INTERVAL_CASE(INTERVAL_KIND) \
case IntervalKind::INTERVAL_KIND: \
case IntervalKind::Kind::INTERVAL_KIND: \
return createFunctionAdaptor(FunctionConvert<DataTypeInterval, NameToInterval##INTERVAL_KIND, PositiveMonotonicity>::create(), from_type);
static WrapperType createIntervalWrapper(const DataTypePtr & from_type, IntervalKind kind)

View File

@ -12,6 +12,7 @@
#include <Functions/FunctionHelpers.h>
#include <Functions/FunctionsTimeWindow.h>
namespace DB
{
@ -75,8 +76,8 @@ namespace
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument of function {}. "
"Should be an interval of time", argument.type->getName(), function_name);
interval_kind = interval_type->getKind();
result_type_is_date = (interval_type->getKind() == IntervalKind::Year) || (interval_type->getKind() == IntervalKind::Quarter)
|| (interval_type->getKind() == IntervalKind::Month) || (interval_type->getKind() == IntervalKind::Week);
result_type_is_date = (interval_type->getKind() == IntervalKind::Kind::Year) || (interval_type->getKind() == IntervalKind::Kind::Quarter)
|| (interval_type->getKind() == IntervalKind::Kind::Month) || (interval_type->getKind() == IntervalKind::Kind::Week);
}
void checkIntervalArgument(const ColumnWithTypeAndName & argument, const String & function_name, bool & result_type_is_date)
@ -159,29 +160,23 @@ struct TimeWindowImpl<TUMBLE>
switch (std::get<0>(interval))
{
//TODO: add proper support for fractional seconds
// case IntervalKind::Nanosecond:
// return executeTumble<UInt32, IntervalKind::Nanosecond>(*time_column_vec, std::get<1>(interval), time_zone);
// case IntervalKind::Microsecond:
// return executeTumble<UInt32, IntervalKind::Microsecond>(*time_column_vec, std::get<1>(interval), time_zone);
// case IntervalKind::Millisecond:
// return executeTumble<UInt32, IntervalKind::Millisecond>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Second:
return executeTumble<UInt32, IntervalKind::Second>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Minute:
return executeTumble<UInt32, IntervalKind::Minute>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Hour:
return executeTumble<UInt32, IntervalKind::Hour>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Day:
return executeTumble<UInt32, IntervalKind::Day>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Week:
return executeTumble<UInt16, IntervalKind::Week>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Month:
return executeTumble<UInt16, IntervalKind::Month>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Quarter:
return executeTumble<UInt16, IntervalKind::Quarter>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Year:
return executeTumble<UInt16, IntervalKind::Year>(*time_column_vec, std::get<1>(interval), time_zone);
/// TODO: add proper support for fractional seconds
case IntervalKind::Kind::Second:
return executeTumble<UInt32, IntervalKind::Kind::Second>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Minute:
return executeTumble<UInt32, IntervalKind::Kind::Minute>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Hour:
return executeTumble<UInt32, IntervalKind::Kind::Hour>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Day:
return executeTumble<UInt32, IntervalKind::Kind::Day>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Week:
return executeTumble<UInt16, IntervalKind::Kind::Week>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Month:
return executeTumble<UInt16, IntervalKind::Kind::Month>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Quarter:
return executeTumble<UInt16, IntervalKind::Kind::Quarter>(*time_column_vec, std::get<1>(interval), time_zone);
case IntervalKind::Kind::Year:
return executeTumble<UInt16, IntervalKind::Kind::Year>(*time_column_vec, std::get<1>(interval), time_zone);
default:
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");
}
@ -347,39 +342,30 @@ struct TimeWindowImpl<HOP>
switch (std::get<0>(window_interval))
{
//TODO: add proper support for fractional seconds
// case IntervalKind::Nanosecond:
// return executeHop<UInt32, IntervalKind::Nanosecond>(
// *time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
// case IntervalKind::Microsecond:
// return executeHop<UInt32, IntervalKind::Microsecond>(
// *time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
// case IntervalKind::Millisecond:
// return executeHop<UInt32, IntervalKind::Millisecond>(
// *time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Second:
return executeHop<UInt32, IntervalKind::Second>(
/// TODO: add proper support for fractional seconds
case IntervalKind::Kind::Second:
return executeHop<UInt32, IntervalKind::Kind::Second>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Minute:
return executeHop<UInt32, IntervalKind::Minute>(
case IntervalKind::Kind::Minute:
return executeHop<UInt32, IntervalKind::Kind::Minute>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Hour:
return executeHop<UInt32, IntervalKind::Hour>(
case IntervalKind::Kind::Hour:
return executeHop<UInt32, IntervalKind::Kind::Hour>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Day:
return executeHop<UInt32, IntervalKind::Day>(
case IntervalKind::Kind::Day:
return executeHop<UInt32, IntervalKind::Kind::Day>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Week:
return executeHop<UInt16, IntervalKind::Week>(
case IntervalKind::Kind::Week:
return executeHop<UInt16, IntervalKind::Kind::Week>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Month:
return executeHop<UInt16, IntervalKind::Month>(
case IntervalKind::Kind::Month:
return executeHop<UInt16, IntervalKind::Kind::Month>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Quarter:
return executeHop<UInt16, IntervalKind::Quarter>(
case IntervalKind::Kind::Quarter:
return executeHop<UInt16, IntervalKind::Kind::Quarter>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Year:
return executeHop<UInt16, IntervalKind::Year>(
case IntervalKind::Kind::Year:
return executeHop<UInt16, IntervalKind::Kind::Year>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
default:
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");
@ -492,39 +478,30 @@ struct TimeWindowImpl<WINDOW_ID>
switch (std::get<0>(window_interval))
{
//TODO: add proper support for fractional seconds
// case IntervalKind::Nanosecond:
// return executeHopSlice<UInt32, IntervalKind::Nanosecond>(
// *time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
// case IntervalKind::Microsecond:
// return executeHopSlice<UInt32, IntervalKind::Microsecond>(
// *time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
// case IntervalKind::Millisecond:
// return executeHopSlice<UInt32, IntervalKind::Millisecond>(
// *time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Second:
return executeHopSlice<UInt32, IntervalKind::Second>(
/// TODO: add proper support for fractional seconds
case IntervalKind::Kind::Second:
return executeHopSlice<UInt32, IntervalKind::Kind::Second>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Minute:
return executeHopSlice<UInt32, IntervalKind::Minute>(
case IntervalKind::Kind::Minute:
return executeHopSlice<UInt32, IntervalKind::Kind::Minute>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Hour:
return executeHopSlice<UInt32, IntervalKind::Hour>(
case IntervalKind::Kind::Hour:
return executeHopSlice<UInt32, IntervalKind::Kind::Hour>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Day:
return executeHopSlice<UInt32, IntervalKind::Day>(
case IntervalKind::Kind::Day:
return executeHopSlice<UInt32, IntervalKind::Kind::Day>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Week:
return executeHopSlice<UInt16, IntervalKind::Week>(
case IntervalKind::Kind::Week:
return executeHopSlice<UInt16, IntervalKind::Kind::Week>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Month:
return executeHopSlice<UInt16, IntervalKind::Month>(
case IntervalKind::Kind::Month:
return executeHopSlice<UInt16, IntervalKind::Kind::Month>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Quarter:
return executeHopSlice<UInt16, IntervalKind::Quarter>(
case IntervalKind::Kind::Quarter:
return executeHopSlice<UInt16, IntervalKind::Kind::Quarter>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
case IntervalKind::Year:
return executeHopSlice<UInt16, IntervalKind::Year>(
case IntervalKind::Kind::Year:
return executeHopSlice<UInt16, IntervalKind::Kind::Year>(
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
default:
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");

View File

@ -4,31 +4,22 @@
#include <DataTypes/DataTypeInterval.h>
#include <Functions/IFunction.h>
namespace DB
{
/** Time window functions:
*
* tumble(time_attr, interval [, timezone])
*
* tumbleStart(window_id)
*
* tumbleStart(time_attr, interval [, timezone])
*
* tumbleEnd(window_id)
*
* tumbleEnd(time_attr, interval [, timezone])
*
* hop(time_attr, hop_interval, window_interval [, timezone])
*
* hopStart(window_id)
*
* hopStart(time_attr, hop_interval, window_interval [, timezone])
*
* hopEnd(window_id)
*
* hopEnd(time_attr, hop_interval, window_interval [, timezone])
*
*/
enum TimeWindowFunctionName
{
@ -46,7 +37,7 @@ struct ToStartOfTransform;
#define TRANSFORM_DATE(INTERVAL_KIND) \
template <> \
struct ToStartOfTransform<IntervalKind::INTERVAL_KIND> \
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
{ \
static auto execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone) \
{ \
@ -60,7 +51,7 @@ struct ToStartOfTransform;
#undef TRANSFORM_DATE
template <>
struct ToStartOfTransform<IntervalKind::Day>
struct ToStartOfTransform<IntervalKind::Kind::Day>
{
static UInt32 execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone)
{
@ -70,7 +61,7 @@ struct ToStartOfTransform;
#define TRANSFORM_TIME(INTERVAL_KIND) \
template <> \
struct ToStartOfTransform<IntervalKind::INTERVAL_KIND> \
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
{ \
static UInt32 execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone) \
{ \
@ -84,7 +75,7 @@ struct ToStartOfTransform;
#define TRANSFORM_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
template<> \
struct ToStartOfTransform<IntervalKind::INTERVAL_KIND> \
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
{ \
static Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
{ \
@ -112,7 +103,7 @@ template<> \
#define ADD_DATE(INTERVAL_KIND) \
template <> \
struct AddTime<IntervalKind::INTERVAL_KIND> \
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
{ \
static inline auto execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) \
{ \
@ -125,7 +116,7 @@ template<> \
#undef ADD_DATE
template <>
struct AddTime<IntervalKind::Week>
struct AddTime<IntervalKind::Kind::Week>
{
static inline NO_SANITIZE_UNDEFINED ExtendedDayNum execute(UInt16 d, UInt64 delta, const DateLUTImpl &)
{
@ -135,7 +126,7 @@ template<> \
#define ADD_TIME(INTERVAL_KIND, INTERVAL) \
template <> \
struct AddTime<IntervalKind::INTERVAL_KIND> \
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
{ \
static inline NO_SANITIZE_UNDEFINED UInt32 execute(UInt32 t, Int64 delta, const DateLUTImpl &) \
{ return static_cast<UInt32>(t + delta * INTERVAL); } \
@ -148,7 +139,7 @@ template<> \
#define ADD_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
template <> \
struct AddTime<IntervalKind::INTERVAL_KIND> \
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
{ \
static inline NO_SANITIZE_UNDEFINED Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
{ \

View File

@ -55,9 +55,9 @@ public:
if (!IntervalKind::tryParseString(datepart_param, datepart_kind))
throw Exception(ErrorCodes::BAD_ARGUMENTS, "{} doesn't look like datepart name in {}", datepart_param, getName());
result_type_is_date = (datepart_kind == IntervalKind::Year)
|| (datepart_kind == IntervalKind::Quarter) || (datepart_kind == IntervalKind::Month)
|| (datepart_kind == IntervalKind::Week);
result_type_is_date = (datepart_kind == IntervalKind::Kind::Year)
|| (datepart_kind == IntervalKind::Kind::Quarter) || (datepart_kind == IntervalKind::Kind::Month)
|| (datepart_kind == IntervalKind::Kind::Week);
};
bool second_argument_is_date = false;
@ -68,8 +68,8 @@ public:
second_argument_is_date = isDate(arguments[1].type);
if (second_argument_is_date && ((datepart_kind == IntervalKind::Hour)
|| (datepart_kind == IntervalKind::Minute) || (datepart_kind == IntervalKind::Second)))
if (second_argument_is_date && ((datepart_kind == IntervalKind::Kind::Hour)
|| (datepart_kind == IntervalKind::Kind::Minute) || (datepart_kind == IntervalKind::Kind::Second)))
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type Date of argument for function {}", getName());
};

View File

@ -3,7 +3,6 @@
#include <Common/DateLUTImpl.h>
#include <Common/IntervalKind.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDate32.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/DataTypeInterval.h>
@ -11,7 +10,6 @@
#include <Functions/FunctionFactory.h>
#include <Functions/IFunction.h>
#include <IO/WriteHelpers.h>
#include <base/arithmeticOverflow.h>
namespace DB
@ -73,21 +71,21 @@ public:
switch (interval_type->getKind()) // NOLINT(bugprone-switch-missing-default-case)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond:
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond:
result_type = ResultType::DateTime64;
break;
case IntervalKind::Second:
case IntervalKind::Minute:
case IntervalKind::Hour:
case IntervalKind::Day: /// weird why Day leads to DateTime but too afraid to change it
case IntervalKind::Kind::Second:
case IntervalKind::Kind::Minute:
case IntervalKind::Kind::Hour:
case IntervalKind::Kind::Day: /// weird why Day leads to DateTime but too afraid to change it
result_type = ResultType::DateTime;
break;
case IntervalKind::Week:
case IntervalKind::Month:
case IntervalKind::Quarter:
case IntervalKind::Year:
case IntervalKind::Kind::Week:
case IntervalKind::Kind::Month:
case IntervalKind::Kind::Quarter:
case IntervalKind::Kind::Year:
result_type = ResultType::Date;
break;
}
@ -133,11 +131,11 @@ public:
case ResultType::DateTime64:
{
UInt32 scale = 0;
if (interval_type->getKind() == IntervalKind::Nanosecond)
if (interval_type->getKind() == IntervalKind::Kind::Nanosecond)
scale = 9;
else if (interval_type->getKind() == IntervalKind::Microsecond)
else if (interval_type->getKind() == IntervalKind::Kind::Microsecond)
scale = 6;
else if (interval_type->getKind() == IntervalKind::Millisecond)
else if (interval_type->getKind() == IntervalKind::Kind::Millisecond)
scale = 3;
return std::make_shared<DataTypeDateTime64>(scale, extractTimeZoneNameFromFunctionArguments(arguments, 2, 0, false));
@ -206,28 +204,28 @@ private:
switch (interval_type->getKind()) // NOLINT(bugprone-switch-missing-default-case)
{
case IntervalKind::Nanosecond:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Nanosecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Microsecond:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Microsecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Millisecond:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Millisecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Second:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Second>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Minute:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Minute>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Hour:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Hour>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Day:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Day>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Week:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Week>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Month:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Month>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Quarter:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Quarter>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Year:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Year>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Nanosecond:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Kind::Nanosecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Microsecond:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Kind::Microsecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Millisecond:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Kind::Millisecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Second:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Second>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Minute:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Minute>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Hour:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Hour>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Day:
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Day>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Week:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Week>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Month:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Month>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Quarter:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Quarter>(time_data_type, time_column, num_units, result_type, time_zone, scale);
case IntervalKind::Kind::Year:
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Year>(time_data_type, time_column, num_units, result_type, time_zone, scale);
}
std::unreachable();

View File

@ -12,7 +12,7 @@ namespace DB
struct AsynchronousInsertLogElement
{
enum Status : Int8
enum Status : int8_t
{
Ok = 0,
ParsingError = 1,

View File

@ -37,15 +37,15 @@ public:
Status status;
/// Future that allows to wait until the query is flushed.
std::future<void> future;
std::future<void> future{};
/// Read buffer that contains extracted
/// from query data in case of too much data.
std::unique_ptr<ReadBuffer> insert_data_buffer;
std::unique_ptr<ReadBuffer> insert_data_buffer{};
/// Block that contains received by Native
/// protocol data in case of too much data.
Block insert_block;
Block insert_block{};
};
enum class DataKind

View File

@ -12,7 +12,7 @@ namespace DB
struct BlobStorageLogElement
{
enum class EventType : Int8
enum class EventType : int8_t
{
Upload = 1,
Delete = 2,

View File

@ -379,8 +379,8 @@ struct ContextSharedPart : boost::noncopyable
/// The global pool of HTTP sessions for background fetches.
PooledSessionFactoryPtr fetches_session_factory TSA_GUARDED_BY(background_executors_mutex);
RemoteHostFilter remote_host_filter TSA_GUARDED_BY(mutex); /// Allowed URL from config.xml
HTTPHeaderFilter http_header_filter TSA_GUARDED_BY(mutex); /// Forbidden HTTP headers from config.xml
RemoteHostFilter remote_host_filter; /// Allowed URL from config.xml
HTTPHeaderFilter http_header_filter; /// Forbidden HTTP headers from config.xml
/// No lock required for trace_collector modified only during initialization
std::optional<TraceCollector> trace_collector; /// Thread collecting traces from threads executing queries
@ -3300,7 +3300,7 @@ void Context::initializeKeeperDispatcher([[maybe_unused]] bool start_async) cons
}
#if USE_NURAFT
std::shared_ptr<KeeperDispatcher> & Context::getKeeperDispatcher() const
std::shared_ptr<KeeperDispatcher> Context::getKeeperDispatcher() const
{
std::lock_guard lock(shared->keeper_dispatcher_mutex);
if (!shared->keeper_dispatcher)
@ -3309,7 +3309,7 @@ std::shared_ptr<KeeperDispatcher> & Context::getKeeperDispatcher() const
return shared->keeper_dispatcher;
}
std::shared_ptr<KeeperDispatcher> & Context::tryGetKeeperDispatcher() const
std::shared_ptr<KeeperDispatcher> Context::tryGetKeeperDispatcher() const
{
std::lock_guard lock(shared->keeper_dispatcher_mutex);
return shared->keeper_dispatcher;
@ -3486,25 +3486,21 @@ String Context::getInterserverScheme() const
void Context::setRemoteHostFilter(const Poco::Util::AbstractConfiguration & config)
{
std::lock_guard lock(shared->mutex);
shared->remote_host_filter.setValuesFromConfig(config);
}
const RemoteHostFilter & Context::getRemoteHostFilter() const
{
SharedLockGuard lock(shared->mutex);
return shared->remote_host_filter;
}
void Context::setHTTPHeaderFilter(const Poco::Util::AbstractConfiguration & config)
{
std::lock_guard lock(shared->mutex);
shared->http_header_filter.setValuesFromConfig(config);
}
const HTTPHeaderFilter & Context::getHTTPHeaderFilter() const
{
SharedLockGuard lock(shared->mutex);
return shared->http_header_filter;
}

View File

@ -933,8 +933,8 @@ public:
void setClientProtocolVersion(UInt64 version);
#if USE_NURAFT
std::shared_ptr<KeeperDispatcher> & getKeeperDispatcher() const;
std::shared_ptr<KeeperDispatcher> & tryGetKeeperDispatcher() const;
std::shared_ptr<KeeperDispatcher> getKeeperDispatcher() const;
std::shared_ptr<KeeperDispatcher> tryGetKeeperDispatcher() const;
#endif
void initializeKeeperDispatcher(bool start_async) const;
void shutdownKeeperDispatcher() const;

View File

@ -106,7 +106,8 @@ InterpreterFactory::InterpreterPtr InterpreterFactory::get(ASTPtr & query, Conte
ProfileEvents::increment(ProfileEvents::QueriesWithSubqueries);
}
Arguments arguments {
Arguments arguments
{
.query = query,
.context = context,
.options = options

View File

@ -21,7 +21,7 @@ public:
ASTPtr & query;
ContextMutablePtr context;
const SelectQueryOptions & options;
bool allow_materialized;
bool allow_materialized = false;
};
using InterpreterPtr = std::unique_ptr<IInterpreter>;

View File

@ -11,7 +11,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_NANOSECOND").ignore(pos, expected)
|| ParserKeyword("NS").ignore(pos, expected))
{
result = IntervalKind::Nanosecond;
result = IntervalKind::Kind::Nanosecond;
return true;
}
@ -19,7 +19,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_MICROSECOND").ignore(pos, expected)
|| ParserKeyword("MCS").ignore(pos, expected))
{
result = IntervalKind::Microsecond;
result = IntervalKind::Kind::Microsecond;
return true;
}
@ -27,7 +27,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_MILLISECOND").ignore(pos, expected)
|| ParserKeyword("MS").ignore(pos, expected))
{
result = IntervalKind::Millisecond;
result = IntervalKind::Kind::Millisecond;
return true;
}
@ -35,7 +35,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_SECOND").ignore(pos, expected)
|| ParserKeyword("SS").ignore(pos, expected) || ParserKeyword("S").ignore(pos, expected))
{
result = IntervalKind::Second;
result = IntervalKind::Kind::Second;
return true;
}
@ -43,7 +43,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_MINUTE").ignore(pos, expected)
|| ParserKeyword("MI").ignore(pos, expected) || ParserKeyword("N").ignore(pos, expected))
{
result = IntervalKind::Minute;
result = IntervalKind::Kind::Minute;
return true;
}
@ -51,7 +51,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_HOUR").ignore(pos, expected)
|| ParserKeyword("HH").ignore(pos, expected) || ParserKeyword("H").ignore(pos, expected))
{
result = IntervalKind::Hour;
result = IntervalKind::Kind::Hour;
return true;
}
@ -59,7 +59,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_DAY").ignore(pos, expected)
|| ParserKeyword("DD").ignore(pos, expected) || ParserKeyword("D").ignore(pos, expected))
{
result = IntervalKind::Day;
result = IntervalKind::Kind::Day;
return true;
}
@ -67,7 +67,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_WEEK").ignore(pos, expected)
|| ParserKeyword("WK").ignore(pos, expected) || ParserKeyword("WW").ignore(pos, expected))
{
result = IntervalKind::Week;
result = IntervalKind::Kind::Week;
return true;
}
@ -75,7 +75,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_MONTH").ignore(pos, expected)
|| ParserKeyword("MM").ignore(pos, expected) || ParserKeyword("M").ignore(pos, expected))
{
result = IntervalKind::Month;
result = IntervalKind::Kind::Month;
return true;
}
@ -83,7 +83,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_QUARTER").ignore(pos, expected)
|| ParserKeyword("QQ").ignore(pos, expected) || ParserKeyword("Q").ignore(pos, expected))
{
result = IntervalKind::Quarter;
result = IntervalKind::Kind::Quarter;
return true;
}
@ -91,7 +91,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|| ParserKeyword("SQL_TSI_YEAR").ignore(pos, expected)
|| ParserKeyword("YYYY").ignore(pos, expected) || ParserKeyword("YY").ignore(pos, expected))
{
result = IntervalKind::Year;
result = IntervalKind::Kind::Year;
return true;
}

View File

@ -15,9 +15,9 @@ struct JoinTreeQueryPlan
{
QueryPlan query_plan;
QueryProcessingStage::Enum from_stage;
std::set<std::string> used_row_policies;
std::vector<ActionsDAGPtr> actions_dags;
std::unordered_map<const QueryNode *, const QueryPlan::Node *> query_node_to_plan_step_mapping;
std::set<std::string> used_row_policies{};
std::vector<ActionsDAGPtr> actions_dags{};
std::unordered_map<const QueryNode *, const QueryPlan::Node *> query_node_to_plan_step_mapping{};
};
/// Build JOIN TREE query plan for query node

View File

@ -53,13 +53,13 @@ Block FillingTransform::transformHeader(Block header, const SortDescription & so
template <typename T>
static FillColumnDescription::StepFunction getStepFunction(
IntervalKind kind, Int64 step, const DateLUTImpl & date_lut, UInt16 scale = DataTypeDateTime64::default_scale)
IntervalKind::Kind kind, Int64 step, const DateLUTImpl & date_lut, UInt16 scale = DataTypeDateTime64::default_scale)
{
static const DateLUTImpl & utc_time_zone = DateLUT::instance("UTC");
switch (kind) // NOLINT(bugprone-switch-missing-default-case)
{
#define DECLARE_CASE(NAME) \
case IntervalKind::NAME: \
case IntervalKind::Kind::NAME: \
return [step, scale, &date_lut](Field & field) { \
field = Add##NAME##sImpl::execute(static_cast<T>(\
field.get<T>()), static_cast<Int32>(step), date_lut, utc_time_zone, scale); };
@ -161,7 +161,7 @@ static bool tryConvertFields(FillColumnDescription & descr, const DataTypePtr &
switch (*descr.step_kind) // NOLINT(bugprone-switch-missing-default-case)
{
#define DECLARE_CASE(NAME) \
case IntervalKind::NAME: \
case IntervalKind::Kind::NAME: \
descr.step_func = [step, &time_zone = date_time64->getTimeZone()](Field & field) \
{ \
auto field_decimal = field.get<DecimalField<DateTime64>>(); \

View File

@ -1,5 +1,4 @@
#include "Interpreters/AsynchronousInsertQueue.h"
#include "Interpreters/Context_fwd.h"
#include "Interpreters/SquashingTransform.h"
#include "Parsers/ASTInsertQuery.h"
#include <algorithm>

View File

@ -349,7 +349,7 @@ const IMergeTreeDataPart::Index & IMergeTreeDataPart::getIndex() const
if (!index_loaded)
loadIndex();
index_loaded = true;
return index;
return TSA_SUPPRESS_WARNING_FOR_READ(index); /// The variable is guaranteed to be unchanged after return.
}

View File

@ -2,6 +2,7 @@
#include <Storages/MergeTree/MergeTreeBlockReadUtils.h>
#include <Storages/MergeTree/LoadedMergeTreeDataPartInfoForReader.h>
namespace DB
{

View File

@ -75,10 +75,10 @@ public:
{
UncompressedCache * uncompressed_cache = nullptr;
MarkCache * mark_cache = nullptr;
MergeTreeReaderSettings reader_settings;
StorageSnapshotPtr storage_snapshot;
IMergeTreeReader::ValueSizeMap value_size_map;
ReadBufferFromFileBase::ProfileCallback profile_callback;
MergeTreeReaderSettings reader_settings{};
StorageSnapshotPtr storage_snapshot{};
IMergeTreeReader::ValueSizeMap value_size_map{};
ReadBufferFromFileBase::ProfileCallback profile_callback{};
};
struct Readers

View File

@ -1,28 +1,19 @@
#include <Storages/MergeTree/ParallelReplicasReadingCoordinator.h>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <iterator>
#include <map>
#include <mutex>
#include <numeric>
#include <set>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <consistent_hashing.h>
#include <IO/Progress.h>
#include <IO/WriteBufferFromString.h>
#include <Storages/MergeTree/IntersectionsIndexes.h>
#include <Storages/MergeTree/MarkRange.h>
#include <Storages/MergeTree/MergeTreePartInfo.h>
#include <Storages/MergeTree/RangesInDataPart.h>
#include <Storages/MergeTree/RequestResponse.h>
#include <base/defines.h>
#include <base/types.h>
#include <boost/algorithm/string/split.hpp>
#include <fmt/core.h>
#include <fmt/format.h>
@ -31,7 +22,7 @@
#include <Common/ProfileEvents.h>
#include <Common/SipHash.h>
#include <Common/logger_useful.h>
#include <Common/thread_local_rng.h>
using namespace DB;

View File

@ -19,8 +19,8 @@ using DataPartPtr = std::shared_ptr<const IMergeTreeDataPart>;
/// they look natural here because we can fully serialize and then deserialize original DataPart class.
struct RangesInDataPartDescription
{
MergeTreePartInfo info;
MarkRanges ranges;
MergeTreePartInfo info{};
MarkRanges ranges{};
size_t rows = 0;
void serialize(WriteBuffer & out) const;

View File

@ -25,7 +25,7 @@ namespace ErrorCodes
extern const int ACCESS_DENIED;
};
enum class FunctionOrigin : Int8
enum class FunctionOrigin : int8_t
{
SYSTEM = 0,
SQL_USER_DEFINED = 1,

View File

@ -1,9 +1,7 @@
#include <numeric>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeTuple.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionsTimeWindow.h>
#include <Interpreters/addMissingDefaults.h>
#include <Interpreters/AddDefaultDatabaseVisitor.h>
@ -15,7 +13,6 @@
#include <Interpreters/InterpreterDropQuery.h>
#include <Interpreters/InterpreterSelectQuery.h>
#include <Interpreters/ProcessList.h>
#include <Interpreters/QueryAliasesVisitor.h>
#include <Interpreters/QueryNormalizer.h>
#include <Interpreters/getTableExpressions.h>
#include <Interpreters/getHeaderForProcessingStage.h>
@ -30,7 +27,6 @@
#include <Parsers/ASTTablesInSelectQuery.h>
#include <Parsers/ASTColumnDeclaration.h>
#include <Parsers/ASTWatchQuery.h>
#include <Parsers/parseQuery.h>
#include <Parsers/formatAST.h>
#include <Processors/Executors/CompletedPipelineExecutor.h>
#include <Processors/Sources/BlocksSource.h>
@ -51,16 +47,13 @@
#include <Storages/StorageFactory.h>
#include <Common/typeid_cast.h>
#include <Common/ProfileEvents.h>
#include <base/sleep.h>
#include <Common/logger_useful.h>
#include <boost/algorithm/string/replace.hpp>
#include <Storages/LiveView/StorageBlocks.h>
#include <Storages/WindowView/StorageWindowView.h>
#include <Storages/WindowView/WindowViewSource.h>
#include <QueryPipeline/printPipeline.h>
#include <QueryPipeline/QueryPipelineBuilder.h>
@ -285,13 +278,13 @@ namespace
{
switch (kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond:
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond:
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by windows yet");
#define CASE_WINDOW_KIND(KIND) \
case IntervalKind::KIND: { \
return AddTime<IntervalKind::KIND>::execute(time_sec, num_units, time_zone); \
case IntervalKind::Kind::KIND: { \
return AddTime<IntervalKind::Kind::KIND>::execute(time_sec, num_units, time_zone); \
}
CASE_WINDOW_KIND(Second)
CASE_WINDOW_KIND(Minute)
@ -875,20 +868,20 @@ UInt32 StorageWindowView::getWindowLowerBound(UInt32 time_sec)
{
switch (slide_kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond:
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond:
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by windows yet");
#define CASE_WINDOW_KIND(KIND) \
case IntervalKind::KIND: \
case IntervalKind::Kind::KIND: \
{ \
if (is_tumble) \
return ToStartOfTransform<IntervalKind::KIND>::execute(time_sec, window_num_units, *time_zone); \
return ToStartOfTransform<IntervalKind::Kind::KIND>::execute(time_sec, window_num_units, *time_zone); \
else \
{\
UInt32 w_start = ToStartOfTransform<IntervalKind::KIND>::execute(time_sec, hop_num_units, *time_zone); \
UInt32 w_end = AddTime<IntervalKind::KIND>::execute(w_start, hop_num_units, *time_zone);\
return AddTime<IntervalKind::KIND>::execute(w_end, -window_num_units, *time_zone);\
UInt32 w_start = ToStartOfTransform<IntervalKind::Kind::KIND>::execute(time_sec, hop_num_units, *time_zone); \
UInt32 w_end = AddTime<IntervalKind::Kind::KIND>::execute(w_start, hop_num_units, *time_zone);\
return AddTime<IntervalKind::Kind::KIND>::execute(w_end, -window_num_units, *time_zone);\
}\
}
CASE_WINDOW_KIND(Second)
@ -908,16 +901,16 @@ UInt32 StorageWindowView::getWindowUpperBound(UInt32 time_sec)
{
switch (slide_kind)
{
case IntervalKind::Nanosecond:
case IntervalKind::Microsecond:
case IntervalKind::Millisecond:
case IntervalKind::Kind::Nanosecond:
case IntervalKind::Kind::Microsecond:
case IntervalKind::Kind::Millisecond:
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by window view yet");
#define CASE_WINDOW_KIND(KIND) \
case IntervalKind::KIND: \
case IntervalKind::Kind::KIND: \
{ \
UInt32 w_start = ToStartOfTransform<IntervalKind::KIND>::execute(time_sec, slide_num_units, *time_zone); \
return AddTime<IntervalKind::KIND>::execute(w_start, slide_num_units, *time_zone); \
UInt32 w_start = ToStartOfTransform<IntervalKind::Kind::KIND>::execute(time_sec, slide_num_units, *time_zone); \
return AddTime<IntervalKind::Kind::KIND>::execute(w_start, slide_num_units, *time_zone); \
}
CASE_WINDOW_KIND(Second)
CASE_WINDOW_KIND(Minute)
@ -1041,7 +1034,7 @@ void StorageWindowView::threadFuncFireProc()
max_fired_watermark = next_fire_signal;
auto slide_interval = addTime(0, slide_kind, slide_num_units, *time_zone);
/// Convert DayNum into seconds when the slide interval is larger than Day
if (slide_kind > IntervalKind::Day)
if (slide_kind > IntervalKind::Kind::Day)
slide_interval *= 86400;
next_fire_signal += slide_interval;
}
@ -1360,7 +1353,7 @@ void StorageWindowView::eventTimeParser(const ASTCreateQuery & query)
if (query.is_watermark_ascending)
{
is_watermark_bounded = true;
watermark_kind = IntervalKind::Second;
watermark_kind = IntervalKind::Kind::Second;
watermark_num_units = 1;
}
else if (query.is_watermark_bounded)