mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-09 18:10:48 +00:00
Merge pull request #6934 from abyss7/CLICKHOUSE-4643
Name temporary external table with existing subquery alias
(cherry picked from commit 831eebe4dc
)
This commit is contained in:
parent
1fd0ec6578
commit
1712ef0d5d
@ -78,12 +78,16 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
/// Generate the name for the external table.
|
||||
String external_table_name = "_data" + toString(external_table_id);
|
||||
while (external_tables.count(external_table_name))
|
||||
String external_table_name = subquery_or_table_name->tryGetAlias();
|
||||
if (external_table_name.empty())
|
||||
{
|
||||
++external_table_id;
|
||||
/// Generate the name for the external table.
|
||||
external_table_name = "_data" + toString(external_table_id);
|
||||
while (external_tables.count(external_table_name))
|
||||
{
|
||||
++external_table_id;
|
||||
external_table_name = "_data" + toString(external_table_id);
|
||||
}
|
||||
}
|
||||
|
||||
auto interpreter = interpretSubquery(subquery_or_table_name, context, subquery_depth, {});
|
||||
|
@ -0,0 +1,19 @@
|
||||
DROP TABLE IF EXISTS test1;
|
||||
DROP TABLE IF EXISTS test2;
|
||||
|
||||
CREATE TABLE test1 (a UInt8, b Array(DateTime)) ENGINE Memory;
|
||||
CREATE TABLE test2 as test1 ENGINE Distributed(test_shard_localhost, currentDatabase(), test1);
|
||||
|
||||
INSERT INTO test1 VALUES (1, [1, 2, 3]);
|
||||
|
||||
SELECT 1
|
||||
FROM test2 AS test2
|
||||
ARRAY JOIN arrayFilter(t -> (t GLOBAL IN
|
||||
(
|
||||
SELECT DISTINCT now() AS `ym:a`
|
||||
WHERE 1
|
||||
)), test2.b) AS test2_b
|
||||
WHERE 1;
|
||||
|
||||
DROP TABLE test1;
|
||||
DROP TABLE test2;
|
Loading…
Reference in New Issue
Block a user