diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql')
-rw-r--r-- | yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql b/yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql new file mode 100644 index 0000000000..005e686135 --- /dev/null +++ b/yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql @@ -0,0 +1,43 @@ +/* postgres can not */ +use plato; + +$identity = ($x)-> { return $x }; + +$idDate32 = Callable(Callable<(date32)->date32>, $identity); +$idDatetime64 = Callable(Callable<(datetime64)->datetime64>, $identity); +$idTimestamp64 = Callable(Callable<(timestamp64)->timestamp64>, $identity); +$idInterval64 = Callable(Callable<(interval64)->interval64>, $identity); + +$valDate = unwrap(cast(1 as date)); +$valDate32 = unwrap(cast(-1 as date32)); +$valDatetime = unwrap(cast(86400 as datetime)); +$valDatetime64 = unwrap(cast(-86400 as datetime64)); +$valTimestamp = unwrap(cast(86400l*1000000 as timestamp)); +$valTimestamp64 = unwrap(cast(86400l*1000000 as timestamp64)); +$valInterval = unwrap(cast(1 as interval)); +$valInterval64 = unwrap(cast(-1 as interval64)); + +select 1, $idDate32($valDate), $idDate32($valDate32) +, 2, $idDatetime64($valDate), $idDatetime64($valDate32) +, $idDatetime64($valDatetime), $idDatetime64($valDatetime64) +, 3, $idTimestamp64($valDate), $idTimestamp64($valDate32) +, $idTimestamp64($valDatetime), $idTimestamp64($valDatetime64) +, $idTimestamp64($valTimestamp), $idTimestamp64($valTimestamp64) +, 4, $idInterval64($valInterval), $idInterval64($valInterval64); + +select row +, 1, $idTimestamp64(d32), $idDatetime64(d32), $idDate32(d32) +, 2, $idTimestamp64(dt64), $idDatetime64(dt64) +, 3, $idTimestamp64(ts64) +, 4, $idInterval64(i64) +from BigDates +order by row; + +select row +, 1, $idTimestamp64(d), $idDatetime64(d), $idDate32(d) +, 2, $idTimestamp64(dt), $idDatetime64(dt) +, 3, $idTimestamp64(ts) +from NarrowDates +order by row; + +select row, $idInterval64(i) from NarrowInterval order by row; |