diff --git a/tests/queries/0_stateless/03270_window_memory_check.reference b/tests/queries/0_stateless/03270_window_memory_check.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/03270_window_memory_check.sql b/tests/queries/0_stateless/03270_window_memory_check.sql new file mode 100644 index 00000000000..0b4ba452f9a --- /dev/null +++ b/tests/queries/0_stateless/03270_window_memory_check.sql @@ -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;