Function toStartOfDay() now can receive a date.

This commit is contained in:
Vitaly Baranov 2019-02-12 17:18:00 +03:00
parent 0b084ba531
commit 83d461975e
5 changed files with 171 additions and 23 deletions

View File

@ -65,9 +65,9 @@ struct ToStartOfDayImpl
{
return time_zone.toDate(t);
}
static inline UInt32 execute(UInt16, const DateLUTImpl &)
static inline UInt32 execute(UInt16 d, const DateLUTImpl & time_zone)
{
return dateIsNotSupported(name);
return time_zone.toDate(DayNum(d));
}
using FactorTransform = ZeroTransform;

View File

@ -37,23 +37,33 @@ public:
if (arguments.size() == 1)
{
if (!isDateOrDateTime(arguments[0].type))
throw Exception("Illegal type " + arguments[0].type->getName() + " of argument of function " + getName() +
". Should be a date or a date with time", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
throw Exception(
"Illegal type " + arguments[0].type->getName() + " of argument of function " + getName()
+ ". Should be a date or a date with time",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
}
else if (arguments.size() == 2)
{
if (!WhichDataType(arguments[0].type).isDateTime()
|| !WhichDataType(arguments[1].type).isString())
if (!isDateOrDateTime(arguments[0].type))
throw Exception(
"Illegal type " + arguments[0].type->getName() + " of argument of function " + getName()
+ ". Should be a date or a date with time",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
if (!isString(arguments[1].type))
throw Exception(
"Function " + getName() + " supports 1 or 2 arguments. The 1st argument "
"must be of type Date or DateTime. The 2nd argument (optional) must be "
"a constant string with timezone name. The timezone argument is allowed "
"only when the 1st argument has the type DateTime",
"must be of type Date or DateTime. The 2nd argument (optional) must be "
"a constant string with timezone name",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
if (isDate(arguments[0].type) && std::is_same_v<ToDataType, DataTypeDate>)
throw Exception(
"The timezone argument of function " + getName() + " is allowed only when the 1st argument has the type DateTime",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
}
else
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
+ toString(arguments.size()) + ", should be 1 or 2",
throw Exception(
"Number of arguments for function " + getName() + " doesn't match: passed " + toString(arguments.size())
+ ", should be 1 or 2",
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
/// For DateTime, if time zone is specified, attach it to type.

View File

@ -142,41 +142,54 @@ public:
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
auto check_date_time_argument = [&] {
bool first_argument_is_date = false;
auto check_first_argument = [&]
{
if (!isDateOrDateTime(arguments[0].type))
throw Exception(
"Illegal type " + arguments[0].type->getName() + " of argument of function " + getName()
+ ". Should be a date or a date with time",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
first_argument_is_date = isDate(arguments[0].type);
};
const DataTypeInterval * interval_type = nullptr;
auto check_interval_argument = [&] {
bool result_type_is_date = false;
auto check_interval_argument = [&]
{
interval_type = checkAndGetDataType<DataTypeInterval>(arguments[1].type.get());
if (!interval_type)
throw Exception(
"Illegal type " + arguments[1].type->getName() + " of argument of function " + getName()
+ ". Should be an interval of time",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
result_type_is_date = (interval_type->getKind() == DataTypeInterval::Year)
|| (interval_type->getKind() == DataTypeInterval::Quarter) || (interval_type->getKind() == DataTypeInterval::Month)
|| (interval_type->getKind() == DataTypeInterval::Week);
};
auto check_timezone_argument = [&] {
auto check_timezone_argument = [&]
{
if (!WhichDataType(arguments[2].type).isString())
throw Exception(
"Illegal type " + arguments[2].type->getName() + " of argument of function " + getName()
+ ". This argument is optional and must be a constant string with timezone name"
". This argument is allowed only when the 1st argument has the type DateTime",
+ ". This argument is optional and must be a constant string with timezone name",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
if (first_argument_is_date && result_type_is_date)
throw Exception(
"The timezone argument of function " + getName() + " with interval type " + interval_type->kindToString()
+ " is allowed only when the 1st argument has the type DateTime",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
};
if (arguments.size() == 2)
{
check_date_time_argument();
check_first_argument();
check_interval_argument();
}
else if (arguments.size() == 3)
{
check_date_time_argument();
check_first_argument();
check_interval_argument();
check_timezone_argument();
}
@ -188,11 +201,10 @@ public:
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
}
if ((interval_type->getKind() == DataTypeInterval::Second) || (interval_type->getKind() == DataTypeInterval::Minute)
|| (interval_type->getKind() == DataTypeInterval::Hour) || (interval_type->getKind() == DataTypeInterval::Day))
return std::make_shared<DataTypeDateTime>(extractTimeZoneNameFromFunctionArguments(arguments, 2, 0));
else
if (result_type_is_date)
return std::make_shared<DataTypeDate>();
else
return std::make_shared<DataTypeDateTime>(extractTimeZoneNameFromFunctionArguments(arguments, 2, 0));
}
bool useDefaultImplementationForConstants() const override { return true; }

View File

@ -1,88 +1,137 @@
toStartOfDay
2014-09-30 00:00:00
2014-09-30 00:00:00
2014-09-30 00:00:00
2014-10-01 00:00:00
2014-09-30 00:00:00
2014-09-30 00:00:00
2014-09-30 00:00:00
2014-09-30 00:00:00
2014-09-30 00:00:00
2014-09-30 00:00:00
toMonday
2014-12-29
2014-12-22
2014-12-22
2014-12-29
2014-12-22
2014-12-29
2014-12-29
2014-12-29
2014-12-29
2014-12-29
toStartOfMonth
2014-12-01
2014-12-01
2014-12-01
2014-12-01
2014-12-01
2014-12-01
2014-12-01
2014-12-01
2014-12-01
2014-12-01
toStartOfQuarter
2014-07-01
2014-07-01
2014-07-01
2014-10-01
2014-07-01
2014-07-01
2014-07-01
2014-07-01
2014-07-01
2014-07-01
toStartOfYear
2014-01-01
2014-01-01
2014-01-01
2014-01-01
2014-01-01
2014-01-01
2014-01-01
2014-01-01
2014-01-01
2014-01-01
toTime
1970-01-02 12:00:00 1970-01-02 12:00:00
1970-01-02 10:00:00 1970-01-02 11:00:00
1970-01-02 09:00:00 1970-01-02 10:00:00
1970-01-02 18:00:00 1970-01-02 18:00:00
1970-01-02 01:00:00 1970-01-02 01:00:00
toYear
2014
2014
2014
2014
2014
toMonth
9
9
9
10
9
toDayOfMonth
30
30
30
1
30
toDayOfWeek
2
2
2
3
2
toHour
23
21
20
4
11
toMinute
50
50
50
50
50
toSecond
0
0
0
0
0
toStartOfMinute
2019-02-06 22:57:00
2019-02-06 20:57:00
2019-02-06 19:57:00
2019-02-07 04:57:00
2019-02-06 11:57:00
toStartOfFiveMinute
2019-02-06 22:55:00
2019-02-06 20:55:00
2019-02-06 19:55:00
2019-02-07 04:55:00
2019-02-06 11:55:00
toStartOfTenMinutes
2019-02-06 22:50:00
2019-02-06 20:50:00
2019-02-06 19:50:00
2019-02-07 04:50:00
2019-02-06 11:50:00
toStartOfFifteenMinutes
2019-02-06 22:45:00
2019-02-06 20:45:00
2019-02-06 19:45:00
2019-02-07 04:45:00
2019-02-06 11:45:00
toStartOfHour
2019-02-06 22:00:00
2019-02-06 20:00:00
2019-02-06 19:00:00
2019-02-07 04:00:00
2019-02-06 11:00:00
toStartOfInterval
2019-01-01
2018-01-01
2015-01-01
@ -125,40 +174,48 @@
2019-02-06 00:00:00
2019-02-05 00:00:00
2019-02-03 00:00:00
toRelativeYearNum
44
44
44
44
44
toRelativeMonthNum
536
536
536
537
536
toRelativeWeekNum
2335
2335
2335
2335
2335
toRelativeDayNum
16343
16343
16343
16344
16343
toRelativeHourNum
392251
392251
392251
392251
toRelativeMinuteNum
23535110
23535110
23535110
23535110
23535110
toRelativeSecondNum
1412106600
1412106600
1412106600
1412106600
1412106600
toDate
2014-09-30
2014-09-30
2014-09-30
@ -169,11 +226,13 @@
2014-09-30
2014-10-01
2014-09-30
toString
2015-07-15 13:30:00
2015-07-15 12:30:00
2015-07-15 11:30:00
2015-07-15 19:30:00
2015-07-15 02:30:00
toUnixTimestamp
1426415400
1426422600
1426426200

View File

@ -5,41 +5,84 @@
/* timestamp 1428310800 == 2015-04-06 12:00:00 (Europe/Moscow) */
/* timestamp 1436956200 == 2015-07-15 13:30:00 (Europe/Moscow) */
/* timestamp 1426415400 == 2015-03-15 13:30:00 (Europe/Moscow) */
/* timestamp 1549483055 == 2019-02-06 22:57:35 (Europe/Moscow) */
/* date 16343 == 2014-09-30 */
/* date 16433 == 2014-12-29 */
/* date 17933 == 2019-02-06 */
/* toStartOfDay */
SELECT 'toStartOfDay';
SELECT toStartOfDay(toDateTime(1412106600), 'Europe/Moscow');
SELECT toStartOfDay(toDateTime(1412106600), 'Europe/Paris');
SELECT toStartOfDay(toDateTime(1412106600), 'Europe/London');
SELECT toStartOfDay(toDateTime(1412106600), 'Asia/Tokyo');
SELECT toStartOfDay(toDateTime(1412106600), 'Pacific/Pitcairn');
SELECT toStartOfDay(toDate(16343), 'Europe/Moscow');
SELECT toStartOfDay(toDate(16343), 'Europe/Paris');
SELECT toStartOfDay(toDate(16343), 'Europe/London');
SELECT toStartOfDay(toDate(16343), 'Asia/Tokyo');
SELECT toStartOfDay(toDate(16343), 'Pacific/Pitcairn');
/* toMonday */
SELECT 'toMonday';
SELECT toMonday(toDateTime(1419800400), 'Europe/Moscow');
SELECT toMonday(toDateTime(1419800400), 'Europe/Paris');
SELECT toMonday(toDateTime(1419800400), 'Europe/London');
SELECT toMonday(toDateTime(1419800400), 'Asia/Tokyo');
SELECT toMonday(toDateTime(1419800400), 'Pacific/Pitcairn');
SELECT toMonday(toDate(16433));
SELECT toMonday(toDate(16433));
SELECT toMonday(toDate(16433));
SELECT toMonday(toDate(16433));
SELECT toMonday(toDate(16433));
/* toStartOfMonth */
SELECT 'toStartOfMonth';
SELECT toStartOfMonth(toDateTime(1419800400), 'Europe/Moscow');
SELECT toStartOfMonth(toDateTime(1419800400), 'Europe/Paris');
SELECT toStartOfMonth(toDateTime(1419800400), 'Europe/London');
SELECT toStartOfMonth(toDateTime(1419800400), 'Asia/Tokyo');
SELECT toStartOfMonth(toDateTime(1419800400), 'Pacific/Pitcairn');
SELECT toStartOfMonth(toDate(16433));
SELECT toStartOfMonth(toDate(16433));
SELECT toStartOfMonth(toDate(16433));
SELECT toStartOfMonth(toDate(16433));
SELECT toStartOfMonth(toDate(16433));
/* toStartOfQuarter */
SELECT 'toStartOfQuarter';
SELECT toStartOfQuarter(toDateTime(1412106600), 'Europe/Moscow');
SELECT toStartOfQuarter(toDateTime(1412106600), 'Europe/Paris');
SELECT toStartOfQuarter(toDateTime(1412106600), 'Europe/London');
SELECT toStartOfQuarter(toDateTime(1412106600), 'Asia/Tokyo');
SELECT toStartOfQuarter(toDateTime(1412106600), 'Pacific/Pitcairn');
SELECT toStartOfQuarter(toDate(16343));
SELECT toStartOfQuarter(toDate(16343));
SELECT toStartOfQuarter(toDate(16343));
SELECT toStartOfQuarter(toDate(16343));
SELECT toStartOfQuarter(toDate(16343));
/* toStartOfYear */
SELECT 'toStartOfYear';
SELECT toStartOfYear(toDateTime(1419800400), 'Europe/Moscow');
SELECT toStartOfYear(toDateTime(1419800400), 'Europe/Paris');
SELECT toStartOfYear(toDateTime(1419800400), 'Europe/London');
SELECT toStartOfYear(toDateTime(1419800400), 'Asia/Tokyo');
SELECT toStartOfYear(toDateTime(1419800400), 'Pacific/Pitcairn');
SELECT toStartOfYear(toDate(16433));
SELECT toStartOfYear(toDate(16433));
SELECT toStartOfYear(toDate(16433));
SELECT toStartOfYear(toDate(16433));
SELECT toStartOfYear(toDate(16433));
/* toTime */
SELECT 'toTime';
SELECT toString(toTime(toDateTime(1420102800), 'Europe/Moscow'), 'Europe/Moscow'), toString(toTime(toDateTime(1428310800), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toString(toTime(toDateTime(1420102800), 'Europe/Paris'), 'Europe/Paris'), toString(toTime(toDateTime(1428310800), 'Europe/Paris'), 'Europe/Paris');
SELECT toString(toTime(toDateTime(1420102800), 'Europe/London'), 'Europe/London'), toString(toTime(toDateTime(1428310800), 'Europe/London'), 'Europe/London');
@ -48,6 +91,7 @@ SELECT toString(toTime(toDateTime(1420102800), 'Pacific/Pitcairn'), 'Pacific/Pit
/* toYear */
SELECT 'toYear';
SELECT toYear(toDateTime(1412106600), 'Europe/Moscow');
SELECT toYear(toDateTime(1412106600), 'Europe/Paris');
SELECT toYear(toDateTime(1412106600), 'Europe/London');
@ -56,6 +100,7 @@ SELECT toYear(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toMonth */
SELECT 'toMonth';
SELECT toMonth(toDateTime(1412106600), 'Europe/Moscow');
SELECT toMonth(toDateTime(1412106600), 'Europe/Paris');
SELECT toMonth(toDateTime(1412106600), 'Europe/London');
@ -64,6 +109,7 @@ SELECT toMonth(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toDayOfMonth */
SELECT 'toDayOfMonth';
SELECT toDayOfMonth(toDateTime(1412106600), 'Europe/Moscow');
SELECT toDayOfMonth(toDateTime(1412106600), 'Europe/Paris');
SELECT toDayOfMonth(toDateTime(1412106600), 'Europe/London');
@ -72,6 +118,7 @@ SELECT toDayOfMonth(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toDayOfWeek */
SELECT 'toDayOfWeek';
SELECT toDayOfWeek(toDateTime(1412106600), 'Europe/Moscow');
SELECT toDayOfWeek(toDateTime(1412106600), 'Europe/Paris');
SELECT toDayOfWeek(toDateTime(1412106600), 'Europe/London');
@ -80,6 +127,7 @@ SELECT toDayOfWeek(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toHour */
SELECT 'toHour';
SELECT toHour(toDateTime(1412106600), 'Europe/Moscow');
SELECT toHour(toDateTime(1412106600), 'Europe/Paris');
SELECT toHour(toDateTime(1412106600), 'Europe/London');
@ -88,6 +136,7 @@ SELECT toHour(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toMinute */
SELECT 'toMinute';
SELECT toMinute(toDateTime(1412106600), 'Europe/Moscow');
SELECT toMinute(toDateTime(1412106600), 'Europe/Paris');
SELECT toMinute(toDateTime(1412106600), 'Europe/London');
@ -96,6 +145,7 @@ SELECT toMinute(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toSecond */
SELECT 'toSecond';
SELECT toSecond(toDateTime(1412106600), 'Europe/Moscow');
SELECT toSecond(toDateTime(1412106600), 'Europe/Paris');
SELECT toSecond(toDateTime(1412106600), 'Europe/London');
@ -104,6 +154,7 @@ SELECT toSecond(toDateTime(1412106600), 'Pacific/Pitcairn');
/* toStartOfMinute */
SELECT 'toStartOfMinute';
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
@ -112,6 +163,7 @@ SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pa
/* toStartOfFiveMinute */
SELECT 'toStartOfFiveMinute';
SELECT toString(toStartOfFiveMinute(toDateTime(1549483055), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toString(toStartOfFiveMinute(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
SELECT toString(toStartOfFiveMinute(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
@ -120,14 +172,16 @@ SELECT toString(toStartOfFiveMinute(toDateTime(1549483055), 'Pacific/Pitcairn'),
/* toStartOfTenMinutes */
SELECT 'toStartOfTenMinutes';
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo');
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
/* toStartOfTenMinutes */
/* toStartOfFifteenMinutes */
SELECT 'toStartOfFifteenMinutes';
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
@ -136,6 +190,7 @@ SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Pacific/Pitcair
/* toStartOfHour */
SELECT 'toStartOfHour';
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
@ -143,6 +198,8 @@ SELECT toString(toStartOfHour(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
/* toStartOfInterval */
SELECT 'toStartOfInterval';
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 1 year, 'Europe/Moscow');
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 2 year, 'Europe/Moscow');
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 5 year, 'Europe/Moscow');
@ -188,6 +245,7 @@ SELECT toString(toStartOfInterval(toDate(17933), INTERVAL 5 day, 'Europe/Moscow'
/* toRelativeYearNum */
SELECT 'toRelativeYearNum';
SELECT toRelativeYearNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeYearNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeYearNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeYearNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeYearNum(toDateTime(1412106600), 'Europe/London') - toRelativeYearNum(toDateTime(0), 'Europe/London');
@ -196,6 +254,7 @@ SELECT toRelativeYearNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativ
/* toRelativeMonthNum */
SELECT 'toRelativeMonthNum';
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeMonthNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeMonthNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Europe/London') - toRelativeMonthNum(toDateTime(0), 'Europe/London');
@ -204,6 +263,7 @@ SELECT toRelativeMonthNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelati
/* toRelativeWeekNum */
SELECT 'toRelativeWeekNum';
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeWeekNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeWeekNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Europe/London') - toRelativeWeekNum(toDateTime(0), 'Europe/London');
@ -212,6 +272,7 @@ SELECT toRelativeWeekNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativ
/* toRelativeDayNum */
SELECT 'toRelativeDayNum';
SELECT toRelativeDayNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeDayNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeDayNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeDayNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeDayNum(toDateTime(1412106600), 'Europe/London') - toRelativeDayNum(toDateTime(0), 'Europe/London');
@ -220,6 +281,7 @@ SELECT toRelativeDayNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelative
/* toRelativeHourNum */
SELECT 'toRelativeHourNum';
SELECT toRelativeHourNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeHourNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeHourNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeHourNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeHourNum(toDateTime(1412106600), 'Europe/London') - toRelativeHourNum(toDateTime(0), 'Europe/London');
@ -228,6 +290,7 @@ SELECT toRelativeHourNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeHourN
/* toRelativeMinuteNum */
SELECT 'toRelativeMinuteNum';
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeMinuteNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeMinuteNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Europe/London') - toRelativeMinuteNum(toDateTime(0), 'Europe/London');
@ -236,6 +299,7 @@ SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelat
/* toRelativeSecondNum */
SELECT 'toRelativeSecondNum';
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Europe/Moscow') - toRelativeSecondNum(toDateTime(0), 'Europe/Moscow');
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeSecondNum(toDateTime(0), 'Europe/Paris');
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Europe/London') - toRelativeSecondNum(toDateTime(0), 'Europe/London');
@ -244,6 +308,7 @@ SELECT toRelativeSecondNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelat
/* toDate */
SELECT 'toDate';
SELECT toDate(toDateTime(1412106600), 'Europe/Moscow');
SELECT toDate(toDateTime(1412106600), 'Europe/Paris');
SELECT toDate(toDateTime(1412106600), 'Europe/London');
@ -258,6 +323,7 @@ SELECT toDate(1412106600, 'Pacific/Pitcairn');
/* toString */
SELECT 'toString';
SELECT toString(toDateTime(1436956200), 'Europe/Moscow');
SELECT toString(toDateTime(1436956200), 'Europe/Paris');
SELECT toString(toDateTime(1436956200), 'Europe/London');
@ -266,6 +332,7 @@ SELECT toString(toDateTime(1436956200), 'Pacific/Pitcairn');
/* toUnixTimestamp */
SELECT 'toUnixTimestamp';
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Europe/Moscow'), 'Europe/Moscow');
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Europe/Moscow'), 'Europe/Paris');
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Europe/Moscow'), 'Europe/London');