@@ -50,10 +50,9 @@ FROM (
5050----
5151100000 5000050000
5252
53- # Assert spill happened: anchor on `spill_count=` so the leading wildcard
54- # cannot skip to a later metric, then verify `spilled_rows` has a K-suffix
55- # (only emitted for counts >= 1000). `spilled_rows=0` has no K-suffix, so the
56- # pattern fails when spilling does not occur.
53+ # Assert spill happened: the aggregate spills all 100k rows, so
54+ # spilled_rows is formatted as "100.0 K". This value cannot appear
55+ # when spill_count=0 because spilled_rows would then be 0 (no K suffix).
5756query TT
5857EXPLAIN ANALYZE
5958SELECT count(*), sum(total)
6463)
6564----
6665<slt:ignore>
67- 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows =<slt:ignore> K,<slt:ignore>]
66+ 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes =<slt:ignore>, spilled_rows=100.0 K,<slt:ignore>]
6867<slt:ignore>
6968
7069# --- Case B: multi-column GROUP BY (is_single() = false) ---
7978----
8079100000 5000050000
8180
82- # Assert spill happened: spill_count anchors the search; spilled_rows K-suffix
83- # only appears for counts >= 1000, failing when no spill occurs.
81+ # Assert spill happened (same reasoning as Case A).
8482query TT
8583EXPLAIN ANALYZE
8684SELECT count(*), sum(total)
9189)
9290----
9391<slt:ignore>
94- 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000), v@0 * 13 % 100000 as t.v * Int64(13) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows =<slt:ignore> K,<slt:ignore>]
92+ 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000), v@0 * 13 % 100000 as t.v * Int64(13) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes =<slt:ignore>, spilled_rows=100.0 K,<slt:ignore>]
9593<slt:ignore>
9694
9795# --- Case C: DISTINCT aggregate under memory limit ---
@@ -106,8 +104,7 @@ FROM (
106104----
107105100000 100000
108106
109- # Assert spill happened: spill_count anchors the search; spilled_rows K-suffix
110- # only appears for counts >= 1000, failing when no spill occurs.
107+ # Assert spill happened (same reasoning as Case A).
111108query TT
112109EXPLAIN ANALYZE
113110SELECT count(*), sum(d)
@@ -118,7 +115,7 @@ FROM (
118115)
119116----
120117<slt:ignore>
121- 04)------AggregateExec: mode=Single, gby=[group_alias_0@0 as group_alias_0], aggr=[count(alias1)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows =<slt:ignore> K,<slt:ignore>]
118+ 04)------AggregateExec: mode=Single, gby=[group_alias_0@0 as group_alias_0], aggr=[count(alias1)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes =<slt:ignore>, spilled_rows=100.0 K,<slt:ignore>]
122119<slt:ignore>
123120
124121# --- Case D: multiple aggregates (sum/min/max) under memory limit ---
@@ -133,8 +130,7 @@ FROM (
133130----
134131100000 5000050000 1 100000
135132
136- # Assert spill happened: spill_count anchors the search; spilled_rows K-suffix
137- # only appears for counts >= 1000, failing when no spill occurs.
133+ # Assert spill happened (same reasoning as Case A).
138134query TT
139135EXPLAIN ANALYZE
140136SELECT count(*), sum(s), min(mn), max(mx)
@@ -145,7 +141,7 @@ FROM (
145141)
146142----
147143<slt:ignore>
148- 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v), min(t.v), max(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows =<slt:ignore> K,<slt:ignore>]
144+ 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v), min(t.v), max(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes =<slt:ignore>, spilled_rows=100.0 K,<slt:ignore>]
149145<slt:ignore>
150146
151147# --- Case E: avg() aggregate (Float64 output) under memory limit ---
@@ -160,8 +156,7 @@ FROM (
160156----
161157100000 1 100000
162158
163- # Assert spill happened: spill_count anchors the search; spilled_rows K-suffix
164- # only appears for counts >= 1000, failing when no spill occurs.
159+ # Assert spill happened (same reasoning as Case A).
165160query TT
166161EXPLAIN ANALYZE
167162SELECT count(*), min(a), max(a)
@@ -172,7 +167,7 @@ FROM (
172167)
173168----
174169<slt:ignore>
175- 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[avg(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows =<slt:ignore> K,<slt:ignore>]
170+ 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[avg(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes =<slt:ignore>, spilled_rows=100.0 K,<slt:ignore>]
176171<slt:ignore>
177172
178173# --- Case F: array_agg() aggregate (growable state) under memory limit ---
@@ -187,8 +182,7 @@ FROM (
187182----
188183100000 100000
189184
190- # Assert spill happened: spill_count anchors the search; spilled_rows K-suffix
191- # only appears for counts >= 1000, failing when no spill occurs.
185+ # Assert spill happened (same reasoning as Case A).
192186query TT
193187EXPLAIN ANALYZE
194188SELECT count(*), sum(l)
@@ -199,7 +193,7 @@ FROM (
199193)
200194----
201195<slt:ignore>
202- 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[array_agg(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows =<slt:ignore> K,<slt:ignore>]
196+ 04)------AggregateExec: mode=Single, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[array_agg(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes =<slt:ignore>, spilled_rows=100.0 K,<slt:ignore>]
203197<slt:ignore>
204198
205199# --- Case G: partial/final aggregation under memory limit ---
@@ -240,7 +234,7 @@ FROM (
240234)
241235----
242236<slt:ignore>
243- 06)----------AggregateExec: mode=FinalPartitioned, gby=[t.v * Int64(7) % Int64(100000)@0 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_rows=<slt:ignore> K,<slt:ignore>]
237+ 06)----------AggregateExec: mode=FinalPartitioned, gby=[t.v * Int64(7) % Int64(100000)@0 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>spill_count=<slt:ignore>, spilled_bytes=<slt:ignore>, spilled_rows=<slt:ignore> K,<slt:ignore>]
244238<slt:ignore>
24523908)--------------AggregateExec: mode=Partial, gby=[v@0 * 7 % 100000 as t.v * Int64(7) % Int64(100000)], aggr=[sum(t.v)], metrics=[<slt:ignore>early_emit_count=<slt:ignore>]
246240<slt:ignore>
0 commit comments