-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Fix Not-ready Set exception when IN subquery is moved to PREWHERE #100375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexey-milovidov
wants to merge
31
commits into
master
Choose a base branch
from
fix-in-subquery-prewhere-not-ready-set
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
00f0916
Fix "Not-ready Set" exception when IN subquery is moved to PREWHERE
alexey-milovidov 75bb6ec
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov c72b03a
Merge branch 'master' into fix-in-subquery-prewhere-not-ready-set
alexey-milovidov 7572716
Skip GLOBAL IN sets in `buildSetsForDAG` when building PREWHERE sets
alexey-milovidov 1fdae6a
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov d56437e
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 89f66e5
Fix CI: update test references and handle null-aware GLOBAL IN variants
alexey-milovidov 4b3f5d6
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 9414477
Address review: centralize global IN check, add GLOBAL IN PREWHERE test
alexey-milovidov 975768d
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 227d460
Prevent GLOBAL IN from being moved to PREWHERE; rename test to avoid …
alexey-milovidov 3d3306c
Update test references: GLOBAL IN no longer moved to PREWHERE
alexey-milovidov 4b5a079
Merge branch 'master' into fix-in-subquery-prewhere-not-ready-set
alexey-milovidov 9ea1766
Merge branch 'master' into fix-in-subquery-prewhere-not-ready-set
alexey-milovidov cbb06bc
Merge branch 'master' into fix-in-subquery-prewhere-not-ready-set
alexey-milovidov 866515f
Merge branch 'master' into fix-in-subquery-prewhere-not-ready-set
alexey-milovidov ce16565
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 2f88a79
Build ordered sets in PREWHERE so KeyCondition can use them for index…
alexey-milovidov 8085f6c
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov e519f5e
Update test references and pin settings for sets-built-in-PREWHERE
alexey-milovidov 9768b76
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 395b7ad
Pin `optimize_move_to_prewhere = 1` in `03800_autopr_reuse_index_anal…
alexey-milovidov 0dcddf7
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov bb1b0c8
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 8b24f30
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 31e5af2
Skip set building in `updatePrewhereInfo` for parallel replicas plan
alexey-milovidov 279654e
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov a418b55
Revert `03800_autopr_reuse_index_analysis` reference to master values
alexey-milovidov 8c43b95
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov ad31410
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov 0052a6b
Merge remote-tracking branch 'origin/master' into fix-in-subquery-pre…
alexey-milovidov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
tests/queries/0_stateless/03457_move_global_in_to_prewhere.reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,13 @@ | ||
| 3 2048 | ||
| 23 2048 | ||
| Prewhere filter column: globalIn(key, ) (removed) | ||
| 3 2048 | ||
| Prewhere filter column: globalIn(key, ) (removed) | ||
| 0 2048 | ||
| 1 2048 | ||
| 2 2048 | ||
| 4 2048 | ||
| 5 2048 | ||
| Prewhere filter column: globalNotIn(key, ) (removed) | ||
| 0 2048 | ||
| 1 2048 | ||
| 2 2048 | ||
| 4 2048 | ||
| 5 2048 | ||
| Prewhere filter column: globalNotIn(key, ) (removed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
27 changes: 27 additions & 0 deletions
27
tests/queries/0_stateless/04053_in_subquery_prewhere_not_ready_set.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| -- Regression test for "Not-ready Set" error when IN (subquery) condition | ||
| -- gets moved to PREWHERE by optimizePrewhere after applyFilters already ran. | ||
| -- https://github.com/ClickHouse/ClickHouse/issues/100318 | ||
|
|
||
| CREATE TABLE t_100318_log (v0 UInt32) ENGINE = Log; | ||
| CREATE TABLE t_100318_mt (v0 UInt32, v1 UInt32, v2 DateTime, PRIMARY KEY(v1)) ENGINE = SummingMergeTree; | ||
| CREATE TABLE t_100318_rmt (v0 UInt32, v1 UInt32, PRIMARY KEY(v0)) ENGINE = ReplacingMergeTree; | ||
|
|
||
| INSERT INTO t_100318_mt VALUES (13, 23000, '2100-01-05'); | ||
| INSERT INTO t_100318_mt VALUES (16, 26000, '2066-10-07'); | ||
| INSERT INTO t_100318_rmt VALUES (91, 101000); | ||
|
|
||
| SELECT 1 FROM (SELECT 1 FROM t_100318_log) | ||
| WHERE EXISTS ( | ||
| SELECT 1 | ||
| UNION ALL | ||
| SELECT ref_4.v0 FROM ( | ||
| SELECT row_number() OVER (PARTITION BY t_100318_mt.v0) AS c_1 | ||
| FROM t_100318_mt | ||
| WHERE t_100318_mt.v2 IN (SELECT 1 FROM t_100318_log) | ||
| ) AS ref_3 | ||
| INNER JOIN t_100318_rmt AS ref_4 ON (ref_3.c_1 = ref_4.v0) | ||
| ); | ||
|
|
||
| DROP TABLE t_100318_log; | ||
| DROP TABLE t_100318_mt; | ||
| DROP TABLE t_100318_rmt; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regression test covers local
IN (subquery)moved to PREWHERE, but the new logic inbuildSetsForDAGExcludingGlobalInis specifically aboutGLOBAL INvariants (globalIn,globalNotIn,globalNullIn,globalNotNullIn).Could you add a dedicated test where
GLOBAL INis moved to PREWHERE (ideally also withtransform_null_in=1), so we lock in the fix for the external-table attachment path and prevent regressions ofTrying to attach external table to a ready set?