mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
additional checks for empty tz for toStartOfMonth|Quarter|Year
This commit is contained in:
parent
8fd00ff77b
commit
25080f3a88
@ -54,7 +54,12 @@ std::string extractTimeZoneNameFromFunctionArguments(const ColumnsWithTypeAndNam
|
|||||||
const DateLUTImpl & extractTimeZoneFromFunctionArguments(Block & block, const ColumnNumbers & arguments, size_t time_zone_arg_num, size_t datetime_arg_num)
|
const DateLUTImpl & extractTimeZoneFromFunctionArguments(Block & block, const ColumnNumbers & arguments, size_t time_zone_arg_num, size_t datetime_arg_num)
|
||||||
{
|
{
|
||||||
if (arguments.size() == time_zone_arg_num + 1)
|
if (arguments.size() == time_zone_arg_num + 1)
|
||||||
return DateLUT::instance(extractTimeZoneNameFromColumn(*block.getByPosition(arguments[time_zone_arg_num]).column));
|
{
|
||||||
|
std::string time_zone = extractTimeZoneNameFromColumn(*block.getByPosition(arguments[time_zone_arg_num]).column);
|
||||||
|
if (time_zone.empty())
|
||||||
|
throw Exception("Provided time zone must be non-empty and be a valid time zone", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||||
|
return DateLUT::instance(time_zone);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (arguments.empty())
|
if (arguments.empty())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
2017-12-31 00:00:00
|
2017-12-31 00:00:00
|
||||||
2017-12-01
|
2017-12-01
|
||||||
2017-10-01
|
2017-10-01
|
||||||
|
2017-01-01
|
||||||
2017-12-31 05:10:00
|
2017-12-31 05:10:00
|
||||||
2017-12-31 01:15:00
|
2017-12-31 01:15:00
|
||||||
2017-12-31 01:00:00
|
2017-12-31 01:00:00
|
||||||
|
@ -7,6 +7,9 @@ SELECT toStartOfMonth(toDateTime('2017-12-31 00:00:00', 'UTC'), 'UTC'); -- succe
|
|||||||
SELECT toStartOfQuarter(toDateTime('2017-12-31 00:00:00', 'UTC'), ''); -- {serverError 43}
|
SELECT toStartOfQuarter(toDateTime('2017-12-31 00:00:00', 'UTC'), ''); -- {serverError 43}
|
||||||
SELECT toStartOfQuarter(toDateTime('2017-12-31 00:00:00', 'UTC'), 'UTC'); -- success
|
SELECT toStartOfQuarter(toDateTime('2017-12-31 00:00:00', 'UTC'), 'UTC'); -- success
|
||||||
|
|
||||||
|
SELECT toStartOfYear(toDateTime('2017-12-31 00:00:00', 'UTC'), ''); -- {serverError 43}
|
||||||
|
SELECT toStartOfYear(toDateTime('2017-12-31 00:00:00', 'UTC'), 'UTC'); -- success
|
||||||
|
|
||||||
SELECT toStartOfTenMinutes(toDateTime('2017-12-31 00:00:00', 'UTC'), ''); -- {serverError 43}
|
SELECT toStartOfTenMinutes(toDateTime('2017-12-31 00:00:00', 'UTC'), ''); -- {serverError 43}
|
||||||
SELECT toStartOfTenMinutes(toDateTime('2017-12-31 05:12:30', 'UTC'), 'UTC'); -- success
|
SELECT toStartOfTenMinutes(toDateTime('2017-12-31 05:12:30', 'UTC'), 'UTC'); -- success
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user