aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/action/nested_eval.sql
blob: 0960c6da7435c3b4a2132e801927cf49b48c9260 (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
25
/* syntax version 1 */
/* postgres can not */
$make_struct = Callable(
    Callable<(String) -> Struct<lel : Int32>>,
    ($_string) -> { return AsStruct(5 as lel); }
);

$kekify_struct = ($struct) -> {
    return EvaluateCode(FuncCode("AsStruct",
        ListMap(
            StructTypeComponents(TypeHandle(TypeOf($struct))),
            ($_component) -> { return ListCode(AtomCode("kek"), ReprCode(42)); }
        )
    ));
};

$struct = AsStruct(
    Callable(
        Callable<(String)->Struct<kek : Int32>>,
        ($string) -> { return $kekify_struct($make_struct($string)); }
    ) as KekFromString,
    TypeHandle(Int32) as IntHandle
);

select FormatType(EvaluateType($struct.IntHandle));