aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/blocks/ifpresent_nested_invalid.sql
blob: fd80336a063c45ee0c9d9e808ffe3e996ff43a31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$data = [<|optionalValue:  Just(Just(4)), missingValue: -1|>,
         <|optionalValue:  Just(Nothing(int32?)), missingValue: -2|>,
         <|optionalValue: Just(Just(404)), missingValue: -3|>,
         <|optionalValue: Nothing(int32??), missingValue: -4|>,];


$g = ($y) -> {
    return AssumeNonStrict($y * 4);
};

$f = ($x) -> {
    return AssumeStrict(YQL::IfPresent($x, $g, 55));
};

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