Analyzer: compute ALIAS columns right after reading#59595
Conversation
|
This is an automated comment for commit 973c253 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
|
I need this PR for #50894 |
fixing row policy ... |
9383704 to
fa7abfb
Compare
7cfd7db to
8462f3a
Compare
src/Storages/StorageDistributed.cpp
Outdated
| const auto & column_source = column_node->getColumnSourceOrNull(); | ||
| if (column_source && (column_source->getNodeType() == QueryTreeNodeType::ARRAY_JOIN || column_source->getNodeType() == QueryTreeNodeType::JOIN)) | ||
| return; | ||
| node = column_node->getExpression(); |
There was a problem hiding this comment.
maybe it's a good idea to also save alias here?
There was a problem hiding this comment.
Do you mean to set node->setAlias(column_node->getColumnName()) for replaced node? Added, let's see if it changes anything
| /// Replace ALIAS columns with their expressions or register them in table expression data. | ||
| /// Usually we can replace them when we build some "local" actions DAG | ||
| /// (for example Row Policy or PREWHERE) that is applied on right top of table expression. | ||
| bool keep_alias_columns = true; |
There was a problem hiding this comment.
In other cases, when we keep ColumnNode with expression and compute after read. Added it to comment
|
Is it possible to remove alias columns computation in StorageMerge? |
8462f3a to
e69aa4f
Compare
I'm afraid there's not straightforward way to remove it, because planning of reading from source tables for |
1075ef0 to
cdd88c4
Compare
cdd88c4 to
e67b0be
Compare
e67b0be to
9f1a073
Compare
|
| ActionsDAGPtr merged_alias_columns_actions_dag = std::make_shared<ActionsDAG>(query_plan.getCurrentDataStream().header.getColumnsWithTypeAndName()); | ||
| ActionsDAG::NodeRawConstPtrs action_dag_outputs = merged_alias_columns_actions_dag->getInputs(); | ||
|
|
||
| for (const auto & [column_name, alias_column_actions_dag] : alias_column_expressions) |
There was a problem hiding this comment.
iteration over unordered map here. It makes the order of column in the resulting header unstable, and leads to columns swapping in the distributed queries.
Fixed in #94644
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
...
Documentation entry for user-facing changes