Added test for enhanced time zones support [#CLICKHOUSE-3402].

This commit is contained in:
Alexey Milovidov 2017-11-06 03:21:35 +03:00 committed by alexey-milovidov
parent 60477a9aaa
commit 2d1702f8e6
3 changed files with 41 additions and 0 deletions

View File

@ -20,6 +20,7 @@ static std::string extractTimeZoneNameFromColumn(const IColumn & column)
std::string extractTimeZoneNameFromFunctionArguments(const ColumnsWithTypeAndName & arguments, size_t time_zone_arg_num)
{
/// Explicit time zone may be passed in last argument.
if (arguments.size() == time_zone_arg_num + 1)
{
return extractTimeZoneNameFromColumn(*arguments[time_zone_arg_num].column);

View File

@ -0,0 +1,18 @@
2017-12-05 10:37:47
2017-12-05 10:37:47
2017-12-05 10:37:47
2017-12-05 08:07:47
2017-12-05 08:07:47
2017-12-05 08:07:47
2017-12-05 08:07:47
2017-10-05 08:07:47
2017-10-05 08:07:47
2017-10-05 08:07:47
2017-10-05 08:07:47
1509858467
1509858467
2017-11-05 08:07:47
2017-11-05 10:37:47
2017-11-05 08:07:47
2017-11-05 10:37:47
2017-11-05 10:37:47

View File

@ -0,0 +1,22 @@
SELECT addMonths(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 1, 'Asia/Kolkata');
SELECT addMonths(toDateTime('2017-11-05 10:37:47', 'Asia/Kolkata'), 1);
SELECT addMonths(toTimeZone(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata'), 1);
SELECT addMonths(toDateTime('2017-11-05 08:07:47'), 1);
SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), 1);
SELECT addMonths(toDateTime('2017-11-05 08:07:47'), materialize(1));
SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), materialize(1));
SELECT addMonths(toDateTime('2017-11-05 08:07:47'), -1);
SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), -1);
SELECT addMonths(toDateTime('2017-11-05 08:07:47'), materialize(-1));
SELECT addMonths(materialize(toDateTime('2017-11-05 08:07:47')), materialize(-1));
SELECT toUnixTimestamp('2017-11-05 08:07:47', 'Europe/Moscow');
SELECT toUnixTimestamp(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Europe/Moscow');
SELECT toDateTime('2017-11-05 08:07:47', 'Europe/Moscow');
SELECT toTimeZone(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata');
SELECT toString(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'));
SELECT toString(toTimeZone(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata'));
SELECT toString(toDateTime('2017-11-05 08:07:47', 'Europe/Moscow'), 'Asia/Kolkata');