enable optimize_on_insert for MaterializeMySQL

This commit is contained in:
Alexander Tokmakov 2020-12-17 16:05:38 +03:00
parent 7e73b6acd8
commit 52ef4289fe
2 changed files with 9 additions and 4 deletions

View File

@ -43,7 +43,6 @@ static Context createQueryContext(const Context & global_context)
{
Settings new_query_settings = global_context.getSettings();
new_query_settings.insert_allow_materialized_columns = true;
new_query_settings.optimize_on_insert = false;
Context query_context(global_context);
query_context.setSettings(new_query_settings);

View File

@ -478,10 +478,16 @@ def select_without_columns(clickhouse_node, mysql_node, service_name):
clickhouse_node.query("CREATE VIEW v AS SELECT * FROM db.t")
mysql_node.query("INSERT INTO db.t VALUES (1, 1), (2, 2)")
mysql_node.query("DELETE FROM db.t WHERE a=2;")
check_query(clickhouse_node, "SELECT count((_sign, _version)) FROM db.t FORMAT TSV", "3\n")
assert clickhouse_node.query("SELECT count(_sign) FROM db.t FORMAT TSV") == "2\n"
assert clickhouse_node.query("SELECT count(_version) FROM db.t FORMAT TSV") == "2\n"
optimize_on_insert = clickhouse_node.query("SELECT value FROM system.settings WHERE name='optimize_on_insert'").strip()
if optimize_on_insert == "0":
res = ["3\n", "2\n", "2\n"]
else:
res = ["2\n", "2\n", "1\n"]
check_query(clickhouse_node, "SELECT count((_sign, _version)) FROM db.t FORMAT TSV", res[0])
assert clickhouse_node.query("SELECT count(_sign) FROM db.t FORMAT TSV") == res[1]
assert clickhouse_node.query("SELECT count(_version) FROM db.t FORMAT TSV") == res[2]
assert clickhouse_node.query("SELECT count() FROM db.t FORMAT TSV") == "1\n"
assert clickhouse_node.query("SELECT count(*) FROM db.t FORMAT TSV") == "1\n"