Skip to content

Commit 973c253

Browse files
committed
fix 02911_support_alias_column_in_indices
1 parent 9f1a073 commit 973c253

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Processors/QueryPlan/ReadFromMergeTree.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,8 +1434,13 @@ void ReadFromMergeTree::applyFilters(ActionDAGNodes added_filter_nodes)
14341434
if (query_info.planner_context)
14351435
{
14361436
const auto & table_expression_data = query_info.planner_context->getTableExpressionDataOrThrow(query_info.table_expression);
1437+
const auto & alias_column_expressions = table_expression_data.getAliasColumnExpressions();
14371438
for (const auto & [column_identifier, column_name] : table_expression_data.getColumnIdentifierToColumnName())
14381439
{
1440+
/// ALIAS columns cannot be used in the filter expression without being calculated in ActionsDAG,
1441+
/// so they should not be added to the input nodes.
1442+
if (alias_column_expressions.contains(column_name))
1443+
continue;
14391444
const auto & column = table_expression_data.getColumnOrThrow(column_name);
14401445
node_name_to_input_node_column.emplace(column_identifier, ColumnWithTypeAndName(column.type, column_name));
14411446
}

0 commit comments

Comments
 (0)