diff options
author | avevad <avevad@yandex-team.com> | 2024-11-13 02:42:42 +0300 |
---|---|---|
committer | avevad <avevad@yandex-team.com> | 2024-11-13 02:52:02 +0300 |
commit | 1017fdddd5035f4b9e8a49328dd793625dd99f97 (patch) | |
tree | 26794fed86aeab8e9871e8e4419aee093f3261b7 /yql/essentials/udfs/common/datetime2/test/cases | |
parent | de501ac78131d9de78c5baf13288273a97a73b11 (diff) | |
download | ydb-1017fdddd5035f4b9e8a49328dd793625dd99f97.tar.gz |
YQL-17471 Add EndOf... functions in Datetime UDF
Add EndOf... functions in Datetime UDF
commit_hash:6ac57411cfaabbf9abb6bed20b0e52e0a88918d0
Diffstat (limited to 'yql/essentials/udfs/common/datetime2/test/cases')
5 files changed, 47 insertions, 5 deletions
diff --git a/yql/essentials/udfs/common/datetime2/test/cases/BlockStartOf.sql b/yql/essentials/udfs/common/datetime2/test/cases/BlockStartOf.sql index e531d6f1c8..915f8da347 100644 --- a/yql/essentials/udfs/common/datetime2/test/cases/BlockStartOf.sql +++ b/yql/essentials/udfs/common/datetime2/test/cases/BlockStartOf.sql @@ -24,7 +24,5 @@ select DateTime::StartOf(`tztimestamp`, Interval("PT15M")), DateTime::StartOf(`tztimestamp`, Interval("PT20S")), DateTime::StartOf(`tztimestamp`, Interval("PT7S")), - DateTime::TimeOfDay(`tztimestamp`), - - DateTime::EndOfMonth(`tztimestamp`), + DateTime::TimeOfDay(`tztimestamp`) from @t; diff --git a/yql/essentials/udfs/common/datetime2/test/cases/EndOf.in b/yql/essentials/udfs/common/datetime2/test/cases/EndOf.in new file mode 100644 index 0000000000..f482585e72 --- /dev/null +++ b/yql/essentials/udfs/common/datetime2/test/cases/EndOf.in @@ -0,0 +1,15 @@ +{ + "ftztimestamp"="1970-01-01T05:00:00.000000,Europe/Moscow" +}; +{ + "ftztimestamp"="2018-12-15T01:02:03.456789,Europe/Moscow" +}; +{ + "ftztimestamp"="2105-12-31T16:23:45.000000,GMT" +}; +{ + "ftztimestamp"="2106-01-01T01:00:00.000000,Europe/Moscow" +}; +{ + "ftztimestamp"="2019-07-24T12:00:00,Europe/Moscow" +}; diff --git a/yql/essentials/udfs/common/datetime2/test/cases/EndOf.in.attr b/yql/essentials/udfs/common/datetime2/test/cases/EndOf.in.attr new file mode 100644 index 0000000000..2cc4f8c0d6 --- /dev/null +++ b/yql/essentials/udfs/common/datetime2/test/cases/EndOf.in.attr @@ -0,0 +1,17 @@ +{ + "_yql_row_spec" = { + "Type" = [ + "StructType"; + [ + [ + "ftztimestamp"; + [ + "DataType"; + "String" + ] + ] + ] + ] + } +} + diff --git a/yql/essentials/udfs/common/datetime2/test/cases/EndOf.sql b/yql/essentials/udfs/common/datetime2/test/cases/EndOf.sql index 61b4a29e53..ee0eb55e6a 100644 --- a/yql/essentials/udfs/common/datetime2/test/cases/EndOf.sql +++ b/yql/essentials/udfs/common/datetime2/test/cases/EndOf.sql @@ -32,3 +32,16 @@ into result `Timestamp below minimum`; select $format(cast($tsAbove || ',Atlantic/Madeira' as TzTimestamp)) , $format(DateTime::EndOfMonth(cast($tsAbove || ',Atlantic/Madeira' as TzTimestamp))) into result `Timestamp above maximum`; + +select + $format(DateTime::EndOfYear(`tztimestamp`)), + $format(DateTime::EndOfQuarter(`tztimestamp`)), + $format(DateTime::EndOfMonth(`tztimestamp`)), + $format(DateTime::EndOfWeek(`tztimestamp`)), + $format(DateTime::EndOfDay(`tztimestamp`)), +from ( + select + cast(ftztimestamp as TzTimestamp) as `tztimestamp` + from Input +) +into result `Other cases`; diff --git a/yql/essentials/udfs/common/datetime2/test/cases/StartOf.sql b/yql/essentials/udfs/common/datetime2/test/cases/StartOf.sql index 201db38230..81fad12632 100644 --- a/yql/essentials/udfs/common/datetime2/test/cases/StartOf.sql +++ b/yql/essentials/udfs/common/datetime2/test/cases/StartOf.sql @@ -12,8 +12,7 @@ select $format(DateTime::StartOf(`tztimestamp`, Interval("PT15M"))), $format(DateTime::StartOf(`tztimestamp`, Interval("PT20S"))), $format(DateTime::StartOf(`tztimestamp`, Interval("PT7S"))), - DateTime::TimeOfDay(`tztimestamp`), - $format(DateTime::EndOfMonth(`tztimestamp`)), + DateTime::TimeOfDay(`tztimestamp`) from ( select cast(ftztimestamp as TzTimestamp) as `tztimestamp` |