aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/expr/struct_merge.sql
blob: 3b6fad5e81588d8240fafe48735a1965268fd2f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* syntax version 1 */

$merge = ($_name, $l, $r) -> { return Coalesce($l, 0) + Coalesce($r, 0); };
$left = <|a: 1, b: 2, c: 3|>;
$right = <|c: 1, d: 2, e: 3|>;

SELECT
    StructUnion($left, $right),
    StructUnion($left, $right, $merge),
    StructIntersection($left, $right),
    StructIntersection($left, $right, $merge),
    StructDifference($left, $right),
    StructSymmetricDifference($left, $right)
;