mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Update to clang-19
This commit is contained in:
parent
c8db5403d7
commit
c192a448d0
@ -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 3: if (!compare8(p1 + 32, p2 + 32)) return false; [[fallthrough]];
|
||||||
case 2: if (!compare8(p1 + 16, p2 + 16)) 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);
|
return compare8(p1 + size - 16, p2 + size - 16);
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
typedef typename Bucket::iterator BucketIterator;
|
typedef typename Bucket::iterator BucketIterator;
|
||||||
typedef typename BucketVec::iterator BucketVecIterator;
|
typedef typename BucketVec::iterator BucketVecIterator;
|
||||||
|
|
||||||
class ConstIterator : public std::iterator<std::forward_iterator_tag, Value>
|
class ConstIterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConstIterator() : _initialized(false) { }
|
ConstIterator() : _initialized(false) { }
|
||||||
|
@ -46,5 +46,6 @@ if (COMPILER_CLANG)
|
|||||||
no_warning(thread-safety-negative) # experimental flag, too many false positives
|
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(enum-constexpr-conversion) # breaks magic-enum library in clang-16
|
||||||
no_warning(unsafe-buffer-usage) # too aggressive
|
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.
|
# TODO Enable conversion, sign-conversion, double-promotion warnings.
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -31,7 +31,7 @@ struct AuthResult
|
|||||||
{
|
{
|
||||||
UUID user_id;
|
UUID user_id;
|
||||||
/// Session settings received from authentication server (if any)
|
/// Session settings received from authentication server (if any)
|
||||||
SettingsChanges settings;
|
SettingsChanges settings{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Contains entities, i.e. instances of classes derived from IAccessEntity.
|
/// Contains entities, i.e. instances of classes derived from IAccessEntity.
|
||||||
|
@ -504,7 +504,7 @@ std::optional<AuthResult> LDAPAccessStorage::authenticateImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
return AuthResult{ .user_id = *id };
|
return AuthResult{ .user_id = *id, .settings = {} };
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,26 +16,26 @@ CalendarTimeInterval::CalendarTimeInterval(const CalendarTimeInterval::Intervals
|
|||||||
{
|
{
|
||||||
switch (kind.kind)
|
switch (kind.kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Sub-second intervals are not supported here");
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Sub-second intervals are not supported here");
|
||||||
|
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
seconds += val * kind.toAvgSeconds();
|
seconds += val * kind.toAvgSeconds();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
months += val;
|
months += val;
|
||||||
break;
|
break;
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
months += val * 3;
|
months += val * 3;
|
||||||
break;
|
break;
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
months += val * 12;
|
months += val * 12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -57,8 +57,8 @@ CalendarTimeInterval::Intervals CalendarTimeInterval::toIntervals() const
|
|||||||
}
|
}
|
||||||
chassert(x == 0);
|
chassert(x == 0);
|
||||||
};
|
};
|
||||||
greedy(months, {{IntervalKind::Year, 12}, {IntervalKind::Month, 1}});
|
greedy(months, {{IntervalKind::Kind::Year, 12}, {IntervalKind::Kind::Month, 1}});
|
||||||
greedy(seconds, {{IntervalKind::Week, 3600*24*7}, {IntervalKind::Day, 3600*24}, {IntervalKind::Hour, 3600}, {IntervalKind::Minute, 60}, {IntervalKind::Second, 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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace DB
|
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.
|
NOT_LOADED, /// Object hasn't been tried to load. This is an initial state.
|
||||||
LOADED, /// Object has been loaded successfully.
|
LOADED, /// Object has been loaded successfully.
|
||||||
|
@ -18,11 +18,11 @@ Int64 IntervalKind::toAvgNanoseconds() const
|
|||||||
|
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
return NANOSECONDS_PER_MILLISECOND;
|
return NANOSECONDS_PER_MILLISECOND;
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
return NANOSECONDS_PER_MICROSECOND;
|
return NANOSECONDS_PER_MICROSECOND;
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return toAvgSeconds() * NANOSECONDS_PER_SECOND;
|
return toAvgSeconds() * NANOSECONDS_PER_SECOND;
|
||||||
@ -35,17 +35,17 @@ Int32 IntervalKind::toAvgSeconds() const
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond: return 0;
|
case IntervalKind::Kind::Millisecond: return 0;
|
||||||
case IntervalKind::Second: return 1;
|
case IntervalKind::Kind::Second: return 1;
|
||||||
case IntervalKind::Minute: return 60;
|
case IntervalKind::Kind::Minute: return 60;
|
||||||
case IntervalKind::Hour: return 3600;
|
case IntervalKind::Kind::Hour: return 3600;
|
||||||
case IntervalKind::Day: return 86400;
|
case IntervalKind::Kind::Day: return 86400;
|
||||||
case IntervalKind::Week: return 604800;
|
case IntervalKind::Kind::Week: return 604800;
|
||||||
case IntervalKind::Month: return 2629746; /// Exactly 1/12 of a year.
|
case IntervalKind::Kind::Month: return 2629746; /// Exactly 1/12 of a year.
|
||||||
case IntervalKind::Quarter: return 7889238; /// Exactly 1/4 of a year.
|
case IntervalKind::Kind::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::Year: return 31556952; /// The average length of a Gregorian year is equal to 365.2425 days
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -54,21 +54,21 @@ Float64 IntervalKind::toSeconds() const
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
return 0.000000001;
|
return 0.000000001;
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
return 0.000001;
|
return 0.000001;
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
return 0.001;
|
return 0.001;
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
return 1;
|
return 1;
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return 60;
|
return 60;
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return 3600;
|
return 3600;
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return 86400;
|
return 86400;
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
return 604800;
|
return 604800;
|
||||||
default:
|
default:
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Not possible to get precise number of seconds in non-precise interval");
|
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)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
case IntervalKind::Week: return true;
|
case IntervalKind::Kind::Week: return true;
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
case IntervalKind::Year: return false;
|
case IntervalKind::Kind::Year: return false;
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -100,21 +100,21 @@ IntervalKind IntervalKind::fromAvgSeconds(Int64 num_seconds)
|
|||||||
if (num_seconds)
|
if (num_seconds)
|
||||||
{
|
{
|
||||||
if (!(num_seconds % 31556952))
|
if (!(num_seconds % 31556952))
|
||||||
return IntervalKind::Year;
|
return IntervalKind::Kind::Year;
|
||||||
if (!(num_seconds % 7889238))
|
if (!(num_seconds % 7889238))
|
||||||
return IntervalKind::Quarter;
|
return IntervalKind::Kind::Quarter;
|
||||||
if (!(num_seconds % 2629746))
|
if (!(num_seconds % 2629746))
|
||||||
return IntervalKind::Month;
|
return IntervalKind::Kind::Month;
|
||||||
if (!(num_seconds % 604800))
|
if (!(num_seconds % 604800))
|
||||||
return IntervalKind::Week;
|
return IntervalKind::Kind::Week;
|
||||||
if (!(num_seconds % 86400))
|
if (!(num_seconds % 86400))
|
||||||
return IntervalKind::Day;
|
return IntervalKind::Kind::Day;
|
||||||
if (!(num_seconds % 3600))
|
if (!(num_seconds % 3600))
|
||||||
return IntervalKind::Hour;
|
return IntervalKind::Kind::Hour;
|
||||||
if (!(num_seconds % 60))
|
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)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond: return "NANOSECOND";
|
case IntervalKind::Kind::Nanosecond: return "NANOSECOND";
|
||||||
case IntervalKind::Microsecond: return "MICROSECOND";
|
case IntervalKind::Kind::Microsecond: return "MICROSECOND";
|
||||||
case IntervalKind::Millisecond: return "MILLISECOND";
|
case IntervalKind::Kind::Millisecond: return "MILLISECOND";
|
||||||
case IntervalKind::Second: return "SECOND";
|
case IntervalKind::Kind::Second: return "SECOND";
|
||||||
case IntervalKind::Minute: return "MINUTE";
|
case IntervalKind::Kind::Minute: return "MINUTE";
|
||||||
case IntervalKind::Hour: return "HOUR";
|
case IntervalKind::Kind::Hour: return "HOUR";
|
||||||
case IntervalKind::Day: return "DAY";
|
case IntervalKind::Kind::Day: return "DAY";
|
||||||
case IntervalKind::Week: return "WEEK";
|
case IntervalKind::Kind::Week: return "WEEK";
|
||||||
case IntervalKind::Month: return "MONTH";
|
case IntervalKind::Kind::Month: return "MONTH";
|
||||||
case IntervalKind::Quarter: return "QUARTER";
|
case IntervalKind::Kind::Quarter: return "QUARTER";
|
||||||
case IntervalKind::Year: return "YEAR";
|
case IntervalKind::Kind::Year: return "YEAR";
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -142,17 +142,17 @@ const char * IntervalKind::toLowercasedKeyword() const
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond: return "nanosecond";
|
case IntervalKind::Kind::Nanosecond: return "nanosecond";
|
||||||
case IntervalKind::Microsecond: return "microsecond";
|
case IntervalKind::Kind::Microsecond: return "microsecond";
|
||||||
case IntervalKind::Millisecond: return "millisecond";
|
case IntervalKind::Kind::Millisecond: return "millisecond";
|
||||||
case IntervalKind::Second: return "second";
|
case IntervalKind::Kind::Second: return "second";
|
||||||
case IntervalKind::Minute: return "minute";
|
case IntervalKind::Kind::Minute: return "minute";
|
||||||
case IntervalKind::Hour: return "hour";
|
case IntervalKind::Kind::Hour: return "hour";
|
||||||
case IntervalKind::Day: return "day";
|
case IntervalKind::Kind::Day: return "day";
|
||||||
case IntervalKind::Week: return "week";
|
case IntervalKind::Kind::Week: return "week";
|
||||||
case IntervalKind::Month: return "month";
|
case IntervalKind::Kind::Month: return "month";
|
||||||
case IntervalKind::Quarter: return "quarter";
|
case IntervalKind::Kind::Quarter: return "quarter";
|
||||||
case IntervalKind::Year: return "year";
|
case IntervalKind::Kind::Year: return "year";
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -162,27 +162,27 @@ const char * IntervalKind::toDateDiffUnit() const
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
return "nanosecond";
|
return "nanosecond";
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
return "microsecond";
|
return "microsecond";
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
return "millisecond";
|
return "millisecond";
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
return "second";
|
return "second";
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return "minute";
|
return "minute";
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return "hour";
|
return "hour";
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return "day";
|
return "day";
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
return "week";
|
return "week";
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
return "month";
|
return "month";
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
return "quarter";
|
return "quarter";
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
return "year";
|
return "year";
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -193,27 +193,27 @@ const char * IntervalKind::toNameOfFunctionToIntervalDataType() const
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
return "toIntervalNanosecond";
|
return "toIntervalNanosecond";
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
return "toIntervalMicrosecond";
|
return "toIntervalMicrosecond";
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
return "toIntervalMillisecond";
|
return "toIntervalMillisecond";
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
return "toIntervalSecond";
|
return "toIntervalSecond";
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return "toIntervalMinute";
|
return "toIntervalMinute";
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return "toIntervalHour";
|
return "toIntervalHour";
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return "toIntervalDay";
|
return "toIntervalDay";
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
return "toIntervalWeek";
|
return "toIntervalWeek";
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
return "toIntervalMonth";
|
return "toIntervalMonth";
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
return "toIntervalQuarter";
|
return "toIntervalQuarter";
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
return "toIntervalYear";
|
return "toIntervalYear";
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -224,30 +224,30 @@ const char * IntervalKind::toNameOfFunctionExtractTimePart() const
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
return "toNanosecond";
|
return "toNanosecond";
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
return "toMicrosecond";
|
return "toMicrosecond";
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
return "toMillisecond";
|
return "toMillisecond";
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
return "toSecond";
|
return "toSecond";
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return "toMinute";
|
return "toMinute";
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return "toHour";
|
return "toHour";
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return "toDayOfMonth";
|
return "toDayOfMonth";
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
// TODO: SELECT toRelativeWeekNum(toDate('2017-06-15')) - toRelativeWeekNum(toStartOfYear(toDate('2017-06-15')))
|
// TODO: SELECT toRelativeWeekNum(toDate('2017-06-15')) - toRelativeWeekNum(toStartOfYear(toDate('2017-06-15')))
|
||||||
// else if (ParserKeyword("WEEK").ignore(pos, expected))
|
// else if (ParserKeyword("WEEK").ignore(pos, expected))
|
||||||
// function_name = "toRelativeWeekNum";
|
// function_name = "toRelativeWeekNum";
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "The syntax 'EXTRACT(WEEK FROM date)' is not supported, cannot extract the number of a week");
|
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";
|
return "toMonth";
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
return "toQuarter";
|
return "toQuarter";
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
return "toYear";
|
return "toYear";
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
@ -258,57 +258,57 @@ bool IntervalKind::tryParseString(const std::string & kind, IntervalKind::Kind &
|
|||||||
{
|
{
|
||||||
if ("nanosecond" == kind)
|
if ("nanosecond" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Nanosecond;
|
result = IntervalKind::Kind::Nanosecond;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("microsecond" == kind)
|
if ("microsecond" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Microsecond;
|
result = IntervalKind::Kind::Microsecond;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("millisecond" == kind)
|
if ("millisecond" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Millisecond;
|
result = IntervalKind::Kind::Millisecond;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("second" == kind)
|
if ("second" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Second;
|
result = IntervalKind::Kind::Second;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("minute" == kind)
|
if ("minute" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Minute;
|
result = IntervalKind::Kind::Minute;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("hour" == kind)
|
if ("hour" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Hour;
|
result = IntervalKind::Kind::Hour;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("day" == kind)
|
if ("day" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Day;
|
result = IntervalKind::Kind::Day;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("week" == kind)
|
if ("week" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Week;
|
result = IntervalKind::Kind::Week;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("month" == kind)
|
if ("month" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Month;
|
result = IntervalKind::Kind::Month;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("quarter" == kind)
|
if ("quarter" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Quarter;
|
result = IntervalKind::Kind::Quarter;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("year" == kind)
|
if ("year" == kind)
|
||||||
{
|
{
|
||||||
result = IntervalKind::Year;
|
result = IntervalKind::Kind::Year;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,7 +8,7 @@ namespace DB
|
|||||||
/// Kind of a temporal interval.
|
/// Kind of a temporal interval.
|
||||||
struct IntervalKind
|
struct IntervalKind
|
||||||
{
|
{
|
||||||
enum Kind
|
enum class Kind
|
||||||
{
|
{
|
||||||
Nanosecond,
|
Nanosecond,
|
||||||
Microsecond,
|
Microsecond,
|
||||||
@ -22,9 +22,9 @@ struct IntervalKind
|
|||||||
Quarter,
|
Quarter,
|
||||||
Year,
|
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
|
operator Kind() const { return kind; } /// NOLINT
|
||||||
|
|
||||||
constexpr std::string_view toString() const { return magic_enum::enum_name(kind); }
|
constexpr std::string_view toString() const { return magic_enum::enum_name(kind); }
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include <Coordination/KeeperStateManager.h>
|
#include <Coordination/KeeperStateManager.h>
|
||||||
#include <Coordination/KeeperSnapshotManagerS3.h>
|
#include <Coordination/KeeperSnapshotManagerS3.h>
|
||||||
#include <Coordination/LoggerWrapper.h>
|
#include <Coordination/LoggerWrapper.h>
|
||||||
#include <Coordination/ReadBufferFromNuraftBuffer.h>
|
|
||||||
#include <Coordination/WriteBufferFromNuraftBuffer.h>
|
#include <Coordination/WriteBufferFromNuraftBuffer.h>
|
||||||
#include <IO/ReadHelpers.h>
|
#include <IO/ReadHelpers.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
@ -26,13 +25,16 @@
|
|||||||
#include <Poco/Util/Application.h>
|
#include <Poco/Util/Application.h>
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
#include <Common/LockMemoryExceptionInThread.h>
|
#include <Common/LockMemoryExceptionInThread.h>
|
||||||
#include <Common/ZooKeeper/ZooKeeperIO.h>
|
|
||||||
#include <Common/Stopwatch.h>
|
#include <Common/Stopwatch.h>
|
||||||
#include <Common/getMultipleKeysFromConfig.h>
|
#include <Common/getMultipleKeysFromConfig.h>
|
||||||
#include <Disks/DiskLocal.h>
|
#include <Disks/DiskLocal.h>
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
|
|
||||||
#include <libnuraft/req_msg.hxx>
|
#include <libnuraft/req_msg.hxx>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace ProtocolText
|
|||||||
ResultSetRow::ResultSetRow(const Serializations & serializations, const DataTypes & data_types, const Columns & columns_, size_t row_num_)
|
ResultSetRow::ResultSetRow(const Serializations & serializations, const DataTypes & data_types, const Columns & columns_, size_t row_num_)
|
||||||
: columns(columns_), row_num(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)
|
for (size_t i = 0; i < columns.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -15,17 +15,17 @@ bool DataTypeInterval::equals(const IDataType & rhs) const
|
|||||||
|
|
||||||
void registerDataTypeInterval(DataTypeFactory & factory)
|
void registerDataTypeInterval(DataTypeFactory & factory)
|
||||||
{
|
{
|
||||||
factory.registerSimpleDataType("IntervalNanosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Nanosecond)); });
|
factory.registerSimpleDataType("IntervalNanosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Nanosecond)); });
|
||||||
factory.registerSimpleDataType("IntervalMicrosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Microsecond)); });
|
factory.registerSimpleDataType("IntervalMicrosecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Microsecond)); });
|
||||||
factory.registerSimpleDataType("IntervalMillisecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Millisecond)); });
|
factory.registerSimpleDataType("IntervalMillisecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Millisecond)); });
|
||||||
factory.registerSimpleDataType("IntervalSecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Second)); });
|
factory.registerSimpleDataType("IntervalSecond", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Second)); });
|
||||||
factory.registerSimpleDataType("IntervalMinute", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Minute)); });
|
factory.registerSimpleDataType("IntervalMinute", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Minute)); });
|
||||||
factory.registerSimpleDataType("IntervalHour", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Hour)); });
|
factory.registerSimpleDataType("IntervalHour", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Hour)); });
|
||||||
factory.registerSimpleDataType("IntervalDay", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Day)); });
|
factory.registerSimpleDataType("IntervalDay", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Day)); });
|
||||||
factory.registerSimpleDataType("IntervalWeek", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Week)); });
|
factory.registerSimpleDataType("IntervalWeek", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Week)); });
|
||||||
factory.registerSimpleDataType("IntervalMonth", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Month)); });
|
factory.registerSimpleDataType("IntervalMonth", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Month)); });
|
||||||
factory.registerSimpleDataType("IntervalQuarter", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Quarter)); });
|
factory.registerSimpleDataType("IntervalQuarter", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Quarter)); });
|
||||||
factory.registerSimpleDataType("IntervalYear", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Year)); });
|
factory.registerSimpleDataType("IntervalYear", [] { return DataTypePtr(std::make_shared<DataTypeInterval>(IntervalKind::Kind::Year)); });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <Parsers/queryToString.h>
|
#include <Parsers/queryToString.h>
|
||||||
#include <Common/Macros.h>
|
#include <Common/Macros.h>
|
||||||
#include <Common/filesystemHelpers.h>
|
#include <Common/filesystemHelpers.h>
|
||||||
#include <Common/logger_useful.h>
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
{
|
{
|
||||||
const String & engine_name;
|
const String & engine_name;
|
||||||
ASTs & engine_args;
|
ASTs & engine_args;
|
||||||
ASTStorage * storage;
|
ASTStorage * storage = nullptr;
|
||||||
const ASTCreateQuery & create_query;
|
const ASTCreateQuery & create_query;
|
||||||
const String & database_name;
|
const String & database_name;
|
||||||
const String & metadata_path;
|
const String & metadata_path;
|
||||||
|
@ -213,7 +213,9 @@ PostgreSQLTableStructure::ColumnsInfoPtr readNamesAndTypesList(
|
|||||||
PostgreSQLTableStructure::PGAttribute{
|
PostgreSQLTableStructure::PGAttribute{
|
||||||
.atttypid = parse<int>(std::get<4>(row)),
|
.atttypid = parse<int>(std::get<4>(row)),
|
||||||
.atttypmod = parse<int>(std::get<5>(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;
|
++i;
|
||||||
|
@ -9,7 +9,7 @@ using RegionID = UInt32;
|
|||||||
using RegionDepth = UInt8;
|
using RegionDepth = UInt8;
|
||||||
using RegionPopulation = UInt32;
|
using RegionPopulation = UInt32;
|
||||||
|
|
||||||
enum class RegionType : Int8
|
enum class RegionType : int8_t
|
||||||
{
|
{
|
||||||
Hidden = -1,
|
Hidden = -1,
|
||||||
Continent = 1,
|
Continent = 1,
|
||||||
|
@ -40,8 +40,8 @@ struct FormatSettings
|
|||||||
UInt64 max_rows_to_read_for_schema_inference = 25000;
|
UInt64 max_rows_to_read_for_schema_inference = 25000;
|
||||||
UInt64 max_bytes_to_read_for_schema_inference = 32 * 1024 * 1024;
|
UInt64 max_bytes_to_read_for_schema_inference = 32 * 1024 * 1024;
|
||||||
|
|
||||||
String column_names_for_schema_inference;
|
String column_names_for_schema_inference{};
|
||||||
String schema_inference_hints;
|
String schema_inference_hints{};
|
||||||
|
|
||||||
bool try_infer_integers = false;
|
bool try_infer_integers = false;
|
||||||
bool try_infer_dates = false;
|
bool try_infer_dates = false;
|
||||||
@ -88,7 +88,7 @@ struct FormatSettings
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
IntervalOutputFormat output_format = IntervalOutputFormat::Numeric;
|
IntervalOutputFormat output_format = IntervalOutputFormat::Numeric;
|
||||||
} interval;
|
} interval{};
|
||||||
|
|
||||||
enum class DateTimeOverflowBehavior
|
enum class DateTimeOverflowBehavior
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ struct FormatSettings
|
|||||||
bool output_string_as_string = false;
|
bool output_string_as_string = false;
|
||||||
bool output_fixed_string_as_fixed_byte_array = true;
|
bool output_fixed_string_as_fixed_byte_array = true;
|
||||||
ArrowCompression output_compression_method = ArrowCompression::NONE;
|
ArrowCompression output_compression_method = ArrowCompression::NONE;
|
||||||
} arrow;
|
} arrow{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ struct FormatSettings
|
|||||||
bool allow_missing_fields = false;
|
bool allow_missing_fields = false;
|
||||||
String string_column_pattern;
|
String string_column_pattern;
|
||||||
UInt64 output_rows_in_file = 1;
|
UInt64 output_rows_in_file = 1;
|
||||||
} avro;
|
} avro{};
|
||||||
|
|
||||||
String bool_true_representation = "true";
|
String bool_true_representation = "true";
|
||||||
String bool_false_representation = "false";
|
String bool_false_representation = "false";
|
||||||
@ -169,7 +169,7 @@ struct FormatSettings
|
|||||||
bool allow_variable_number_of_columns = false;
|
bool allow_variable_number_of_columns = false;
|
||||||
bool use_default_on_bad_values = false;
|
bool use_default_on_bad_values = false;
|
||||||
bool try_infer_numbers_from_strings = true;
|
bool try_infer_numbers_from_strings = true;
|
||||||
} csv;
|
} csv{};
|
||||||
|
|
||||||
struct HiveText
|
struct HiveText
|
||||||
{
|
{
|
||||||
@ -177,7 +177,7 @@ struct FormatSettings
|
|||||||
char collection_items_delimiter = '\x02';
|
char collection_items_delimiter = '\x02';
|
||||||
char map_keys_delimiter = '\x03';
|
char map_keys_delimiter = '\x03';
|
||||||
Names input_field_names;
|
Names input_field_names;
|
||||||
} hive_text;
|
} hive_text{};
|
||||||
|
|
||||||
struct Custom
|
struct Custom
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ struct FormatSettings
|
|||||||
bool try_detect_header = true;
|
bool try_detect_header = true;
|
||||||
bool skip_trailing_empty_lines = false;
|
bool skip_trailing_empty_lines = false;
|
||||||
bool allow_variable_number_of_columns = false;
|
bool allow_variable_number_of_columns = false;
|
||||||
} custom;
|
} custom{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -221,12 +221,12 @@ struct FormatSettings
|
|||||||
bool try_infer_objects_as_tuples = false;
|
bool try_infer_objects_as_tuples = false;
|
||||||
bool infer_incomplete_types_as_strings = true;
|
bool infer_incomplete_types_as_strings = true;
|
||||||
|
|
||||||
} json;
|
} json{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
String column_for_object_name;
|
String column_for_object_name{};
|
||||||
} json_object_each_row;
|
} json_object_each_row{};
|
||||||
|
|
||||||
enum class ParquetVersion
|
enum class ParquetVersion
|
||||||
{
|
{
|
||||||
@ -267,7 +267,7 @@ struct FormatSettings
|
|||||||
size_t data_page_size = 1024 * 1024;
|
size_t data_page_size = 1024 * 1024;
|
||||||
size_t write_batch_size = 1024;
|
size_t write_batch_size = 1024;
|
||||||
size_t local_read_min_bytes_for_seek = 8192;
|
size_t local_read_min_bytes_for_seek = 8192;
|
||||||
} parquet;
|
} parquet{};
|
||||||
|
|
||||||
struct Pretty
|
struct Pretty
|
||||||
{
|
{
|
||||||
@ -285,7 +285,7 @@ struct FormatSettings
|
|||||||
};
|
};
|
||||||
|
|
||||||
Charset charset = Charset::UTF8;
|
Charset charset = Charset::UTF8;
|
||||||
} pretty;
|
} pretty{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -302,7 +302,7 @@ struct FormatSettings
|
|||||||
bool skip_fields_with_unsupported_types_in_schema_inference = false;
|
bool skip_fields_with_unsupported_types_in_schema_inference = false;
|
||||||
bool use_autogenerated_schema = true;
|
bool use_autogenerated_schema = true;
|
||||||
std::string google_protos_path;
|
std::string google_protos_path;
|
||||||
} protobuf;
|
} protobuf{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -317,14 +317,14 @@ struct FormatSettings
|
|||||||
* By default, use Text ResultSet.
|
* By default, use Text ResultSet.
|
||||||
*/
|
*/
|
||||||
bool binary_protocol = false;
|
bool binary_protocol = false;
|
||||||
} mysql_wire;
|
} mysql_wire{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
std::string regexp;
|
std::string regexp;
|
||||||
EscapingRule escaping_rule = EscapingRule::Raw;
|
EscapingRule escaping_rule = EscapingRule::Raw;
|
||||||
bool skip_unmatched = false;
|
bool skip_unmatched = false;
|
||||||
} regexp;
|
} regexp{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -332,7 +332,7 @@ struct FormatSettings
|
|||||||
std::string format_schema_path;
|
std::string format_schema_path;
|
||||||
bool is_server = false;
|
bool is_server = false;
|
||||||
std::string output_format_schema;
|
std::string output_format_schema;
|
||||||
} schema;
|
} schema{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -341,7 +341,7 @@ struct FormatSettings
|
|||||||
String row_between_delimiter;
|
String row_between_delimiter;
|
||||||
String row_format_template;
|
String row_format_template;
|
||||||
String resultset_format_template;
|
String resultset_format_template;
|
||||||
} template_settings;
|
} template_settings{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -354,7 +354,7 @@ struct FormatSettings
|
|||||||
bool try_detect_header = true;
|
bool try_detect_header = true;
|
||||||
bool skip_trailing_empty_lines = false;
|
bool skip_trailing_empty_lines = false;
|
||||||
bool allow_variable_number_of_columns = false;
|
bool allow_variable_number_of_columns = false;
|
||||||
} tsv;
|
} tsv{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -363,7 +363,7 @@ struct FormatSettings
|
|||||||
bool accurate_types_of_literals = true;
|
bool accurate_types_of_literals = true;
|
||||||
bool allow_data_after_semicolon = false;
|
bool allow_data_after_semicolon = false;
|
||||||
bool escape_quote_with_quote = false;
|
bool escape_quote_with_quote = false;
|
||||||
} values;
|
} values{};
|
||||||
|
|
||||||
enum class ORCCompression
|
enum class ORCCompression
|
||||||
{
|
{
|
||||||
@ -386,7 +386,7 @@ struct FormatSettings
|
|||||||
bool use_fast_decoder = true;
|
bool use_fast_decoder = true;
|
||||||
bool filter_push_down = true;
|
bool filter_push_down = true;
|
||||||
UInt64 output_row_index_stride = 10'000;
|
UInt64 output_row_index_stride = 10'000;
|
||||||
} orc;
|
} orc{};
|
||||||
|
|
||||||
/// For capnProto format we should determine how to
|
/// For capnProto format we should determine how to
|
||||||
/// compare ClickHouse Enum and Enum from schema.
|
/// compare ClickHouse Enum and Enum from schema.
|
||||||
@ -402,7 +402,7 @@ struct FormatSettings
|
|||||||
CapnProtoEnumComparingMode enum_comparing_mode = CapnProtoEnumComparingMode::BY_VALUES;
|
CapnProtoEnumComparingMode enum_comparing_mode = CapnProtoEnumComparingMode::BY_VALUES;
|
||||||
bool skip_fields_with_unsupported_types_in_schema_inference = false;
|
bool skip_fields_with_unsupported_types_in_schema_inference = false;
|
||||||
bool use_autogenerated_schema = true;
|
bool use_autogenerated_schema = true;
|
||||||
} capn_proto;
|
} capn_proto{};
|
||||||
|
|
||||||
enum class MsgPackUUIDRepresentation
|
enum class MsgPackUUIDRepresentation
|
||||||
{
|
{
|
||||||
@ -415,13 +415,13 @@ struct FormatSettings
|
|||||||
{
|
{
|
||||||
UInt64 number_of_columns = 0;
|
UInt64 number_of_columns = 0;
|
||||||
MsgPackUUIDRepresentation output_uuid_representation = MsgPackUUIDRepresentation::EXT;
|
MsgPackUUIDRepresentation output_uuid_representation = MsgPackUUIDRepresentation::EXT;
|
||||||
} msgpack;
|
} msgpack{};
|
||||||
|
|
||||||
struct MySQLDump
|
struct MySQLDump
|
||||||
{
|
{
|
||||||
String table_name;
|
String table_name;
|
||||||
bool map_column_names = true;
|
bool map_column_names = true;
|
||||||
} mysql_dump;
|
} mysql_dump{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -430,28 +430,28 @@ struct FormatSettings
|
|||||||
bool include_column_names = true;
|
bool include_column_names = true;
|
||||||
bool use_replace = false;
|
bool use_replace = false;
|
||||||
bool quote_names = true;
|
bool quote_names = true;
|
||||||
} sql_insert;
|
} sql_insert{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool output_string_as_string;
|
bool output_string_as_string;
|
||||||
bool skip_fields_with_unsupported_types_in_schema_inference;
|
bool skip_fields_with_unsupported_types_in_schema_inference;
|
||||||
} bson;
|
} bson{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool allow_types_conversion = true;
|
bool allow_types_conversion = true;
|
||||||
} native;
|
} native{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool valid_output_on_exception = false;
|
bool valid_output_on_exception = false;
|
||||||
} xml;
|
} xml{};
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool escape_special_characters = false;
|
bool escape_special_characters = false;
|
||||||
} markdown;
|
} markdown{};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,7 @@ struct ToStartOfInterval;
|
|||||||
static constexpr auto TO_START_OF_INTERVAL_NAME = "toStartOfInterval";
|
static constexpr auto TO_START_OF_INTERVAL_NAME = "toStartOfInterval";
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Nanosecond>
|
struct ToStartOfInterval<IntervalKind::Kind::Nanosecond>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
||||||
{
|
{
|
||||||
@ -508,7 +508,7 @@ struct ToStartOfInterval<IntervalKind::Nanosecond>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Microsecond>
|
struct ToStartOfInterval<IntervalKind::Kind::Microsecond>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
||||||
{
|
{
|
||||||
@ -551,7 +551,7 @@ struct ToStartOfInterval<IntervalKind::Microsecond>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Millisecond>
|
struct ToStartOfInterval<IntervalKind::Kind::Millisecond>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
||||||
{
|
{
|
||||||
@ -594,7 +594,7 @@ struct ToStartOfInterval<IntervalKind::Millisecond>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Second>
|
struct ToStartOfInterval<IntervalKind::Kind::Second>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
||||||
{
|
{
|
||||||
@ -615,7 +615,7 @@ struct ToStartOfInterval<IntervalKind::Second>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Minute>
|
struct ToStartOfInterval<IntervalKind::Kind::Minute>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
||||||
{
|
{
|
||||||
@ -636,7 +636,7 @@ struct ToStartOfInterval<IntervalKind::Minute>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Hour>
|
struct ToStartOfInterval<IntervalKind::Kind::Hour>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
static UInt32 execute(UInt16, Int64, const DateLUTImpl &, Int64)
|
||||||
{
|
{
|
||||||
@ -657,7 +657,7 @@ struct ToStartOfInterval<IntervalKind::Hour>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Day>
|
struct ToStartOfInterval<IntervalKind::Kind::Day>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt16 d, Int64 days, const DateLUTImpl & time_zone, Int64)
|
static UInt32 execute(UInt16 d, Int64 days, const DateLUTImpl & time_zone, Int64)
|
||||||
{
|
{
|
||||||
@ -678,7 +678,7 @@ struct ToStartOfInterval<IntervalKind::Day>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Week>
|
struct ToStartOfInterval<IntervalKind::Kind::Week>
|
||||||
{
|
{
|
||||||
static UInt16 execute(UInt16 d, Int64 weeks, const DateLUTImpl & time_zone, Int64)
|
static UInt16 execute(UInt16 d, Int64 weeks, const DateLUTImpl & time_zone, Int64)
|
||||||
{
|
{
|
||||||
@ -699,7 +699,7 @@ struct ToStartOfInterval<IntervalKind::Week>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Month>
|
struct ToStartOfInterval<IntervalKind::Kind::Month>
|
||||||
{
|
{
|
||||||
static UInt16 execute(UInt16 d, Int64 months, const DateLUTImpl & time_zone, Int64)
|
static UInt16 execute(UInt16 d, Int64 months, const DateLUTImpl & time_zone, Int64)
|
||||||
{
|
{
|
||||||
@ -720,7 +720,7 @@ struct ToStartOfInterval<IntervalKind::Month>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Quarter>
|
struct ToStartOfInterval<IntervalKind::Kind::Quarter>
|
||||||
{
|
{
|
||||||
static UInt16 execute(UInt16 d, Int64 quarters, const DateLUTImpl & time_zone, Int64)
|
static UInt16 execute(UInt16 d, Int64 quarters, const DateLUTImpl & time_zone, Int64)
|
||||||
{
|
{
|
||||||
@ -741,7 +741,7 @@ struct ToStartOfInterval<IntervalKind::Quarter>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfInterval<IntervalKind::Year>
|
struct ToStartOfInterval<IntervalKind::Kind::Year>
|
||||||
{
|
{
|
||||||
static UInt16 execute(UInt16 d, Int64 years, const DateLUTImpl & time_zone, Int64)
|
static UInt16 execute(UInt16 d, Int64 years, const DateLUTImpl & time_zone, Int64)
|
||||||
{
|
{
|
||||||
|
@ -2019,7 +2019,7 @@ struct NameToDecimal256 { static constexpr auto name = "toDecimal256"; };
|
|||||||
struct NameToInterval ## INTERVAL_KIND \
|
struct NameToInterval ## INTERVAL_KIND \
|
||||||
{ \
|
{ \
|
||||||
static constexpr auto name = "toInterval" #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)
|
DEFINE_NAME_TO_INTERVAL(Nanosecond)
|
||||||
@ -3448,7 +3448,7 @@ arguments, result_type, input_rows_count); \
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GENERATE_INTERVAL_CASE(INTERVAL_KIND) \
|
#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);
|
return createFunctionAdaptor(FunctionConvert<DataTypeInterval, NameToInterval##INTERVAL_KIND, PositiveMonotonicity>::create(), from_type);
|
||||||
|
|
||||||
static WrapperType createIntervalWrapper(const DataTypePtr & from_type, IntervalKind kind)
|
static WrapperType createIntervalWrapper(const DataTypePtr & from_type, IntervalKind kind)
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <Functions/FunctionHelpers.h>
|
#include <Functions/FunctionHelpers.h>
|
||||||
#include <Functions/FunctionsTimeWindow.h>
|
#include <Functions/FunctionsTimeWindow.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -75,8 +76,8 @@ namespace
|
|||||||
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument of function {}. "
|
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type {} of argument of function {}. "
|
||||||
"Should be an interval of time", argument.type->getName(), function_name);
|
"Should be an interval of time", argument.type->getName(), function_name);
|
||||||
interval_kind = interval_type->getKind();
|
interval_kind = interval_type->getKind();
|
||||||
result_type_is_date = (interval_type->getKind() == IntervalKind::Year) || (interval_type->getKind() == IntervalKind::Quarter)
|
result_type_is_date = (interval_type->getKind() == IntervalKind::Kind::Year) || (interval_type->getKind() == IntervalKind::Kind::Quarter)
|
||||||
|| (interval_type->getKind() == IntervalKind::Month) || (interval_type->getKind() == IntervalKind::Week);
|
|| (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)
|
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))
|
switch (std::get<0>(interval))
|
||||||
{
|
{
|
||||||
//TODO: add proper support for fractional seconds
|
/// TODO: add proper support for fractional seconds
|
||||||
// case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Second:
|
||||||
// return executeTumble<UInt32, IntervalKind::Nanosecond>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt32, IntervalKind::Kind::Second>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
// case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Minute:
|
||||||
// return executeTumble<UInt32, IntervalKind::Microsecond>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt32, IntervalKind::Kind::Minute>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
// case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Hour:
|
||||||
// return executeTumble<UInt32, IntervalKind::Millisecond>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt32, IntervalKind::Kind::Hour>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Day:
|
||||||
return executeTumble<UInt32, IntervalKind::Second>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt32, IntervalKind::Kind::Day>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Week:
|
||||||
return executeTumble<UInt32, IntervalKind::Minute>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt16, IntervalKind::Kind::Week>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Month:
|
||||||
return executeTumble<UInt32, IntervalKind::Hour>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt16, IntervalKind::Kind::Month>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Quarter:
|
||||||
return executeTumble<UInt32, IntervalKind::Day>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt16, IntervalKind::Kind::Quarter>(*time_column_vec, std::get<1>(interval), time_zone);
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Year:
|
||||||
return executeTumble<UInt16, IntervalKind::Week>(*time_column_vec, std::get<1>(interval), time_zone);
|
return executeTumble<UInt16, IntervalKind::Kind::Year>(*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);
|
|
||||||
default:
|
default:
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");
|
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))
|
switch (std::get<0>(window_interval))
|
||||||
{
|
{
|
||||||
//TODO: add proper support for fractional seconds
|
/// TODO: add proper support for fractional seconds
|
||||||
// case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Second:
|
||||||
// return executeHop<UInt32, IntervalKind::Nanosecond>(
|
return executeHop<UInt32, IntervalKind::Kind::Second>(
|
||||||
// *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>(
|
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return executeHop<UInt32, IntervalKind::Minute>(
|
return executeHop<UInt32, IntervalKind::Kind::Minute>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return executeHop<UInt32, IntervalKind::Hour>(
|
return executeHop<UInt32, IntervalKind::Kind::Hour>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return executeHop<UInt32, IntervalKind::Day>(
|
return executeHop<UInt32, IntervalKind::Kind::Day>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
return executeHop<UInt16, IntervalKind::Week>(
|
return executeHop<UInt16, IntervalKind::Kind::Week>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
return executeHop<UInt16, IntervalKind::Month>(
|
return executeHop<UInt16, IntervalKind::Kind::Month>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
return executeHop<UInt16, IntervalKind::Quarter>(
|
return executeHop<UInt16, IntervalKind::Kind::Quarter>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
return executeHop<UInt16, IntervalKind::Year>(
|
return executeHop<UInt16, IntervalKind::Kind::Year>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
default:
|
default:
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");
|
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))
|
switch (std::get<0>(window_interval))
|
||||||
{
|
{
|
||||||
//TODO: add proper support for fractional seconds
|
/// TODO: add proper support for fractional seconds
|
||||||
// case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Second:
|
||||||
// return executeHopSlice<UInt32, IntervalKind::Nanosecond>(
|
return executeHopSlice<UInt32, IntervalKind::Kind::Second>(
|
||||||
// *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>(
|
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return executeHopSlice<UInt32, IntervalKind::Minute>(
|
return executeHopSlice<UInt32, IntervalKind::Kind::Minute>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return executeHopSlice<UInt32, IntervalKind::Hour>(
|
return executeHopSlice<UInt32, IntervalKind::Kind::Hour>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return executeHopSlice<UInt32, IntervalKind::Day>(
|
return executeHopSlice<UInt32, IntervalKind::Kind::Day>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
return executeHopSlice<UInt16, IntervalKind::Week>(
|
return executeHopSlice<UInt16, IntervalKind::Kind::Week>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
return executeHopSlice<UInt16, IntervalKind::Month>(
|
return executeHopSlice<UInt16, IntervalKind::Kind::Month>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
return executeHopSlice<UInt16, IntervalKind::Quarter>(
|
return executeHopSlice<UInt16, IntervalKind::Kind::Quarter>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
return executeHopSlice<UInt16, IntervalKind::Year>(
|
return executeHopSlice<UInt16, IntervalKind::Kind::Year>(
|
||||||
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
*time_column_vec, std::get<1>(hop_interval), std::get<1>(window_interval), time_zone);
|
||||||
default:
|
default:
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");
|
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fraction seconds are unsupported by windows yet");
|
||||||
|
@ -4,31 +4,22 @@
|
|||||||
#include <DataTypes/DataTypeInterval.h>
|
#include <DataTypes/DataTypeInterval.h>
|
||||||
#include <Functions/IFunction.h>
|
#include <Functions/IFunction.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
/** Time window functions:
|
/** Time window functions:
|
||||||
*
|
*
|
||||||
* tumble(time_attr, interval [, timezone])
|
* tumble(time_attr, interval [, timezone])
|
||||||
*
|
|
||||||
* tumbleStart(window_id)
|
* tumbleStart(window_id)
|
||||||
*
|
|
||||||
* tumbleStart(time_attr, interval [, timezone])
|
* tumbleStart(time_attr, interval [, timezone])
|
||||||
*
|
|
||||||
* tumbleEnd(window_id)
|
* tumbleEnd(window_id)
|
||||||
*
|
|
||||||
* tumbleEnd(time_attr, interval [, timezone])
|
* tumbleEnd(time_attr, interval [, timezone])
|
||||||
*
|
|
||||||
* hop(time_attr, hop_interval, window_interval [, timezone])
|
* hop(time_attr, hop_interval, window_interval [, timezone])
|
||||||
*
|
|
||||||
* hopStart(window_id)
|
* hopStart(window_id)
|
||||||
*
|
|
||||||
* hopStart(time_attr, hop_interval, window_interval [, timezone])
|
* hopStart(time_attr, hop_interval, window_interval [, timezone])
|
||||||
*
|
|
||||||
* hopEnd(window_id)
|
* hopEnd(window_id)
|
||||||
*
|
|
||||||
* hopEnd(time_attr, hop_interval, window_interval [, timezone])
|
* hopEnd(time_attr, hop_interval, window_interval [, timezone])
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum TimeWindowFunctionName
|
enum TimeWindowFunctionName
|
||||||
{
|
{
|
||||||
@ -46,7 +37,7 @@ struct ToStartOfTransform;
|
|||||||
|
|
||||||
#define TRANSFORM_DATE(INTERVAL_KIND) \
|
#define TRANSFORM_DATE(INTERVAL_KIND) \
|
||||||
template <> \
|
template <> \
|
||||||
struct ToStartOfTransform<IntervalKind::INTERVAL_KIND> \
|
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static auto execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone) \
|
static auto execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone) \
|
||||||
{ \
|
{ \
|
||||||
@ -60,7 +51,7 @@ struct ToStartOfTransform;
|
|||||||
#undef TRANSFORM_DATE
|
#undef TRANSFORM_DATE
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ToStartOfTransform<IntervalKind::Day>
|
struct ToStartOfTransform<IntervalKind::Kind::Day>
|
||||||
{
|
{
|
||||||
static UInt32 execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone)
|
static UInt32 execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone)
|
||||||
{
|
{
|
||||||
@ -70,7 +61,7 @@ struct ToStartOfTransform;
|
|||||||
|
|
||||||
#define TRANSFORM_TIME(INTERVAL_KIND) \
|
#define TRANSFORM_TIME(INTERVAL_KIND) \
|
||||||
template <> \
|
template <> \
|
||||||
struct ToStartOfTransform<IntervalKind::INTERVAL_KIND> \
|
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static UInt32 execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone) \
|
static UInt32 execute(UInt32 t, UInt64 delta, const DateLUTImpl & time_zone) \
|
||||||
{ \
|
{ \
|
||||||
@ -84,7 +75,7 @@ struct ToStartOfTransform;
|
|||||||
|
|
||||||
#define TRANSFORM_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
|
#define TRANSFORM_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
|
||||||
template<> \
|
template<> \
|
||||||
struct ToStartOfTransform<IntervalKind::INTERVAL_KIND> \
|
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
|
static Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
|
||||||
{ \
|
{ \
|
||||||
@ -112,7 +103,7 @@ template<> \
|
|||||||
|
|
||||||
#define ADD_DATE(INTERVAL_KIND) \
|
#define ADD_DATE(INTERVAL_KIND) \
|
||||||
template <> \
|
template <> \
|
||||||
struct AddTime<IntervalKind::INTERVAL_KIND> \
|
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static inline auto execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) \
|
static inline auto execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) \
|
||||||
{ \
|
{ \
|
||||||
@ -125,7 +116,7 @@ template<> \
|
|||||||
#undef ADD_DATE
|
#undef ADD_DATE
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct AddTime<IntervalKind::Week>
|
struct AddTime<IntervalKind::Kind::Week>
|
||||||
{
|
{
|
||||||
static inline NO_SANITIZE_UNDEFINED ExtendedDayNum execute(UInt16 d, UInt64 delta, const DateLUTImpl &)
|
static inline NO_SANITIZE_UNDEFINED ExtendedDayNum execute(UInt16 d, UInt64 delta, const DateLUTImpl &)
|
||||||
{
|
{
|
||||||
@ -135,7 +126,7 @@ template<> \
|
|||||||
|
|
||||||
#define ADD_TIME(INTERVAL_KIND, INTERVAL) \
|
#define ADD_TIME(INTERVAL_KIND, INTERVAL) \
|
||||||
template <> \
|
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 &) \
|
static inline NO_SANITIZE_UNDEFINED UInt32 execute(UInt32 t, Int64 delta, const DateLUTImpl &) \
|
||||||
{ return static_cast<UInt32>(t + delta * INTERVAL); } \
|
{ return static_cast<UInt32>(t + delta * INTERVAL); } \
|
||||||
@ -148,7 +139,7 @@ template<> \
|
|||||||
|
|
||||||
#define ADD_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
|
#define ADD_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
|
||||||
template <> \
|
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) \
|
static inline NO_SANITIZE_UNDEFINED Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -55,9 +55,9 @@ public:
|
|||||||
if (!IntervalKind::tryParseString(datepart_param, datepart_kind))
|
if (!IntervalKind::tryParseString(datepart_param, datepart_kind))
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "{} doesn't look like datepart name in {}", datepart_param, getName());
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "{} doesn't look like datepart name in {}", datepart_param, getName());
|
||||||
|
|
||||||
result_type_is_date = (datepart_kind == IntervalKind::Year)
|
result_type_is_date = (datepart_kind == IntervalKind::Kind::Year)
|
||||||
|| (datepart_kind == IntervalKind::Quarter) || (datepart_kind == IntervalKind::Month)
|
|| (datepart_kind == IntervalKind::Kind::Quarter) || (datepart_kind == IntervalKind::Kind::Month)
|
||||||
|| (datepart_kind == IntervalKind::Week);
|
|| (datepart_kind == IntervalKind::Kind::Week);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool second_argument_is_date = false;
|
bool second_argument_is_date = false;
|
||||||
@ -68,8 +68,8 @@ public:
|
|||||||
|
|
||||||
second_argument_is_date = isDate(arguments[1].type);
|
second_argument_is_date = isDate(arguments[1].type);
|
||||||
|
|
||||||
if (second_argument_is_date && ((datepart_kind == IntervalKind::Hour)
|
if (second_argument_is_date && ((datepart_kind == IntervalKind::Kind::Hour)
|
||||||
|| (datepart_kind == IntervalKind::Minute) || (datepart_kind == IntervalKind::Second)))
|
|| (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());
|
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Illegal type Date of argument for function {}", getName());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <Common/DateLUTImpl.h>
|
#include <Common/DateLUTImpl.h>
|
||||||
#include <Common/IntervalKind.h>
|
#include <Common/IntervalKind.h>
|
||||||
#include <DataTypes/DataTypeDate.h>
|
#include <DataTypes/DataTypeDate.h>
|
||||||
#include <DataTypes/DataTypeDate32.h>
|
|
||||||
#include <DataTypes/DataTypeDateTime.h>
|
#include <DataTypes/DataTypeDateTime.h>
|
||||||
#include <DataTypes/DataTypeDateTime64.h>
|
#include <DataTypes/DataTypeDateTime64.h>
|
||||||
#include <DataTypes/DataTypeInterval.h>
|
#include <DataTypes/DataTypeInterval.h>
|
||||||
@ -11,7 +10,6 @@
|
|||||||
#include <Functions/FunctionFactory.h>
|
#include <Functions/FunctionFactory.h>
|
||||||
#include <Functions/IFunction.h>
|
#include <Functions/IFunction.h>
|
||||||
#include <IO/WriteHelpers.h>
|
#include <IO/WriteHelpers.h>
|
||||||
#include <base/arithmeticOverflow.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
@ -73,21 +71,21 @@ public:
|
|||||||
|
|
||||||
switch (interval_type->getKind()) // NOLINT(bugprone-switch-missing-default-case)
|
switch (interval_type->getKind()) // NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
result_type = ResultType::DateTime64;
|
result_type = ResultType::DateTime64;
|
||||||
break;
|
break;
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
case IntervalKind::Day: /// weird why Day leads to DateTime but too afraid to change it
|
case IntervalKind::Kind::Day: /// weird why Day leads to DateTime but too afraid to change it
|
||||||
result_type = ResultType::DateTime;
|
result_type = ResultType::DateTime;
|
||||||
break;
|
break;
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
result_type = ResultType::Date;
|
result_type = ResultType::Date;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -133,11 +131,11 @@ public:
|
|||||||
case ResultType::DateTime64:
|
case ResultType::DateTime64:
|
||||||
{
|
{
|
||||||
UInt32 scale = 0;
|
UInt32 scale = 0;
|
||||||
if (interval_type->getKind() == IntervalKind::Nanosecond)
|
if (interval_type->getKind() == IntervalKind::Kind::Nanosecond)
|
||||||
scale = 9;
|
scale = 9;
|
||||||
else if (interval_type->getKind() == IntervalKind::Microsecond)
|
else if (interval_type->getKind() == IntervalKind::Kind::Microsecond)
|
||||||
scale = 6;
|
scale = 6;
|
||||||
else if (interval_type->getKind() == IntervalKind::Millisecond)
|
else if (interval_type->getKind() == IntervalKind::Kind::Millisecond)
|
||||||
scale = 3;
|
scale = 3;
|
||||||
|
|
||||||
return std::make_shared<DataTypeDateTime64>(scale, extractTimeZoneNameFromFunctionArguments(arguments, 2, 0, false));
|
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)
|
switch (interval_type->getKind()) // NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Nanosecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Kind::Nanosecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Microsecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Kind::Microsecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Millisecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime64, IntervalKind::Kind::Millisecond>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Second:
|
case IntervalKind::Kind::Second:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Second>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Second>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Minute:
|
case IntervalKind::Kind::Minute:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Minute>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Minute>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Hour:
|
case IntervalKind::Kind::Hour:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Hour>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Hour>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Day:
|
case IntervalKind::Kind::Day:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Day>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDateTime, IntervalKind::Kind::Day>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Week:
|
case IntervalKind::Kind::Week:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Week>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Week>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Month:
|
case IntervalKind::Kind::Month:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Month>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Month>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Quarter:
|
case IntervalKind::Kind::Quarter:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Quarter>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Quarter>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
case IntervalKind::Year:
|
case IntervalKind::Kind::Year:
|
||||||
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Year>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
return execute<TimeDataType, TimeColumnType, DataTypeDate, IntervalKind::Kind::Year>(time_data_type, time_column, num_units, result_type, time_zone, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unreachable();
|
std::unreachable();
|
||||||
|
@ -12,7 +12,7 @@ namespace DB
|
|||||||
|
|
||||||
struct AsynchronousInsertLogElement
|
struct AsynchronousInsertLogElement
|
||||||
{
|
{
|
||||||
enum Status : Int8
|
enum Status : int8_t
|
||||||
{
|
{
|
||||||
Ok = 0,
|
Ok = 0,
|
||||||
ParsingError = 1,
|
ParsingError = 1,
|
||||||
|
@ -37,15 +37,15 @@ public:
|
|||||||
Status status;
|
Status status;
|
||||||
|
|
||||||
/// Future that allows to wait until the query is flushed.
|
/// Future that allows to wait until the query is flushed.
|
||||||
std::future<void> future;
|
std::future<void> future{};
|
||||||
|
|
||||||
/// Read buffer that contains extracted
|
/// Read buffer that contains extracted
|
||||||
/// from query data in case of too much data.
|
/// 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
|
/// Block that contains received by Native
|
||||||
/// protocol data in case of too much data.
|
/// protocol data in case of too much data.
|
||||||
Block insert_block;
|
Block insert_block{};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DataKind
|
enum class DataKind
|
||||||
|
@ -12,7 +12,7 @@ namespace DB
|
|||||||
|
|
||||||
struct BlobStorageLogElement
|
struct BlobStorageLogElement
|
||||||
{
|
{
|
||||||
enum class EventType : Int8
|
enum class EventType : int8_t
|
||||||
{
|
{
|
||||||
Upload = 1,
|
Upload = 1,
|
||||||
Delete = 2,
|
Delete = 2,
|
||||||
|
@ -379,8 +379,8 @@ struct ContextSharedPart : boost::noncopyable
|
|||||||
/// The global pool of HTTP sessions for background fetches.
|
/// The global pool of HTTP sessions for background fetches.
|
||||||
PooledSessionFactoryPtr fetches_session_factory TSA_GUARDED_BY(background_executors_mutex);
|
PooledSessionFactoryPtr fetches_session_factory TSA_GUARDED_BY(background_executors_mutex);
|
||||||
|
|
||||||
RemoteHostFilter remote_host_filter TSA_GUARDED_BY(mutex); /// Allowed URL from config.xml
|
RemoteHostFilter remote_host_filter; /// Allowed URL from config.xml
|
||||||
HTTPHeaderFilter http_header_filter TSA_GUARDED_BY(mutex); /// Forbidden HTTP headers from config.xml
|
HTTPHeaderFilter http_header_filter; /// Forbidden HTTP headers from config.xml
|
||||||
|
|
||||||
/// No lock required for trace_collector modified only during initialization
|
/// No lock required for trace_collector modified only during initialization
|
||||||
std::optional<TraceCollector> trace_collector; /// Thread collecting traces from threads executing queries
|
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
|
#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);
|
std::lock_guard lock(shared->keeper_dispatcher_mutex);
|
||||||
if (!shared->keeper_dispatcher)
|
if (!shared->keeper_dispatcher)
|
||||||
@ -3309,7 +3309,7 @@ std::shared_ptr<KeeperDispatcher> & Context::getKeeperDispatcher() const
|
|||||||
return shared->keeper_dispatcher;
|
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);
|
std::lock_guard lock(shared->keeper_dispatcher_mutex);
|
||||||
return shared->keeper_dispatcher;
|
return shared->keeper_dispatcher;
|
||||||
@ -3486,25 +3486,21 @@ String Context::getInterserverScheme() const
|
|||||||
|
|
||||||
void Context::setRemoteHostFilter(const Poco::Util::AbstractConfiguration & config)
|
void Context::setRemoteHostFilter(const Poco::Util::AbstractConfiguration & config)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(shared->mutex);
|
|
||||||
shared->remote_host_filter.setValuesFromConfig(config);
|
shared->remote_host_filter.setValuesFromConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RemoteHostFilter & Context::getRemoteHostFilter() const
|
const RemoteHostFilter & Context::getRemoteHostFilter() const
|
||||||
{
|
{
|
||||||
SharedLockGuard lock(shared->mutex);
|
|
||||||
return shared->remote_host_filter;
|
return shared->remote_host_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::setHTTPHeaderFilter(const Poco::Util::AbstractConfiguration & config)
|
void Context::setHTTPHeaderFilter(const Poco::Util::AbstractConfiguration & config)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(shared->mutex);
|
|
||||||
shared->http_header_filter.setValuesFromConfig(config);
|
shared->http_header_filter.setValuesFromConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
const HTTPHeaderFilter & Context::getHTTPHeaderFilter() const
|
const HTTPHeaderFilter & Context::getHTTPHeaderFilter() const
|
||||||
{
|
{
|
||||||
SharedLockGuard lock(shared->mutex);
|
|
||||||
return shared->http_header_filter;
|
return shared->http_header_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,8 +933,8 @@ public:
|
|||||||
void setClientProtocolVersion(UInt64 version);
|
void setClientProtocolVersion(UInt64 version);
|
||||||
|
|
||||||
#if USE_NURAFT
|
#if USE_NURAFT
|
||||||
std::shared_ptr<KeeperDispatcher> & getKeeperDispatcher() const;
|
std::shared_ptr<KeeperDispatcher> getKeeperDispatcher() const;
|
||||||
std::shared_ptr<KeeperDispatcher> & tryGetKeeperDispatcher() const;
|
std::shared_ptr<KeeperDispatcher> tryGetKeeperDispatcher() const;
|
||||||
#endif
|
#endif
|
||||||
void initializeKeeperDispatcher(bool start_async) const;
|
void initializeKeeperDispatcher(bool start_async) const;
|
||||||
void shutdownKeeperDispatcher() const;
|
void shutdownKeeperDispatcher() const;
|
||||||
|
@ -106,7 +106,8 @@ InterpreterFactory::InterpreterPtr InterpreterFactory::get(ASTPtr & query, Conte
|
|||||||
ProfileEvents::increment(ProfileEvents::QueriesWithSubqueries);
|
ProfileEvents::increment(ProfileEvents::QueriesWithSubqueries);
|
||||||
}
|
}
|
||||||
|
|
||||||
Arguments arguments {
|
Arguments arguments
|
||||||
|
{
|
||||||
.query = query,
|
.query = query,
|
||||||
.context = context,
|
.context = context,
|
||||||
.options = options
|
.options = options
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
ASTPtr & query;
|
ASTPtr & query;
|
||||||
ContextMutablePtr context;
|
ContextMutablePtr context;
|
||||||
const SelectQueryOptions & options;
|
const SelectQueryOptions & options;
|
||||||
bool allow_materialized;
|
bool allow_materialized = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
using InterpreterPtr = std::unique_ptr<IInterpreter>;
|
using InterpreterPtr = std::unique_ptr<IInterpreter>;
|
||||||
|
@ -11,7 +11,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_NANOSECOND").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_NANOSECOND").ignore(pos, expected)
|
||||||
|| ParserKeyword("NS").ignore(pos, expected))
|
|| ParserKeyword("NS").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Nanosecond;
|
result = IntervalKind::Kind::Nanosecond;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_MICROSECOND").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_MICROSECOND").ignore(pos, expected)
|
||||||
|| ParserKeyword("MCS").ignore(pos, expected))
|
|| ParserKeyword("MCS").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Microsecond;
|
result = IntervalKind::Kind::Microsecond;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_MILLISECOND").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_MILLISECOND").ignore(pos, expected)
|
||||||
|| ParserKeyword("MS").ignore(pos, expected))
|
|| ParserKeyword("MS").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Millisecond;
|
result = IntervalKind::Kind::Millisecond;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_SECOND").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_SECOND").ignore(pos, expected)
|
||||||
|| ParserKeyword("SS").ignore(pos, expected) || ParserKeyword("S").ignore(pos, expected))
|
|| ParserKeyword("SS").ignore(pos, expected) || ParserKeyword("S").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Second;
|
result = IntervalKind::Kind::Second;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_MINUTE").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_MINUTE").ignore(pos, expected)
|
||||||
|| ParserKeyword("MI").ignore(pos, expected) || ParserKeyword("N").ignore(pos, expected))
|
|| ParserKeyword("MI").ignore(pos, expected) || ParserKeyword("N").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Minute;
|
result = IntervalKind::Kind::Minute;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_HOUR").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_HOUR").ignore(pos, expected)
|
||||||
|| ParserKeyword("HH").ignore(pos, expected) || ParserKeyword("H").ignore(pos, expected))
|
|| ParserKeyword("HH").ignore(pos, expected) || ParserKeyword("H").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Hour;
|
result = IntervalKind::Kind::Hour;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_DAY").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_DAY").ignore(pos, expected)
|
||||||
|| ParserKeyword("DD").ignore(pos, expected) || ParserKeyword("D").ignore(pos, expected))
|
|| ParserKeyword("DD").ignore(pos, expected) || ParserKeyword("D").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Day;
|
result = IntervalKind::Kind::Day;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_WEEK").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_WEEK").ignore(pos, expected)
|
||||||
|| ParserKeyword("WK").ignore(pos, expected) || ParserKeyword("WW").ignore(pos, expected))
|
|| ParserKeyword("WK").ignore(pos, expected) || ParserKeyword("WW").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Week;
|
result = IntervalKind::Kind::Week;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_MONTH").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_MONTH").ignore(pos, expected)
|
||||||
|| ParserKeyword("MM").ignore(pos, expected) || ParserKeyword("M").ignore(pos, expected))
|
|| ParserKeyword("MM").ignore(pos, expected) || ParserKeyword("M").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Month;
|
result = IntervalKind::Kind::Month;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_QUARTER").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_QUARTER").ignore(pos, expected)
|
||||||
|| ParserKeyword("QQ").ignore(pos, expected) || ParserKeyword("Q").ignore(pos, expected))
|
|| ParserKeyword("QQ").ignore(pos, expected) || ParserKeyword("Q").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Quarter;
|
result = IntervalKind::Kind::Quarter;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ bool parseIntervalKind(IParser::Pos & pos, Expected & expected, IntervalKind & r
|
|||||||
|| ParserKeyword("SQL_TSI_YEAR").ignore(pos, expected)
|
|| ParserKeyword("SQL_TSI_YEAR").ignore(pos, expected)
|
||||||
|| ParserKeyword("YYYY").ignore(pos, expected) || ParserKeyword("YY").ignore(pos, expected))
|
|| ParserKeyword("YYYY").ignore(pos, expected) || ParserKeyword("YY").ignore(pos, expected))
|
||||||
{
|
{
|
||||||
result = IntervalKind::Year;
|
result = IntervalKind::Kind::Year;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ struct JoinTreeQueryPlan
|
|||||||
{
|
{
|
||||||
QueryPlan query_plan;
|
QueryPlan query_plan;
|
||||||
QueryProcessingStage::Enum from_stage;
|
QueryProcessingStage::Enum from_stage;
|
||||||
std::set<std::string> used_row_policies;
|
std::set<std::string> used_row_policies{};
|
||||||
std::vector<ActionsDAGPtr> actions_dags;
|
std::vector<ActionsDAGPtr> actions_dags{};
|
||||||
std::unordered_map<const QueryNode *, const QueryPlan::Node *> query_node_to_plan_step_mapping;
|
std::unordered_map<const QueryNode *, const QueryPlan::Node *> query_node_to_plan_step_mapping{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Build JOIN TREE query plan for query node
|
/// Build JOIN TREE query plan for query node
|
||||||
|
@ -53,13 +53,13 @@ Block FillingTransform::transformHeader(Block header, const SortDescription & so
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static FillColumnDescription::StepFunction getStepFunction(
|
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");
|
static const DateLUTImpl & utc_time_zone = DateLUT::instance("UTC");
|
||||||
switch (kind) // NOLINT(bugprone-switch-missing-default-case)
|
switch (kind) // NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
#define DECLARE_CASE(NAME) \
|
#define DECLARE_CASE(NAME) \
|
||||||
case IntervalKind::NAME: \
|
case IntervalKind::Kind::NAME: \
|
||||||
return [step, scale, &date_lut](Field & field) { \
|
return [step, scale, &date_lut](Field & field) { \
|
||||||
field = Add##NAME##sImpl::execute(static_cast<T>(\
|
field = Add##NAME##sImpl::execute(static_cast<T>(\
|
||||||
field.get<T>()), static_cast<Int32>(step), date_lut, utc_time_zone, scale); };
|
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)
|
switch (*descr.step_kind) // NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
#define DECLARE_CASE(NAME) \
|
#define DECLARE_CASE(NAME) \
|
||||||
case IntervalKind::NAME: \
|
case IntervalKind::Kind::NAME: \
|
||||||
descr.step_func = [step, &time_zone = date_time64->getTimeZone()](Field & field) \
|
descr.step_func = [step, &time_zone = date_time64->getTimeZone()](Field & field) \
|
||||||
{ \
|
{ \
|
||||||
auto field_decimal = field.get<DecimalField<DateTime64>>(); \
|
auto field_decimal = field.get<DecimalField<DateTime64>>(); \
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "Interpreters/AsynchronousInsertQueue.h"
|
#include "Interpreters/AsynchronousInsertQueue.h"
|
||||||
#include "Interpreters/Context_fwd.h"
|
|
||||||
#include "Interpreters/SquashingTransform.h"
|
#include "Interpreters/SquashingTransform.h"
|
||||||
#include "Parsers/ASTInsertQuery.h"
|
#include "Parsers/ASTInsertQuery.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -349,7 +349,7 @@ const IMergeTreeDataPart::Index & IMergeTreeDataPart::getIndex() const
|
|||||||
if (!index_loaded)
|
if (!index_loaded)
|
||||||
loadIndex();
|
loadIndex();
|
||||||
index_loaded = true;
|
index_loaded = true;
|
||||||
return index;
|
return TSA_SUPPRESS_WARNING_FOR_READ(index); /// The variable is guaranteed to be unchanged after return.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <Storages/MergeTree/MergeTreeBlockReadUtils.h>
|
#include <Storages/MergeTree/MergeTreeBlockReadUtils.h>
|
||||||
#include <Storages/MergeTree/LoadedMergeTreeDataPartInfoForReader.h>
|
#include <Storages/MergeTree/LoadedMergeTreeDataPartInfoForReader.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ public:
|
|||||||
{
|
{
|
||||||
UncompressedCache * uncompressed_cache = nullptr;
|
UncompressedCache * uncompressed_cache = nullptr;
|
||||||
MarkCache * mark_cache = nullptr;
|
MarkCache * mark_cache = nullptr;
|
||||||
MergeTreeReaderSettings reader_settings;
|
MergeTreeReaderSettings reader_settings{};
|
||||||
StorageSnapshotPtr storage_snapshot;
|
StorageSnapshotPtr storage_snapshot{};
|
||||||
IMergeTreeReader::ValueSizeMap value_size_map;
|
IMergeTreeReader::ValueSizeMap value_size_map{};
|
||||||
ReadBufferFromFileBase::ProfileCallback profile_callback;
|
ReadBufferFromFileBase::ProfileCallback profile_callback{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Readers
|
struct Readers
|
||||||
|
@ -1,28 +1,19 @@
|
|||||||
#include <Storages/MergeTree/ParallelReplicasReadingCoordinator.h>
|
#include <Storages/MergeTree/ParallelReplicasReadingCoordinator.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <map>
|
|
||||||
#include <mutex>
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <consistent_hashing.h>
|
#include <consistent_hashing.h>
|
||||||
|
|
||||||
#include <IO/Progress.h>
|
#include <IO/Progress.h>
|
||||||
#include <IO/WriteBufferFromString.h>
|
|
||||||
#include <Storages/MergeTree/IntersectionsIndexes.h>
|
|
||||||
#include <Storages/MergeTree/MarkRange.h>
|
#include <Storages/MergeTree/MarkRange.h>
|
||||||
#include <Storages/MergeTree/MergeTreePartInfo.h>
|
#include <Storages/MergeTree/MergeTreePartInfo.h>
|
||||||
#include <Storages/MergeTree/RangesInDataPart.h>
|
#include <Storages/MergeTree/RangesInDataPart.h>
|
||||||
#include <Storages/MergeTree/RequestResponse.h>
|
#include <Storages/MergeTree/RequestResponse.h>
|
||||||
#include <base/defines.h>
|
|
||||||
#include <base/types.h>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
@ -31,7 +22,7 @@
|
|||||||
#include <Common/ProfileEvents.h>
|
#include <Common/ProfileEvents.h>
|
||||||
#include <Common/SipHash.h>
|
#include <Common/SipHash.h>
|
||||||
#include <Common/logger_useful.h>
|
#include <Common/logger_useful.h>
|
||||||
#include <Common/thread_local_rng.h>
|
|
||||||
|
|
||||||
using namespace DB;
|
using namespace DB;
|
||||||
|
|
||||||
|
@ -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.
|
/// they look natural here because we can fully serialize and then deserialize original DataPart class.
|
||||||
struct RangesInDataPartDescription
|
struct RangesInDataPartDescription
|
||||||
{
|
{
|
||||||
MergeTreePartInfo info;
|
MergeTreePartInfo info{};
|
||||||
MarkRanges ranges;
|
MarkRanges ranges{};
|
||||||
size_t rows = 0;
|
size_t rows = 0;
|
||||||
|
|
||||||
void serialize(WriteBuffer & out) const;
|
void serialize(WriteBuffer & out) const;
|
||||||
|
@ -25,7 +25,7 @@ namespace ErrorCodes
|
|||||||
extern const int ACCESS_DENIED;
|
extern const int ACCESS_DENIED;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FunctionOrigin : Int8
|
enum class FunctionOrigin : int8_t
|
||||||
{
|
{
|
||||||
SYSTEM = 0,
|
SYSTEM = 0,
|
||||||
SQL_USER_DEFINED = 1,
|
SQL_USER_DEFINED = 1,
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
#include <DataTypes/DataTypeDateTime.h>
|
#include <DataTypes/DataTypeDateTime.h>
|
||||||
#include <DataTypes/DataTypesNumber.h>
|
|
||||||
#include <DataTypes/DataTypeTuple.h>
|
#include <DataTypes/DataTypeTuple.h>
|
||||||
#include <Functions/FunctionFactory.h>
|
|
||||||
#include <Functions/FunctionsTimeWindow.h>
|
#include <Functions/FunctionsTimeWindow.h>
|
||||||
#include <Interpreters/addMissingDefaults.h>
|
#include <Interpreters/addMissingDefaults.h>
|
||||||
#include <Interpreters/AddDefaultDatabaseVisitor.h>
|
#include <Interpreters/AddDefaultDatabaseVisitor.h>
|
||||||
@ -15,7 +13,6 @@
|
|||||||
#include <Interpreters/InterpreterDropQuery.h>
|
#include <Interpreters/InterpreterDropQuery.h>
|
||||||
#include <Interpreters/InterpreterSelectQuery.h>
|
#include <Interpreters/InterpreterSelectQuery.h>
|
||||||
#include <Interpreters/ProcessList.h>
|
#include <Interpreters/ProcessList.h>
|
||||||
#include <Interpreters/QueryAliasesVisitor.h>
|
|
||||||
#include <Interpreters/QueryNormalizer.h>
|
#include <Interpreters/QueryNormalizer.h>
|
||||||
#include <Interpreters/getTableExpressions.h>
|
#include <Interpreters/getTableExpressions.h>
|
||||||
#include <Interpreters/getHeaderForProcessingStage.h>
|
#include <Interpreters/getHeaderForProcessingStage.h>
|
||||||
@ -30,7 +27,6 @@
|
|||||||
#include <Parsers/ASTTablesInSelectQuery.h>
|
#include <Parsers/ASTTablesInSelectQuery.h>
|
||||||
#include <Parsers/ASTColumnDeclaration.h>
|
#include <Parsers/ASTColumnDeclaration.h>
|
||||||
#include <Parsers/ASTWatchQuery.h>
|
#include <Parsers/ASTWatchQuery.h>
|
||||||
#include <Parsers/parseQuery.h>
|
|
||||||
#include <Parsers/formatAST.h>
|
#include <Parsers/formatAST.h>
|
||||||
#include <Processors/Executors/CompletedPipelineExecutor.h>
|
#include <Processors/Executors/CompletedPipelineExecutor.h>
|
||||||
#include <Processors/Sources/BlocksSource.h>
|
#include <Processors/Sources/BlocksSource.h>
|
||||||
@ -51,16 +47,13 @@
|
|||||||
#include <Storages/StorageFactory.h>
|
#include <Storages/StorageFactory.h>
|
||||||
#include <Common/typeid_cast.h>
|
#include <Common/typeid_cast.h>
|
||||||
#include <Common/ProfileEvents.h>
|
#include <Common/ProfileEvents.h>
|
||||||
#include <base/sleep.h>
|
|
||||||
#include <Common/logger_useful.h>
|
#include <Common/logger_useful.h>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
|
||||||
#include <Storages/LiveView/StorageBlocks.h>
|
#include <Storages/LiveView/StorageBlocks.h>
|
||||||
|
|
||||||
#include <Storages/WindowView/StorageWindowView.h>
|
#include <Storages/WindowView/StorageWindowView.h>
|
||||||
#include <Storages/WindowView/WindowViewSource.h>
|
#include <Storages/WindowView/WindowViewSource.h>
|
||||||
|
|
||||||
#include <QueryPipeline/printPipeline.h>
|
|
||||||
#include <QueryPipeline/QueryPipelineBuilder.h>
|
#include <QueryPipeline/QueryPipelineBuilder.h>
|
||||||
|
|
||||||
|
|
||||||
@ -285,13 +278,13 @@ namespace
|
|||||||
{
|
{
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by windows yet");
|
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by windows yet");
|
||||||
#define CASE_WINDOW_KIND(KIND) \
|
#define CASE_WINDOW_KIND(KIND) \
|
||||||
case IntervalKind::KIND: { \
|
case IntervalKind::Kind::KIND: { \
|
||||||
return AddTime<IntervalKind::KIND>::execute(time_sec, num_units, time_zone); \
|
return AddTime<IntervalKind::Kind::KIND>::execute(time_sec, num_units, time_zone); \
|
||||||
}
|
}
|
||||||
CASE_WINDOW_KIND(Second)
|
CASE_WINDOW_KIND(Second)
|
||||||
CASE_WINDOW_KIND(Minute)
|
CASE_WINDOW_KIND(Minute)
|
||||||
@ -875,20 +868,20 @@ UInt32 StorageWindowView::getWindowLowerBound(UInt32 time_sec)
|
|||||||
{
|
{
|
||||||
switch (slide_kind)
|
switch (slide_kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by windows yet");
|
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by windows yet");
|
||||||
#define CASE_WINDOW_KIND(KIND) \
|
#define CASE_WINDOW_KIND(KIND) \
|
||||||
case IntervalKind::KIND: \
|
case IntervalKind::Kind::KIND: \
|
||||||
{ \
|
{ \
|
||||||
if (is_tumble) \
|
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 \
|
else \
|
||||||
{\
|
{\
|
||||||
UInt32 w_start = ToStartOfTransform<IntervalKind::KIND>::execute(time_sec, hop_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>::execute(w_start, hop_num_units, *time_zone);\
|
UInt32 w_end = AddTime<IntervalKind::Kind::KIND>::execute(w_start, hop_num_units, *time_zone);\
|
||||||
return AddTime<IntervalKind::KIND>::execute(w_end, -window_num_units, *time_zone);\
|
return AddTime<IntervalKind::Kind::KIND>::execute(w_end, -window_num_units, *time_zone);\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
CASE_WINDOW_KIND(Second)
|
CASE_WINDOW_KIND(Second)
|
||||||
@ -908,16 +901,16 @@ UInt32 StorageWindowView::getWindowUpperBound(UInt32 time_sec)
|
|||||||
{
|
{
|
||||||
switch (slide_kind)
|
switch (slide_kind)
|
||||||
{
|
{
|
||||||
case IntervalKind::Nanosecond:
|
case IntervalKind::Kind::Nanosecond:
|
||||||
case IntervalKind::Microsecond:
|
case IntervalKind::Kind::Microsecond:
|
||||||
case IntervalKind::Millisecond:
|
case IntervalKind::Kind::Millisecond:
|
||||||
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by window view yet");
|
throw Exception(ErrorCodes::SYNTAX_ERROR, "Fractional seconds are not supported by window view yet");
|
||||||
|
|
||||||
#define CASE_WINDOW_KIND(KIND) \
|
#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); \
|
UInt32 w_start = ToStartOfTransform<IntervalKind::Kind::KIND>::execute(time_sec, slide_num_units, *time_zone); \
|
||||||
return AddTime<IntervalKind::KIND>::execute(w_start, 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(Second)
|
||||||
CASE_WINDOW_KIND(Minute)
|
CASE_WINDOW_KIND(Minute)
|
||||||
@ -1041,7 +1034,7 @@ void StorageWindowView::threadFuncFireProc()
|
|||||||
max_fired_watermark = next_fire_signal;
|
max_fired_watermark = next_fire_signal;
|
||||||
auto slide_interval = addTime(0, slide_kind, slide_num_units, *time_zone);
|
auto slide_interval = addTime(0, slide_kind, slide_num_units, *time_zone);
|
||||||
/// Convert DayNum into seconds when the slide interval is larger than Day
|
/// 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;
|
slide_interval *= 86400;
|
||||||
next_fire_signal += slide_interval;
|
next_fire_signal += slide_interval;
|
||||||
}
|
}
|
||||||
@ -1360,7 +1353,7 @@ void StorageWindowView::eventTimeParser(const ASTCreateQuery & query)
|
|||||||
if (query.is_watermark_ascending)
|
if (query.is_watermark_ascending)
|
||||||
{
|
{
|
||||||
is_watermark_bounded = true;
|
is_watermark_bounded = true;
|
||||||
watermark_kind = IntervalKind::Second;
|
watermark_kind = IntervalKind::Kind::Second;
|
||||||
watermark_num_units = 1;
|
watermark_num_units = 1;
|
||||||
}
|
}
|
||||||
else if (query.is_watermark_bounded)
|
else if (query.is_watermark_bounded)
|
||||||
|
Loading…
Reference in New Issue
Block a user