Skip to content

try fix some predicate optimizer bug#8503

Merged
alexey-milovidov merged 9 commits intoClickHouse:masterfrom
zhang2014:fix/some_predicate_bug
Jan 9, 2020
Merged

try fix some predicate optimizer bug#8503
alexey-milovidov merged 9 commits intoClickHouse:masterfrom
zhang2014:fix/some_predicate_bug

Conversation

@zhang2014
Copy link
Copy Markdown
Contributor

@zhang2014 zhang2014 commented Jan 2, 2020

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

Changelog category:

  • Bug Fix

Changelog entry:
Fix some predicate optimizer wrong results

Detailed description:
fixed #3885 #5485 #5682 #6734 #6767 #7136 #5674 #4731 #4904 #7802

@zhang2014 zhang2014 force-pushed the fix/some_predicate_bug branch from ab313fc to 932c3ff Compare January 4, 2020 06:05
@zhang2014 zhang2014 force-pushed the fix/some_predicate_bug branch from 932c3ff to 6a5e3e2 Compare January 4, 2020 08:47
@zhang2014
Copy link
Copy Markdown
Contributor Author

@alexey-milovidov
I think this pr is ready for review. I've made some changes, and now the predicate optimizer does two things:

  • Try move predicates from having to where
  • Try push the predicate down from the current query to the having of the subquery

@zhang2014 zhang2014 force-pushed the fix/some_predicate_bug branch from d06c1bf to 2179935 Compare January 6, 2020 10:39
@zhang2014 zhang2014 force-pushed the fix/some_predicate_bug branch from 9b4f93e to 0f147e3 Compare January 6, 2020 10:59
@alexey-milovidov alexey-milovidov merged commit 58e6041 into ClickHouse:master Jan 9, 2020
@alesapin alesapin added the pr-bugfix Pull request with bugfix, not backported by default label Jan 20, 2020
@alesapin
Copy link
Copy Markdown
Member

too many conflicts in 19.17.

azat added a commit to azat/ClickHouse that referenced this pull request Mar 14, 2024
…imizer_bugs

The behaviour of GROUP BY const in analyzer is slightly different, it
still preserves the const property from the subqueries, and that's why
it simply do not execute filters after GROUP BY, but simply one time for
the const.

The initial bug was about predicate pushdown not about GROUP BY const,
so I will update the test.

I've also tested the initial bug with fiddle and the new test is
idential:
- 19.17 (without the fix) - https://fiddle.clickhouse.com/312a48f4-6a5b-411d-a4bb-4b1a757effaf
- 20.2 (with the fix) - https://fiddle.clickhouse.com/4e1ad2e5-1c03-4ce7-9ac3-e878ccfae83a

Refs: ClickHouse#8503
Refs: ClickHouse#5682

Signed-off-by: Azat Khuzhin <[email protected]>
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.

runningDifference WRONG RESULT with enable_optimize_predicate_expression

3 participants