summaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/blocks/ifpresent_pg.yql
blob: 787dab5479af3299ef750be42162c3479b1d06a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$data = [
    <|optionalValue: Just(4p), missingValue: -1p|>,
    <|optionalValue: Nothing(pgint4?), missingValue: -2p|>,
    <|optionalValue: Just(3p), missingValue: -3p|>,
    <|optionalValue: Nothing(pgint4?), missingValue: -4p|>,
];

$f = ($x) -> {
    RETURN $x * 2p;
};

SELECT
    YQL::IfPresent(optionalValue, $f, missingValue)
FROM
    as_table($data)
;