Merge pull request #63128 from den-crane/test/issue_47217

add tests for #47217, #55965
This commit is contained in:
Alexey Milovidov 2024-04-30 01:22:18 +02:00 committed by GitHub
commit 08ef9a2eea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,3 @@
a 0.5 4
a 1
b 1

View File

@ -0,0 +1,41 @@
SET allow_experimental_analyzer = 1;
-- https://github.com/ClickHouse/ClickHouse/issues/55965
CREATE TABLE error_win_func
(
`k` String,
`in` UInt64,
`out` UInt64
)
ENGINE = MergeTree
ORDER BY k AS
SELECT * from VALUES (('a', 2, 4), ('a', 4, 2), ('a', 6, 3), ('a', 8, 4));
SELECT
k,
in / out AS ratio,
count(*) OVER w AS count_rows_w
FROM error_win_func
WINDOW
w AS (ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING)
LIMIT 1 BY
k;
DROP TABLE error_win_func;
-- https://github.com/ClickHouse/ClickHouse/issues/47217
CREATE TABLE t(n String, st String) ENGINE = Memory as
select * from values(('a', 'x'), ('b', 'y'), ('c', 'z'));
SELECT
n as m,
count() OVER (PARTITION BY m) cnt
FROM t
WHERE st IN ('x', 'y')
LIMIT 1 BY m;
DROP TABLE t;