Skip to content

Fix wrong result of non-correlated EXISTS.#87207

Merged
KochetovNicolai merged 2 commits intomasterfrom
fix-exists
Sep 17, 2025
Merged

Fix wrong result of non-correlated EXISTS.#87207
KochetovNicolai merged 2 commits intomasterfrom
fix-exists

Conversation

@KochetovNicolai
Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix possible wrong result of non-correlated EXISTS. It was broken with execute_exists_as_scalar_subquery=1 which was introduced in #85481 and affects 25.8.
Fixes #86415

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Sep 16, 2025

Workflow [PR], commit [120009e]

Summary:

job_name test_name status info comment
Integration tests (arm_binary, distributed plan, 1/4) failure
test_disks_app_interactive/test.py::test_disks_app_interactive_list_directories_default FAIL
test_disks_app_interactive/test.py::test_disks_app_interactive_test_move_and_write FAIL
test_dictionaries_postgresql/test.py::test_background_dictionary_reconnect FAIL

@clickhouse-gh clickhouse-gh bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 16, 2025

executor.emplace(io.pipeline);
while (block.rows() == 0 && executor->pull(block))
while (chunk.getNumRows() == 0 && executor->pull(chunk))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is to replace Block with Chunk because an optimized for EXISTS plan may return a chunk with no columns but non-zero rows.

@novikd novikd self-assigned this Sep 16, 2025
@KochetovNicolai
Copy link
Copy Markdown
Member Author

test_disks_app_interactive is flaky

@KochetovNicolai KochetovNicolai added this pull request to the merge queue Sep 17, 2025
Merged via the queue into master with commit f171353 Sep 17, 2025
238 of 242 checks passed
@KochetovNicolai KochetovNicolai deleted the fix-exists branch September 17, 2025 14:55
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 17, 2025
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-backports-created-cloud deprecated label, NOOP pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR labels Sep 17, 2025
robot-clickhouse-ci-2 added a commit that referenced this pull request Sep 19, 2025
Cherry pick #87207 to 25.8: Fix wrong result of non-correlated EXISTS.
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 19, 2025
clickhouse-gh bot added a commit that referenced this pull request Sep 19, 2025
Backport #87207 to 25.8: Fix wrong result of non-correlated EXISTS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-backports-created-cloud deprecated label, NOOP pr-bugfix Pull request with bugfix, not backported by default pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v25.8-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'SELECT EXISTS' query incorrectly produces 0 on ClickHouse 25.8.1

5 participants