aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/compute_range/startswith.sql
blob: b5c31298cb59da529200eb92ab1e0effa0c9e6e1 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* syntax version 1 */
/* postgres can not */
/* dq can not */
/* dqfile can not */
/* yt can not */
pragma warning("disable", "4510");

-- string/string
select YQL::RangeComputeFor(
  Struct<x:String>,
  ($row) -> (StartsWith($row.x, 'foo')),
  AsTuple(AsAtom("x"))
);


select YQL::RangeComputeFor(
  Struct<x:String>,
  ($row) -> (not StartsWith($row.x, 'foo')),
  AsTuple(AsAtom("x"))
);


select YQL::RangeComputeFor(
  Struct<x:String>,
  ($row) -> (StartsWith($row.x, '\xff\xff')),
  AsTuple(AsAtom("x"))
);

select YQL::RangeComputeFor(
  Struct<x:String>,
  ($row) -> (not StartsWith($row.x, '\xff\xff')),
  AsTuple(AsAtom("x"))
);

-- optional string/string
select YQL::RangeComputeFor(
  Struct<x:String?>,
  ($row) -> ((not StartsWith($row.x, 'foo')) ?? false),
  AsTuple(AsAtom("x"))
);

-- optional string/optional string
select YQL::RangeComputeFor(
  Struct<x:String?>,
  ($row) -> (StartsWith($row.x, if(1 > 2, 'void')) ?? false),
  AsTuple(AsAtom("x"))
);

--utf8/string
select YQL::RangeComputeFor(
  Struct<x:Utf8>,
  ($row) -> (StartsWith($row.x, 'тест')),
  AsTuple(AsAtom("x"))
);

select YQL::RangeComputeFor(
  Struct<x:Utf8>,
  ($row) -> (StartsWith($row.x, 'тест\xf5')),
  AsTuple(AsAtom("x"))
);

--optional utf8/utf8
select YQL::RangeComputeFor(
  Struct<x:Utf8?>,
  ($row) -> ((not StartsWith($row.x, 'тест'u)) ?? false),
  AsTuple(AsAtom("x"))
);

select YQL::RangeComputeFor(
  Struct<x:Utf8?>,
  ($row) -> (StartsWith($row.x, '\xf4\x8f\xbf\xbf'u) ?? false),
  AsTuple(AsAtom("x"))
);

-- optional utf8/string
select YQL::RangeComputeFor(
  Struct<x:Utf8?>,
  ($row) -> ((not StartsWith($row.x, 'тест\xf5')) ?? false),
  AsTuple(AsAtom("x"))
);