mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
[fix] black the python script
This commit is contained in:
parent
f62ccc75ec
commit
80fe3f78d9
@ -59,13 +59,11 @@ def create_source_table(node, table_name, replicated):
|
|||||||
ORDER BY (postcode1, postcode2, addr1, addr2)
|
ORDER BY (postcode1, postcode2, addr1, addr2)
|
||||||
SETTINGS disk = disk(type = web, endpoint = 'https://raw.githubusercontent.com/ClickHouse/web-tables-demo/main/web/')
|
SETTINGS disk = disk(type = web, endpoint = 'https://raw.githubusercontent.com/ClickHouse/web-tables-demo/main/web/')
|
||||||
""".format(
|
""".format(
|
||||||
table_name=table_name,
|
table_name=table_name, engine=engine
|
||||||
engine=engine
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_destination_table(node, table_name, replicated):
|
def create_destination_table(node, table_name, replicated):
|
||||||
replica = node.name
|
replica = node.name
|
||||||
engine = (
|
engine = (
|
||||||
@ -95,89 +93,95 @@ def create_destination_table(node, table_name, replicated):
|
|||||||
ENGINE = {engine}
|
ENGINE = {engine}
|
||||||
ORDER BY (postcode1, postcode2, addr1, addr2)
|
ORDER BY (postcode1, postcode2, addr1, addr2)
|
||||||
""".format(
|
""".format(
|
||||||
table_name=table_name,
|
table_name=table_name, engine=engine
|
||||||
engine=engine
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_both_mergtree(start_cluster):
|
def test_both_mergtree(start_cluster):
|
||||||
create_source_table(replica1, "source", False)
|
create_source_table(replica1, "source", False)
|
||||||
create_destination_table(replica1, "destination", False)
|
create_destination_table(replica1, "destination", False)
|
||||||
|
|
||||||
replica1.query(
|
replica1.query(f"ALTER TABLE destination ATTACH PARTITION tuple() FROM source")
|
||||||
f"ALTER TABLE destination ATTACH PARTITION tuple() FROM source"
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_eq_with_retry(
|
assert_eq_with_retry(
|
||||||
replica1, f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC",
|
replica1,
|
||||||
replica1.query(f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC"),
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC",
|
||||||
|
replica1.query(
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_eq_with_retry(
|
assert_eq_with_retry(
|
||||||
replica1, f"SELECT town from destination LIMIT 1",
|
replica1, f"SELECT town from destination LIMIT 1", "SCARBOROUGH"
|
||||||
"SCARBOROUGH"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cleanup([replica1])
|
cleanup([replica1])
|
||||||
|
|
||||||
|
|
||||||
def test_all_replicated(start_cluster):
|
def test_all_replicated(start_cluster):
|
||||||
create_source_table(replica1, "source", True)
|
create_source_table(replica1, "source", True)
|
||||||
create_destination_table(replica1, "destination", True)
|
create_destination_table(replica1, "destination", True)
|
||||||
create_destination_table(replica2, "destination", True)
|
create_destination_table(replica2, "destination", True)
|
||||||
|
|
||||||
replica1.query("SYSTEM SYNC REPLICA destination")
|
replica1.query("SYSTEM SYNC REPLICA destination")
|
||||||
replica1.query(
|
replica1.query(f"ALTER TABLE destination ATTACH PARTITION tuple() FROM source")
|
||||||
f"ALTER TABLE destination ATTACH PARTITION tuple() FROM source"
|
|
||||||
|
assert_eq_with_retry(
|
||||||
|
replica1,
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC",
|
||||||
|
replica1.query(
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
assert_eq_with_retry(
|
||||||
|
replica1,
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC",
|
||||||
|
replica2.query(
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_eq_with_retry(
|
assert_eq_with_retry(
|
||||||
replica1, f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC",
|
replica1, f"SELECT town from destination LIMIT 1", "SCARBOROUGH"
|
||||||
replica1.query(f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC"),
|
|
||||||
)
|
|
||||||
assert_eq_with_retry(
|
|
||||||
replica1, f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC",
|
|
||||||
replica2.query(f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC"),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_eq_with_retry(
|
assert_eq_with_retry(
|
||||||
replica1, f"SELECT town from destination LIMIT 1",
|
replica2, f"SELECT town from destination LIMIT 1", "SCARBOROUGH"
|
||||||
"SCARBOROUGH"
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_eq_with_retry(
|
|
||||||
replica2, f"SELECT town from destination LIMIT 1",
|
|
||||||
"SCARBOROUGH"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cleanup([replica1, replica2])
|
cleanup([replica1, replica2])
|
||||||
|
|
||||||
|
|
||||||
def test_only_destination_replicated(start_cluster):
|
def test_only_destination_replicated(start_cluster):
|
||||||
create_source_table(replica1, "source", False)
|
create_source_table(replica1, "source", False)
|
||||||
create_destination_table(replica1, "destination", True)
|
create_destination_table(replica1, "destination", True)
|
||||||
create_destination_table(replica2, "destination", True)
|
create_destination_table(replica2, "destination", True)
|
||||||
|
|
||||||
replica1.query("SYSTEM SYNC REPLICA destination")
|
replica1.query("SYSTEM SYNC REPLICA destination")
|
||||||
replica1.query(
|
replica1.query(f"ALTER TABLE destination ATTACH PARTITION tuple() FROM source")
|
||||||
f"ALTER TABLE destination ATTACH PARTITION tuple() FROM source"
|
|
||||||
|
assert_eq_with_retry(
|
||||||
|
replica1,
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC",
|
||||||
|
replica1.query(
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
assert_eq_with_retry(
|
||||||
|
replica1,
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC",
|
||||||
|
replica2.query(
|
||||||
|
f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_eq_with_retry(
|
assert_eq_with_retry(
|
||||||
replica1, f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC",
|
replica1, f"SELECT town from destination LIMIT 1", "SCARBOROUGH"
|
||||||
replica1.query(f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC"),
|
|
||||||
)
|
|
||||||
assert_eq_with_retry(
|
|
||||||
replica1, f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM source GROUP BY year ORDER BY year ASC",
|
|
||||||
replica2.query(f"SELECT toYear(date) AS year,round(avg(price)) AS price,bar(price, 0, 1000000, 80) FROM destination GROUP BY year ORDER BY year ASC"),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_eq_with_retry(
|
assert_eq_with_retry(
|
||||||
replica1, f"SELECT town from destination LIMIT 1",
|
replica2, f"SELECT town from destination LIMIT 1", "SCARBOROUGH"
|
||||||
"SCARBOROUGH"
|
|
||||||
)
|
|
||||||
|
|
||||||
assert_eq_with_retry(
|
|
||||||
replica2, f"SELECT town from destination LIMIT 1",
|
|
||||||
"SCARBOROUGH"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
cleanup([replica1, replica2])
|
cleanup([replica1, replica2])
|
||||||
|
Loading…
Reference in New Issue
Block a user