aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/compute_range/pg_compare.sql
blob: 4bb2a3f80553cb8bb453964503e861fa19784a81 (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
26
27
28
29
30
31
32
33
34
35
/* syntax version 1 */
/* postgres can not */
/* dq can not */
/* dqfile can not */
/* yt can not */
pragma warning("disable", "4510");
pragma warning("disable", "1108");

-- a > 2
select YQL::RangeComputeFor(
    Struct<a:PgInt4,b:PgText>,
    ($row) -> (FromPg(PgOp(">", $row.a, 2p)) ?? false),
    AsTuple(AsAtom("a"))
);

-- a >= 2
select YQL::RangeComputeFor(
    Struct<a:PgInt4,b:PgText>,
    ($row) -> (($row.a >= 2p) ?? false),
    AsTuple(AsAtom("a"))
);

-- b < 2
select YQL::RangeComputeFor(
    Struct<a:PgInt4,b:PgText>,
    ($row) -> (('2'p > $row.b) ?? false),
    AsTuple(AsAtom("b"))
);

-- b <= 2
select YQL::RangeComputeFor(
    Struct<a:PgInt4,b:PgText>,
    ($row) -> (FromPg(PgOp(">=", '2'p, $row.b)) ?? false),
    AsTuple(AsAtom("b"))
);