From 57a803d477682097c71f772e539d7aa3c8419818 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 10 Jul 2020 21:50:01 +0300 Subject: [PATCH] Added a test for #11135 --- .../01383_remote_ambiguous_column_shard.reference | 2 ++ .../01383_remote_ambiguous_column_shard.sql | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/queries/0_stateless/01383_remote_ambiguous_column_shard.reference create mode 100644 tests/queries/0_stateless/01383_remote_ambiguous_column_shard.sql diff --git a/tests/queries/0_stateless/01383_remote_ambiguous_column_shard.reference b/tests/queries/0_stateless/01383_remote_ambiguous_column_shard.reference new file mode 100644 index 00000000000..1355216ceb1 --- /dev/null +++ b/tests/queries/0_stateless/01383_remote_ambiguous_column_shard.reference @@ -0,0 +1,2 @@ +2 name_1 30 +3 name_3 30 diff --git a/tests/queries/0_stateless/01383_remote_ambiguous_column_shard.sql b/tests/queries/0_stateless/01383_remote_ambiguous_column_shard.sql new file mode 100644 index 00000000000..2392044ebad --- /dev/null +++ b/tests/queries/0_stateless/01383_remote_ambiguous_column_shard.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS fact; +DROP TABLE IF EXISTS dimension; + +create table fact (id1 Int64, id2 Int64, value Int64) ENGINE = MergeTree() ORDER BY id1; +create table dimension (id1 Int64, name String) ENGINE = MergeTree() ORDER BY id1; +insert into fact values (1,2,10),(2,2,10),(3,3,10),(4,3,10); +insert into dimension values (1,'name_1'),(2,'name_1'),(3,'name_3'),(4, 'name_4'); + +SELECT f.id1 AS ID, d.name AS Name, sum(f.value) FROM remote('127.0.0.{1,2,3}', currentDatabase(), fact) AS f LEFT JOIN dimension AS d ON f.id1 = d.id1 WHERE f.id1 = f.id2 GROUP BY ID, Name; + +DROP TABLE fact; +DROP TABLE dimension;