Thank you for your response!
After some research more I have found out something strange. I have multiple databases, each one of them with multiple replicated tables and distributed tables, and on top of all I have a merge table that includes all the distributed tables. I give you an example of the schema:
-- Create database
CREATE DATABASE IF NOT EXISTS test;
-- Create replicated tables
CREATE TABLE IF NOT EXISTS test.r_1 (date Date, first Int32, second Int32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/test.r_1', '{replica}', date, (first), 8192);
CREATE TABLE IF NOT EXISTS test.r_2 (date Date, first Int32, second Int32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/test.r_2', '{replica}', date, (first), 8192);
-- Create distributed tables
CREATE TABLE IF NOT EXISTS test.d_1 (date Date, first Int32, second Int32) ENGINE = Distributed('cluster', test, r_1, rand());
CREATE TABLE IF NOT EXISTS test.d_2 (date Date, first Int32, second Int32) ENGINE = Distributed('cluster', test, r_2, rand());
-- Create Merge tables
CREATE TABLE IF NOT EXISTS test.distributed_all (date Date, first Int32, second Int32) ENGINE = Merge(test, '^d_*');
CREATE TABLE IF NOT EXISTS test.replicated_all (date Date, first Int32, second Int32) ENGINE = Merge(test, '^r_*');
-- Insert data
INSERT INTO test.d_1 VALUES ('2017-04-11', 1, 2);
INSERT INTO test.d_2 VALUES ('2017-04-11', 3, 4);
If a count query is performed on top of the merge table that aims to the replicated tables, it returns the desired result:
Query
====
SELECT COUNT() FROM test.replicated_all FORMAT CSV
Result
=====
2
But, if the same query is performed on top of the merge table that aims to the distributed table it returns the results for each one of the tables.
Query
====
SELECT COUNT() FROM test.distributed_all FORMAT CSV
Result
=====
"d_1",1
"d_2",1
This was tested using the last stable version (1.1.54198)
El divendres, 31 març de 2017 18:30:27 UTC+2, Vitaliy Lyudvichenko va escriure: