aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql
diff options
context:
space:
mode:
authorudovichenko-r <udovichenko-r@yandex-team.com>2024-11-19 14:58:38 +0300
committerudovichenko-r <udovichenko-r@yandex-team.com>2024-11-19 15:16:27 +0300
commit24521403b1c44303e043ba540c09b1fe991c7474 (patch)
tree341d1e7206bc7c143d04d2d96f05b6dc0655606d /yql/essentials/tests/sql/suites/bigdate/implicit_cast_callable.sql
parent72b3cd51dc3fb9d16975d353ea82fd85701393cc (diff)
downloadydb-24521403b1c44303e043ba540c09b1fe991c7474.tar.gz
YQL-19206 Move contrib/ydb/library/yql/tests/sql/suites -> yql/essentials/tests/sql/suites
commit_hash:d0ef1f92b09c94db7c2408f946d2a4c62b603f00
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.sql43
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;