Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@KochetovNicolai
Copy link
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehaviour in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix possible Block structure mismatch for subqueries with pushed-down HAVING predicate. Fixes #29010

Detailed description / Documentation draft:
In added test, WHERE was pushed down to subquery as HAVING, but was not removed itself. So that AST-optimized query has two similar filters, for having first, and then for where. HAVING step could not detect that filter column is not used anymore; it always kept it (replaced to constant).
WHERE step calculates the same condition with the same column name. It worked as long as result was constant. However, in case we split filter step, it was possible to get intermediate non-const column. Recently, it was prohibited to have const and non-const column in block. which caused exception.

Fixed by allowing HAVING to drop unused filter.

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Sep 28, 2021
@CLAassistant
Copy link

CLAassistant commented Sep 28, 2021

CLA assistant check
All committers have signed the CLA.

@Avogar Avogar self-assigned this Sep 28, 2021
@Avogar Avogar merged commit 14be2f3 into master Sep 29, 2021
@Avogar Avogar deleted the fix-29010 branch September 29, 2021 10:03
robot-clickhouse pushed a commit that referenced this pull request Sep 29, 2021
robot-clickhouse pushed a commit that referenced this pull request Sep 29, 2021
robot-clickhouse pushed a commit that referenced this pull request Sep 29, 2021
KochetovNicolai added a commit that referenced this pull request Oct 13, 2021
Backport #29475 to 21.8: Remove filter column from HAVING when it is not needed.
KochetovNicolai added a commit that referenced this pull request Oct 13, 2021
Backport #29475 to 21.9: Remove filter column from HAVING when it is not needed.
KochetovNicolai added a commit that referenced this pull request Oct 13, 2021
Backport #29475 to 21.10: Remove filter column from HAVING when it is not needed.
taiyang-li pushed a commit to bigo-sg/ClickHouse that referenced this pull request Nov 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query using GROUP BY ROLLUP fails on Block structure mismatch when selected field name matches column name

5 participants