Skip to content

Commit 4560c0f

Browse files
committed
more tests
1 parent 63e1302 commit 4560c0f

2 files changed

Lines changed: 94 additions & 6 deletions

File tree

tsl/test/expected/vector_agg_expr.out

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,19 +2076,81 @@ select i % 2, sum(abs(v - 500)), count(abs(v - 500)),
20762076
1 | 303822 | 741 | 320 | 320
20772077
$ | 1846700 | 4471 | 1484 | 742
20782078

2079-
-- FILTER clause with hash grouping: FILTER aggregate excluded from CSE,
2080-
-- other aggregates still share.
2079+
-- FILTER clause with hash grouping: FILTER aggregate excluded from CSE.
20812080
select i % 2,
20822081
sum(abs(v - 500)) filter (where b),
20832082
count(abs(v - 500)),
20842083
sum(abs(v - 500))
2085-
from aggexpr group by i % 2 order by 1;
2084+
from aggexpr group by i % 2 order by 1
2085+
;
20862086
?column? | sum | count | sum
20872087
----------+--------+-------+---------
20882088
0 | 101274 | 3720 | 1533439
20892089
1 | 101436 | 741 | 303822
20902090
$ | 202226 | 4471 | 1846700
20912091

2092+
select x
2093+
, sum(abs(v - 500)) filter (where b)
2094+
, sum(abs(v - 500)) filter (where not b)
2095+
from aggexpr
2096+
group by 1 order by 1, 2, 3 limit 10
2097+
;
2098+
x | sum | sum
2099+
--------+--------+--------
2100+
0 | $ | $
2101+
12 | $ | 612328
2102+
13 | 101193 | 203371
2103+
1410 | 490 | $
2104+
14100 | 400 | $
2105+
141000 | 500 | $
2106+
141002 | $ | 502
2107+
141004 | $ | 504
2108+
141006 | 506 | $
2109+
141008 | $ | 508
2110+
2111+
select x
2112+
, sum(abs(v - 500)) filter (where b)
2113+
, sum(abs(v - 500)) filter (where not b)
2114+
, sum(abs(v - 500))
2115+
, sum(abs(v - 500) + 1)
2116+
from aggexpr
2117+
group by 1 order by 1, 2, 3 limit 10
2118+
;
2119+
x | sum | sum | sum | sum
2120+
--------+--------+--------+--------+--------
2121+
0 | $ | $ | $ | $
2122+
12 | $ | 612328 | 612328 | 613815
2123+
13 | 101193 | 203371 | 304564 | 305306
2124+
1410 | 490 | $ | 490 | 491
2125+
14100 | 400 | $ | 400 | 401
2126+
141000 | 500 | $ | 500 | 501
2127+
141002 | $ | 502 | 502 | 503
2128+
141004 | $ | 504 | 504 | 505
2129+
141006 | 506 | $ | 506 | 507
2130+
141008 | $ | 508 | 508 | 509
2131+
2132+
select x
2133+
, sum(abs(v - 500)) filter (where b)
2134+
, sum(v - 500) filter (where not b)
2135+
, sum(v - 500)
2136+
, sum(abs(v - 500))
2137+
, sum(abs(v - 500) + 1)
2138+
from aggexpr
2139+
group by 1 order by 1, 2, 3 limit 10
2140+
;
2141+
x | sum | sum | sum | sum | sum
2142+
--------+--------+--------+--------+--------+--------
2143+
0 | $ | $ | $ | $ | $
2144+
12 | $ | 362828 | 362828 | 612328 | 613815
2145+
13 | 101193 | 120037 | 179564 | 304564 | 305306
2146+
1410 | 490 | $ | -490 | 490 | 491
2147+
14100 | 400 | $ | -400 | 400 | 401
2148+
141000 | 500 | $ | 500 | 500 | 501
2149+
141002 | $ | 502 | 502 | 502 | 503
2150+
141004 | $ | 504 | 504 | 504 | 505
2151+
141006 | 506 | $ | 506 | 506 | 507
2152+
141008 | $ | 508 | 508 | 508 | 509
2153+
20922154
-- Two shared sibling subexpressions: abs(v - 500) and length(x) both appear
20932155
-- in both aggregates. Tests that the refcount walker continues to sibling
20942156
-- nodes after finding a shared subtree.

tsl/test/sql/vector_agg_expr.sql

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,39 @@ select i % 2, sum(abs(v - 500)), count(abs(v - 500)),
198198
sum(length(x)), count(length(x))
199199
from aggexpr group by i % 2 order by 1;
200200

201-
-- FILTER clause with hash grouping: FILTER aggregate excluded from CSE,
202-
-- other aggregates still share.
201+
-- FILTER clause with hash grouping: FILTER aggregate excluded from CSE.
203202
select i % 2,
204203
sum(abs(v - 500)) filter (where b),
205204
count(abs(v - 500)),
206205
sum(abs(v - 500))
207-
from aggexpr group by i % 2 order by 1;
206+
from aggexpr group by i % 2 order by 1
207+
;
208+
209+
select x
210+
, sum(abs(v - 500)) filter (where b)
211+
, sum(abs(v - 500)) filter (where not b)
212+
from aggexpr
213+
group by 1 order by 1, 2, 3 limit 10
214+
;
215+
216+
select x
217+
, sum(abs(v - 500)) filter (where b)
218+
, sum(abs(v - 500)) filter (where not b)
219+
, sum(abs(v - 500))
220+
, sum(abs(v - 500) + 1)
221+
from aggexpr
222+
group by 1 order by 1, 2, 3 limit 10
223+
;
224+
225+
select x
226+
, sum(abs(v - 500)) filter (where b)
227+
, sum(v - 500) filter (where not b)
228+
, sum(v - 500)
229+
, sum(abs(v - 500))
230+
, sum(abs(v - 500) + 1)
231+
from aggexpr
232+
group by 1 order by 1, 2, 3 limit 10
233+
;
208234

209235
-- Two shared sibling subexpressions: abs(v - 500) and length(x) both appear
210236
-- in both aggregates. Tests that the refcount walker continues to sibling

0 commit comments

Comments
 (0)