mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge branch 'master' into fix-apache-arrow
This commit is contained in:
commit
6a48202f24
@ -1490,6 +1490,10 @@ void QueryAnalyzer::qualifyColumnNodesWithProjectionNames(const QueryTreeNodes &
|
||||
additional_column_qualification_parts = {table_expression_node->getAlias()};
|
||||
else if (auto * table_node = table_expression_node->as<TableNode>())
|
||||
additional_column_qualification_parts = {table_node->getStorageID().getDatabaseName(), table_node->getStorageID().getTableName()};
|
||||
else if (auto * query_node = table_expression_node->as<QueryNode>(); query_node && query_node->isCTE())
|
||||
additional_column_qualification_parts = {query_node->getCTEName()};
|
||||
else if (auto * union_node = table_expression_node->as<UnionNode>(); union_node && union_node->isCTE())
|
||||
additional_column_qualification_parts = {union_node->getCTEName()};
|
||||
|
||||
size_t additional_column_qualification_parts_size = additional_column_qualification_parts.size();
|
||||
const auto & table_expression_data = scope.getTableExpressionDataOrThrow(table_expression_node);
|
||||
@ -4455,9 +4459,8 @@ void QueryAnalyzer::initializeTableExpressionData(const QueryTreeNodePtr & table
|
||||
{
|
||||
auto left_table_expression = extractLeftTableExpression(scope_query_node->getJoinTree());
|
||||
if (table_expression_node.get() == left_table_expression.get() &&
|
||||
scope.joins_count == 1 &&
|
||||
scope.context->getSettingsRef().single_join_prefer_left_table)
|
||||
table_expression_data.should_qualify_columns = false;
|
||||
scope.joins_count == 1 && scope.context->getSettingsRef().single_join_prefer_left_table)
|
||||
table_expression_data.should_qualify_columns = false;
|
||||
}
|
||||
|
||||
scope.table_expression_node_to_data.emplace(table_expression_node, std::move(table_expression_data));
|
||||
|
@ -5,7 +5,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
DB_SUFFIX=$RANDOM
|
||||
DB_SUFFIX=${RANDOM}${RANDOM}${RANDOM}${RANDOM}
|
||||
${CLICKHOUSE_CLIENT} --query "DROP DATABASE IF EXISTS parallel_ddl_${DB_SUFFIX}"
|
||||
|
||||
function query()
|
||||
|
@ -443,6 +443,18 @@ SELECT '--';
|
||||
--
|
||||
DESCRIBE (WITH test_table_in_cte AS (SELECT id FROM test_table) SELECT id IN test_table_in_cte FROM test_table);
|
||||
in(id, test_table_in_cte) UInt8
|
||||
SELECT '--';
|
||||
--
|
||||
DESCRIBE (WITH test_table_in_cte_1 AS (SELECT 1 AS c1), test_table_in_cte_2 AS (SELECT 1 AS c1) SELECT *
|
||||
FROM test_table_in_cte_1 INNER JOIN test_table_in_cte_2 as test_table_in_cte_2 ON test_table_in_cte_1.c1 = test_table_in_cte_2.c1);
|
||||
test_table_in_cte_1.c1 UInt8
|
||||
test_table_in_cte_2.c1 UInt8
|
||||
SELECT '--';
|
||||
--
|
||||
DESCRIBE (WITH test_table_in_cte_1 AS (SELECT 1 AS c1), test_table_in_cte_2 AS (SELECT 1 AS c1 UNION ALL SELECT 1 AS c1) SELECT *
|
||||
FROM test_table_in_cte_1 INNER JOIN test_table_in_cte_2 as test_table_in_cte_2 ON test_table_in_cte_1.c1 = test_table_in_cte_2.c1);
|
||||
test_table_in_cte_1.c1 UInt8
|
||||
test_table_in_cte_2.c1 UInt8
|
||||
SELECT 'Joins';
|
||||
Joins
|
||||
DESCRIBE (SELECT * FROM test_table_join_1, test_table_join_2);
|
||||
|
@ -408,6 +408,16 @@ SELECT '--';
|
||||
|
||||
DESCRIBE (WITH test_table_in_cte AS (SELECT id FROM test_table) SELECT id IN test_table_in_cte FROM test_table);
|
||||
|
||||
SELECT '--';
|
||||
|
||||
DESCRIBE (WITH test_table_in_cte_1 AS (SELECT 1 AS c1), test_table_in_cte_2 AS (SELECT 1 AS c1) SELECT *
|
||||
FROM test_table_in_cte_1 INNER JOIN test_table_in_cte_2 as test_table_in_cte_2 ON test_table_in_cte_1.c1 = test_table_in_cte_2.c1);
|
||||
|
||||
SELECT '--';
|
||||
|
||||
DESCRIBE (WITH test_table_in_cte_1 AS (SELECT 1 AS c1), test_table_in_cte_2 AS (SELECT 1 AS c1 UNION ALL SELECT 1 AS c1) SELECT *
|
||||
FROM test_table_in_cte_1 INNER JOIN test_table_in_cte_2 as test_table_in_cte_2 ON test_table_in_cte_1.c1 = test_table_in_cte_2.c1);
|
||||
|
||||
SELECT 'Joins';
|
||||
|
||||
DESCRIBE (SELECT * FROM test_table_join_1, test_table_join_2);
|
||||
|
@ -1 +0,0 @@
|
||||
1 1 1
|
@ -1,17 +0,0 @@
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/22627
|
||||
SET allow_experimental_analyzer=1;
|
||||
WITH
|
||||
x AS
|
||||
(
|
||||
SELECT 1 AS a
|
||||
),
|
||||
xx AS
|
||||
(
|
||||
SELECT *
|
||||
FROM x
|
||||
, x AS x1
|
||||
, x AS x2
|
||||
)
|
||||
SELECT *
|
||||
FROM xx
|
||||
WHERE a = 1;
|
Loading…
Reference in New Issue
Block a user