ClickHouse/tests/integration/test_backward_compatibility/test_cte_distributed.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.3 KiB
Python
Raw Normal View History

import pytest
2024-02-26 12:45:20 +00:00
from helpers.cluster import ClickHouseCluster, CLICKHOUSE_CI_MIN_TESTED_VERSION
cluster = ClickHouseCluster(__file__)
2024-03-21 14:00:27 +00:00
node1 = cluster.add_instance("node1", with_zookeeper=False, use_old_analyzer=True)
node2 = cluster.add_instance(
"node2",
2021-07-15 05:17:22 +00:00
with_zookeeper=False,
2024-02-26 12:45:20 +00:00
image="clickhouse/clickhouse-server",
tag=CLICKHOUSE_CI_MIN_TESTED_VERSION,
2021-07-15 05:17:22 +00:00
stay_alive=True,
with_installed_binary=True,
)
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_cte_distributed(start_cluster):
node2.query(
"""
WITH
quantile(0.05)(cnt) as p05,
quantile(0.95)(cnt) as p95,
p95 - p05 as inter_percentile_range
SELECT
sum(cnt) as total_requests,
count() as data_points,
inter_percentile_range
FROM (
SELECT
count() as cnt
FROM remote('node{1,2}', numbers(10))
GROUP BY number
)"""
)
node1.query(
"""
WITH
quantile(0.05)(cnt) as p05,
quantile(0.95)(cnt) as p95,
p95 - p05 as inter_percentile_range
SELECT
sum(cnt) as total_requests,
count() as data_points,
inter_percentile_range
FROM (
SELECT
count() as cnt
FROM remote('node{1,2}', numbers(10))
GROUP BY number
)"""
)