add test for reducing memory

This commit is contained in:
lgbo-ustc 2024-11-14 11:23:41 +08:00
parent 12f6bf7b56
commit 25fbc79376
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
-- A test for #65647 that reduces the memory usage of some window functions.
-- without the optimization, about 174 MiB is used.
SELECT
x,
row_number() OVER (PARTITION BY x ORDER BY y ASC)
FROM
(
SELECT
number % 1 AS x,
number AS y
FROM numbers(10000000)
)
FORMAT `null`
SETTINGS max_threads = 1, max_memory_usage = 104857600;
SELECT
x,
rank() OVER (PARTITION BY x ORDER BY y ASC)
FROM
(
SELECT
number % 1 AS x,
number AS y
FROM numbers(10000000)
)
FORMAT `null`
SETTINGS max_threads = 1, max_memory_usage = 104857600;
SELECT
x,
dense_rank() OVER (PARTITION BY x ORDER BY y ASC)
FROM
(
SELECT
number % 1 AS x,
number AS y
FROM numbers(10000000)
)
FORMAT `null`
SETTINGS max_threads = 1, max_memory_usage = 104857600;