aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/expr/with_optional_args.sql
blob: 5fe5dc68133554e27c3f7343af13d19581e19f5e (plain) (blame)
1
2
3
4
5
6
7
8
/* syntax version 1 */
/* postgres can not */
$f = Yql::WithOptionalArgs(($x,$y,$z)->($x + ($y ?? 0) + ($z ?? 0)), AsAtom("2"));
select $f(1),$f(2,3),$f(4,5,6),
  Yql::NamedApply($f,(1,),<||>),
  Yql::NamedApply($f,(1,2),<||>),
  Yql::NamedApply($f,(1,2,3),<||>),
  Yql::NamedApply($f,(1,2,3,4),<||>);