mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge branch 'dist-agg-issue' of https://github.com/chengxianglibra/ClickHouse into chengxianglibra-dist-agg-issue
This commit is contained in:
commit
42399e8866
@ -9,9 +9,13 @@ namespace DB
|
||||
static bool checkColumnsAlreadyDistinct(const Names & columns, const NameSet & distinct_names)
|
||||
{
|
||||
bool columns_already_distinct = true;
|
||||
for (const auto & name : columns)
|
||||
if (distinct_names.count(name) == 0)
|
||||
columns_already_distinct = false;
|
||||
if (columns.size() != distinct_names.size()) {
|
||||
columns_already_distinct = false;
|
||||
} else {
|
||||
for (const auto & name : columns)
|
||||
if (distinct_names.count(name) == 0)
|
||||
columns_already_distinct = false;
|
||||
}
|
||||
|
||||
return columns_already_distinct;
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
a 0
|
||||
a 1
|
||||
b 0
|
||||
---
|
||||
0
|
||||
1
|
||||
---
|
||||
0
|
||||
1
|
@ -0,0 +1,18 @@
|
||||
DROP TABLE IF EXISTS t;
|
||||
DROP TABLE IF EXISTS d;
|
||||
|
||||
CREATE TABLE t (a String, b Int) ENGINE = TinyLog;
|
||||
INSERT INTO t VALUES ('a', 0), ('a', 1), ('b', 0);
|
||||
SELECT * FROM t;
|
||||
|
||||
SELECT '---';
|
||||
CREATE TABLE d (a String, b Int) ENGINE = Distributed(test_shard_localhost, currentDatabase(), t);
|
||||
SELECT DISTINCT b FROM (SELECT a, b FROM d GROUP BY a, b);
|
||||
DROP TABLE d;
|
||||
|
||||
SELECT '---';
|
||||
CREATE TABLE d (a String, b Int) ENGINE = Distributed(test_cluster_two_shards_localhost, currentDatabase(), t);
|
||||
SELECT DISTINCT b FROM (SELECT a, b FROM d GROUP BY a, b);
|
||||
DROP TABLE d;
|
||||
|
||||
DROP TABLE t;
|
Loading…
Reference in New Issue
Block a user