Skip to content

Fixes Merge engine with join and aggregation#21370

Merged
vdimir merged 5 commits intoClickHouse:masterfrom
vdimir:fix-merge-engine-join-group-by
Apr 7, 2021
Merged

Fixes Merge engine with join and aggregation#21370
vdimir merged 5 commits intoClickHouse:masterfrom
vdimir:fix-merge-engine-join-group-by

Conversation

@vdimir
Copy link
Copy Markdown
Member

@vdimir vdimir commented Mar 2, 2021

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Bug Fix

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Mar 2, 2021
@vdimir
Copy link
Copy Markdown
Member Author

vdimir commented Mar 2, 2021

For Merge engine joined tables are removed in analysis stage (see references in #18368 (comment)). But in TreeRewriterResult in aggregation there are references to columns from joined tables, that leads to error. I'm trying to remove such expression from aggregation too to fix original issue.

Cases when aggregation contains columns from both tables not considered yet and don't work on current version on PR.

@vdimir vdimir marked this pull request as draft March 29, 2021 13:40
@vdimir vdimir changed the title Fix joined table access with Merge engine and aggregation Fixes Merge engine with join and aggregation Apr 1, 2021
@vdimir vdimir force-pushed the fix-merge-engine-join-group-by branch from cf6b1ea to 3f46459 Compare April 1, 2021 11:32
@vdimir vdimir marked this pull request as ready for review April 1, 2021 11:32
@vdimir
Copy link
Copy Markdown
Member Author

vdimir commented Apr 1, 2021

Because we remove GROUP_BY from query to Merge engine, we can clean aggregation from TreeRewriterResult. But for WHERE we still need accurate removing expressions containing identifiers from second table. Before that we removed WHERE completely that leads to unused primary or partition keys for left table with Merge engine.

@alexey-milovidov alexey-milovidov self-assigned this Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default pr-no-backport

Projects

None yet

3 participants