aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/win_func_special.sql
blob: 1dd68979b398e328062756994c5fb1ee818408f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* postgres can not */
$input=(select cast(key as int32) as key, cast(subkey as int32) as subkey, value from plato.Input);

select
  key,
  (key - lag(key, 1) over w) as key_diff,
  (subkey - lag(subkey, 1) over w) as subkey_diff,
  row_number() over w as row,
  value
from $input
window w as (order by key, subkey, value);