aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggregate/compare_by.sql
blob: f5c13b5348a22a61d9a5929f6bc7f66a2d5fd1ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
/* syntax version 1 */
/* postgres can not */
select
    min_by(sub, key)as min,
    max_by(value, sub) as max,
    min_by(key, length(sub), 2) as min_list,
    min_by(empty, length(sub), 2) as empty_result,
    max_by(key, empty, 2) as empty_by
from
    (select cast(key as int) as key, 
    Unwrap(cast(subkey as int)) as sub, value as value,
    cast(value AS int) AS empty from plato.Input);