aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/expr/to_hashed_set_vartuple_key.sql
blob: e769b4f849f964f73eec4945904ab487c11b279d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* postgres can not */
$first = ($x)->{return $x.0};
$second = ($x)->{return $x.1};

$vt = ParseType("Variant<Int32,Uint32>");
$v1 = Variant(1,"0",$vt);
$v2 = Variant(2u,"1",$vt);
$v3 = Variant(2,"0",$vt);

$l = AsList(
    AsTuple($v1,Void()),
    AsTuple($v2,Void()),
    AsTuple($v2,Void())
);

$d = ToDict($l);
select ListSort(DictItems($d)),ListSort(DictKeys($d)),ListSort(DictPayloads($d));
select DictLookup($d,$v1), DictLookup($d,$v3);
select DictContains($d,$v1), DictContains($d,$v3);

$d = Yql::ToDict($l,$first,$second,AsTuple(AsAtom("Compact"),AsAtom("Hashed"),AsAtom("One")));
select ListSort(DictItems($d)),ListSort(DictKeys($d)),ListSort(DictPayloads($d));
select DictLookup($d,$v1), DictLookup($d,$v3);
select DictContains($d,$v1), DictContains($d,$v3);