2022-03-28 19:52:10 +00:00
|
|
|
import pytest
|
2024-09-27 10:19:39 +00:00
|
|
|
|
2022-03-28 19:52:10 +00:00
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
|
|
node = cluster.add_instance("node", stay_alive=True)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def start_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
finally:
|
|
|
|
cluster.shutdown()
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_view_with_subquery(start_cluster):
|
2022-03-29 12:07:19 +00:00
|
|
|
node.query("create table test (x UInt32) engine=TinyLog()")
|
2022-03-28 20:02:28 +00:00
|
|
|
node.query(
|
|
|
|
"create materialized view mv engine = TinyLog() as with subquery as (select * from test) select * from subquery"
|
|
|
|
)
|
2022-03-28 19:52:10 +00:00
|
|
|
node.restart_clickhouse(kill=True)
|
|
|
|
node.query("insert into test select 1")
|
|
|
|
result = node.query("select * from mv")
|
|
|
|
assert int(result) == 1
|