mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
Add narrowing for toStartOfISOYear; improve 02403_enable_extended_results_for_datetime_functions
This commit is contained in:
parent
5c242de43a
commit
7e733887b9
@ -931,7 +931,7 @@ struct ToStartOfISOYearImpl
|
||||
|
||||
static inline UInt16 execute(Int64 t, const DateLUTImpl & time_zone)
|
||||
{
|
||||
return time_zone.toFirstDayNumOfISOYear(time_zone.toDayNum(t));
|
||||
return t < 0 ? 0 : time_zone.toFirstDayNumOfISOYear(ExtendedDayNum(std::min(Int32(time_zone.toDayNum(t)), Int32(DATE_LUT_MAX_DAY_NUM))));
|
||||
}
|
||||
static inline UInt16 execute(UInt32 t, const DateLUTImpl & time_zone)
|
||||
{
|
||||
@ -939,7 +939,7 @@ struct ToStartOfISOYearImpl
|
||||
}
|
||||
static inline UInt16 execute(Int32 d, const DateLUTImpl & time_zone)
|
||||
{
|
||||
return time_zone.toFirstDayNumOfISOYear(ExtendedDayNum(d));
|
||||
return d < 0 ? 0 : time_zone.toFirstDayNumOfISOYear(ExtendedDayNum(std::min(d, Int32(DATE_LUT_MAX_DAY_NUM))));
|
||||
}
|
||||
static inline UInt16 execute(UInt16 d, const DateLUTImpl & time_zone)
|
||||
{
|
||||
|
@ -109,10 +109,10 @@
|
||||
-------toStartOfFifteenMinutes---------
|
||||
-------toStartOfHour---------
|
||||
-------toStartOfISOYear---------
|
||||
2079-06-07
|
||||
2079-06-07
|
||||
2119-07-29
|
||||
2119-07-29
|
||||
1970-01-01
|
||||
1970-01-01
|
||||
2148-12-30
|
||||
2148-12-30
|
||||
2021-01-04
|
||||
-------toRelativeYearNum---------
|
||||
1900
|
||||
|
@ -1,56 +1,56 @@
|
||||
1950-01-01
|
||||
Date32
|
||||
1950-01-01
|
||||
Date32
|
||||
1950-01-02
|
||||
Date32
|
||||
1950-01-02
|
||||
Date32
|
||||
1950-01-01
|
||||
Date32
|
||||
1950-01-01
|
||||
Date32
|
||||
1950-02-01
|
||||
Date32
|
||||
1950-02-01
|
||||
Date32
|
||||
1950-01-29
|
||||
Date32
|
||||
1950-01-29
|
||||
Date32
|
||||
1950-01-30
|
||||
Date32
|
||||
1950-01-30
|
||||
Date32
|
||||
1950-02-28
|
||||
Date32
|
||||
1950-02-28
|
||||
Date32
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
2129-06-08
|
||||
Date
|
||||
2129-06-08
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
1970-01-01
|
||||
Date
|
||||
toStartOfYear;toDate32;true 1920-01-01
|
||||
type;toStartOfYear;toDate32;true Date32
|
||||
toStartOfYear;toDateTime64;true 1920-01-01
|
||||
type;toStartOfYear;toDateTime64;true Date32
|
||||
toStartOfISOYear;toDate32;true 1919-12-29
|
||||
type;toStartOfISOYear;toDate32;true Date32
|
||||
toStartOfISOYear;toDateTime64;true 1919-12-29
|
||||
type;toStartOfISOYear;toDateTime64;true Date32
|
||||
toStartOfQuarter;toDate32;true 1920-01-01
|
||||
type;toStartOfQuarter;toDate32;true Date32
|
||||
toStartOfQuarter;toDateTime64;true 1920-01-01
|
||||
type;toStartOfQuarter;toDateTime64;true Date32
|
||||
toStartOfMonth;toDate32;true 1920-02-01
|
||||
type;toStartOfMonth;toDate32;true Date32
|
||||
toStartOfMonth;toDateTime64;true 1920-02-01
|
||||
type;toStartOfMonth;toDateTime64;true Date32
|
||||
toStartOfWeek;toDate32;true 1920-02-01
|
||||
type;toStartOfWeek;toDate32;true Date32
|
||||
toStartOfWeek;toDateTime64;true 1920-02-01
|
||||
type;toStartOfWeek;toDateTime64;true Date32
|
||||
toMonday;toDate32;true 1920-02-02
|
||||
type;toMonday;toDate32;true Date32
|
||||
toMonday;toDateTime64;true 1920-02-02
|
||||
type;toMonday;toDateTime64;true Date32
|
||||
toLastDayOfMonth;toDate32;true 1920-02-29
|
||||
type;toLastDayOfMonth;toDate32;true Date32
|
||||
toLastDayOfMonth;toDateTime64;true 1920-02-29
|
||||
type;toLastDayOfMonth;toDateTime64;true Date32
|
||||
toStartOfYear;toDate32;false 1970-01-01
|
||||
type;toStartOfYear;toDate32;false Date
|
||||
toStartOfYear;toDateTime64;false 1970-01-01
|
||||
type;toStartOfYear;toDateTime64;false Date
|
||||
toStartOfISOYear;toDate32;false 1970-01-01
|
||||
type;toStartOfISOYear;toDate32;false Date
|
||||
toStartOfISOYear;toDateTime64;false 1970-01-01
|
||||
type;toStartOfISOYear;toDateTime64;false Date
|
||||
toStartOfQuarter;toDate32;false 1970-01-01
|
||||
type;toStartOfQuarter;toDate32;false Date
|
||||
toStartOfQuarter;toDateTime64;false 1970-01-01
|
||||
type;toStartOfQuarter;toDateTime64;false Date
|
||||
toStartOfMonth;toDate32;false 1970-01-01
|
||||
type;toStartOfMonth;toDate32;false Date
|
||||
toStartOfMonth;toDateTime64;false 1970-01-01
|
||||
type;toStartOfMonth;toDateTime64;false Date
|
||||
toStartOfWeek;toDate32;false 1970-01-01
|
||||
type;toStartOfWeek;toDate32;false Date
|
||||
toStartOfWeek;toDateTime64;false 1970-01-01
|
||||
type;toStartOfWeek;toDateTime64;false Date
|
||||
toMonday;toDate32;false 1970-01-01
|
||||
type;toMonday;toDate32;false Date
|
||||
toMonday;toDateTime64;false 1970-01-01
|
||||
type;toMonday;toDateTime64;false Date
|
||||
toLastDayOfMonth;toDate32;false 1970-01-01
|
||||
type;toLastDayOfMonth;toDate32;false Date
|
||||
toLastDayOfMonth;toDateTime64;false 1970-01-01
|
||||
type;toLastDayOfMonth;toDateTime64;false Date
|
||||
|
@ -1,8 +1,9 @@
|
||||
{% for option_value in ['true', 'false'] -%}
|
||||
{% for date_fun in ['toStartOfYear', 'toStartOfISOYear', 'toStartOfQuarter', 'toStartOfMonth', 'toStartOfWeek', 'toMonday', 'toLastDayOfMonth'] -%}
|
||||
SELECT {{ date_fun }}(toDate32('1950-02-02')) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT toTypeName({{ date_fun }}(toDate32('1950-02-02'))) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT {{ date_fun }}(toDateTime64('1950-02-02 10:20:30', 3)) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT toTypeName({{ date_fun }}(toDateTime64('1950-02-02 10:20:30', 3))) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT '{{ date_fun }};toDate32;{{ option_value }}', {{ date_fun }}(toDate32('1920-02-02')) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT 'type;{{ date_fun }};toDate32;{{ option_value }}', toTypeName({{ date_fun }}(toDate32('1920-02-02'))) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT '{{ date_fun }};toDateTime64;{{ option_value }}', {{ date_fun }}(toDateTime64('1920-02-02 10:20:30', 3)) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
SELECT 'type;{{ date_fun }};toDateTime64;{{ option_value }}', toTypeName({{ date_fun }}(toDateTime64('1920-02-02 10:20:30', 3))) SETTINGS enable_extended_results_for_datetime_functions = {{ option_value }};
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user