Skip to content

Do not apply lazy materialization for plans with array join#101644

Open
vdimir wants to merge 3 commits into
masterfrom
vdimir/lazy_materialization_array_join
Open

Do not apply lazy materialization for plans with array join#101644
vdimir wants to merge 3 commits into
masterfrom
vdimir/lazy_materialization_array_join

Conversation

@vdimir
Copy link
Copy Markdown
Member

@vdimir vdimir commented Apr 2, 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 into CHANGELOG.md):

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Apr 2, 2026

Workflow [PR], commit [bcda4f2]

Summary:

job_name test_name status info comment
Stateless tests (amd_tsan, flaky check) failure
03172_error_log_table_not_empty FAIL cidb
03172_error_log_table_not_empty FAIL cidb
03172_error_log_table_not_empty FAIL cidb
Stateless tests (amd_msan, flaky check) failure
03172_error_log_table_not_empty FAIL cidb
Integration tests (amd_tsan, 2/6) failure
test_storage_kafka/test_batch_slow_6.py::test_kafka_handling_commit_failure FAIL cidb

AI Review

Summary

This PR prevents optimizeLazyMaterialization2 from being applied when the expression/filter chain between sorting and ReadFromMergeTree contains arrayJoin, which fixes incorrect LIMIT/OFFSET behavior reported in #101608. The added guard and new stateless test are aligned with the bug scope, and I did not find correctness, safety, or performance regressions in the changed code.

ClickHouse Rules
Item Status Notes
Deletion logging
Serialization versioning
Core-area scrutiny
No test removal
Experimental gate
No magic constants
Backward compatibility
SettingsChangesHistory.cpp
PR metadata quality
Safe rollout
Compilation time
Final Verdict
  • Status: ✅ Approve

@antaljanosbenjamin antaljanosbenjamin self-assigned this Apr 2, 2026
@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 7, 2026
@vdimir vdimir force-pushed the vdimir/lazy_materialization_array_join branch from eab7648 to bcda4f2 Compare April 8, 2026 09:50
@vdimir
Copy link
Copy Markdown
Member Author

vdimir commented Apr 8, 2026

Stateless tests (amd_tsan, flaky check) failure
03172_error_log_table_not_empty FAIL cidb
03172_error_log_table_not_empty FAIL cidb
03172_error_log_table_not_empty FAIL cidb
Stateless tests (amd_msan, flaky check) failure
03172_error_log_table_not_empty FAIL cidb

Fix #102047

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented Apr 8, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.00% +0.00%
Functions 90.90% 90.90% +0.00%
Branches 76.50% 76.40% -0.10%

Changed lines: 87.10% (27/31) · Uncovered code

Full report · Diff report

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.

Bad arrayJoin result with optimize_read_in_order and query_plan_execute_functions_after_sorting disabled

2 participants