Skip to content

25.8.15 Backport of #87303 - Fix condition not being moved to PREWHERE in case there is a row policy (version 2)#1345

Merged
zvonand merged 5 commits intoreleases/25.8.15from
backports/25.8.15/87303
Feb 2, 2026
Merged

25.8.15 Backport of #87303 - Fix condition not being moved to PREWHERE in case there is a row policy (version 2)#1345
zvonand merged 5 commits intoreleases/25.8.15from
backports/25.8.15/87303

Conversation

@zvonand
Copy link
Collaborator

@zvonand zvonand commented Jan 27, 2026

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 to CHANGELOG.md):

Fixed move-to-prewhere optimization, which did not work in the presence of row policy (ClickHouse#87303 by @KochetovNicolai)

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Performance tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All with Aarch64
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • Tiered Storage (2h)

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Workflow [PR], commit [d0e8ec2]

@zvonand
Copy link
Collaborator Author

zvonand commented Feb 2, 2026

S3 fails: Altinity/clickhouse-regression#93

Aggregate fails: uniqTheta was updated in upstream, not related, test will be updated separately by QA team

@zvonand zvonand merged commit 8becd9b into releases/25.8.15 Feb 2, 2026
589 of 617 checks passed
@CarlosFelipeOR
Copy link
Collaborator

CarlosFelipeOR commented Feb 2, 2026

QA Verification

Analysis Summary

This PR is a backport of upstream ClickHouse#87303 (with follow-ups ClickHouse#88017 and ClickHouse#88036) to the releases/25.8.15 branch.

Bug Fixed:

The move-to-PREWHERE optimization did not work when row policies were present, causing performance degradation. This fix restructures how row-level filtering interacts with PREWHERE optimization.

New Tests:

Verification Criteria:

Criteria Status
Upstream PR approved and merged
Follow-up PRs included
Backport applies cleanly
CI passing*
Tests cover the fix
Local backport fix reviewed

*Remaining Failures:

Regression Tests

Integration Tests

  • test_async_load_databases/test.py::test_materialized_views_cascaded_multiple
    Flaky upstream integration test caused by a race condition in materialized view processing order after server restart, leading to incorrect data (42,0 instead of 42,2).
    Upstream issue ClickHouse#88572 was fixed in PR 88573, but the fix was not backported to 25.8.
    This test fails frequently on upstream 25.8 sanitizer builds (~14.1%).
    Marked as known flaky test in tests/broken_tests.yaml for 25.8.

  • test_async_load_databases/test.py::test_materialized_views_replicated
    Flaky upstream integration test that fails with "Database test_mv already exists" due to missing cleanup from the previous test (test_materialized_views_cascaded_multiple).
    Both tests fail together as a pair and share the same root cause and upstream fix (ClickHouse#88573), not backported to 25.8.
    This test also fails frequently on upstream 25.8 sanitizer builds (~14.1%).
    Marked as known flaky test in tests/broken_tests.yaml for 25.8.

Notes:

  • Large structural change (54 files) but well-tested upstream
  • Includes backport-specific fix commit.
  • Comprehensive EXPLAIN-based tests verify correct query plan generation

No manual testing required - upstream validation, follow-up fixes, and CI coverage are sufficient for this backport.
Adding verified label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

25.8.16 25.8.16 Stable 25.8.16.10001 25.8.16.10001 Stable verified Verified by QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants