This commit is contained in:
Dmitry Novik 2024-12-02 12:01:24 +01:00
parent ad5a571d7a
commit 7e00e604fa
3 changed files with 4 additions and 6 deletions

View File

@ -176,14 +176,12 @@ private:
{
if (result.empty())
{
String unique_array_join_name = fmt::format("__array_join_{}", ++next_id);
for (auto & array_join_expression : array_join->getJoinExpressions())
{
auto * array_join_column = array_join_expression->as<ColumnNode>();
chassert(array_join_column != nullptr);
String unique_expression_name = fmt::format("{}.{}", unique_array_join_name, array_join_column->getColumnName());
String unique_expression_name = fmt::format("__array_join_exp_{}", ++next_id);
result.emplace(array_join_column->getColumnName(), unique_expression_name);
auto replacement_column = array_join_column->getColumn();

View File

@ -121,8 +121,8 @@ Filter column: and(notEquals(y, 2), notEquals(x, 0))
ARRAY JOIN x
Filter column: notEquals(y, 2)
> (analyzer) filter is split, one part is filtered before ARRAY JOIN
Filter column: and(notEquals(__table2.y, 2_UInt8), notEquals(__array_join_1.x, 0_UInt8))
ARRAY JOIN __array_join_1.x
Filter column: and(notEquals(__table2.y, 2_UInt8), notEquals(__array_join_exp_1, 0_UInt8))
ARRAY JOIN __array_join_exp_1
Filter column: notEquals(__table2.y, 2_UInt8)
1 3
> filter is pushed down before Distinct

View File

@ -134,7 +134,7 @@ $CLICKHOUSE_CLIENT --enable_analyzer=1 -q "
explain actions = 1 select x, y from (
select range(number) as x, number + 1 as y from numbers(3)
) array join x where y != 2 and x != 0" |
grep -o "Filter column: and(notEquals(__table2.y, 2_UInt8), notEquals(__array_join_1.x, 0_UInt8))\|ARRAY JOIN __array_join_1.x\|Filter column: notEquals(__table2.y, 2_UInt8)"
grep -o "Filter column: and(notEquals(__table2.y, 2_UInt8), notEquals(__array_join_exp_1, 0_UInt8))\|ARRAY JOIN __array_join_exp_1\|Filter column: notEquals(__table2.y, 2_UInt8)"
$CLICKHOUSE_CLIENT -q "
select x, y from (
select range(number) as x, number + 1 as y from numbers(3)