diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-11-20 11:14:58 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-11-20 11:14:58 +0000 |
commit | 31773f157bf8164364649b5f470f52dece0a4317 (patch) | |
tree | 33d0f7eef45303ab68cf08ab381ce5e5e36c5240 /yql/essentials/tests/sql/suites/window/yql-15636.sql | |
parent | 2c7938962d8689e175574fc1e817c05049f27905 (diff) | |
parent | eff600952d5dfe17942f38f510a8ac2b203bb3a5 (diff) | |
download | ydb-31773f157bf8164364649b5f470f52dece0a4317.tar.gz |
Merge branch 'rightlib' into mergelibs-241120-1113
Diffstat (limited to 'yql/essentials/tests/sql/suites/window/yql-15636.sql')
-rw-r--r-- | yql/essentials/tests/sql/suites/window/yql-15636.sql | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/suites/window/yql-15636.sql b/yql/essentials/tests/sql/suites/window/yql-15636.sql new file mode 100644 index 0000000000..b9efdb2c56 --- /dev/null +++ b/yql/essentials/tests/sql/suites/window/yql-15636.sql @@ -0,0 +1,37 @@ +/* syntax version 1 */ +/* postgres can not */ +use plato; + +insert into @tmp +select + Just('foo') as driver_license_pd_id, + 'bar' as order_id, + '1' as user_phone_pd_id, + '2' as utc_order_dttm; +commit; + + + +SELECT + driver_license_pd_id, + user_phone_pd_id, + utc_order_dttm, + order_id, + + LEAD( + <|"order_id": order_id, "order_dttm": utc_order_dttm|>, + 1 + ) OVER ( + PARTITION BY user_phone_pd_id + ORDER BY utc_order_dttm + ) AS next_user_order, + + LEAD( + <|"order_id": order_id|>, + 1 + ) OVER ( + PARTITION BY driver_license_pd_id + ORDER BY utc_order_dttm + ) AS next_driver_order, + +FROM @tmp; |