Fix premature TTL column removal causing merge failures and wrong defaults#88860
Fix premature TTL column removal causing merge failures and wrong defaults#88860jkartseva merged 20 commits intoClickHouse:masterfrom
Conversation
…aults. When column-level TTLs expired, columns were sometimes removed too early (before DEFAULT expression evaluation or before merge-time transforms that expect them to exist). As a result: - Missing columns were filled with **type defaults** instead of the column’s **table-defined DEFAULT** expression. - Skip index statistics became incorrect because indexes were computed using wrong default values. - Merge algorithms depending on certain columns (e.g. GraphiteMergeTree’s `Timestamp`, VersionedCollapsingMergeTree’s `sign`, ReplacingMergeTree’s `version`, or AggregatingMergeTree’s state columns) could fail with `Not found column ... in block` errors. Now TTL-expired columns are properly handled.
|
Workflow [PR], commit [3deb13e] Summary: ❌
|
There was a problem hiding this comment.
Looks good. Could you please add a test for one of the engines mentioned in the changelog?
Merge failures in GraphiteMergeTree, VersionedCollapsingMergeTree, ReplacingMergeTree, and AggregatingMergeTree when TTL-removed columns were still required by merge logic.
Sure. I've added more tests and fixed more issues. |
|
Thanks for the PR! Looks like the tests has failed, unfortunately =\ |
It should be fine now. |
|
I wrote a test, unfortunately, it fails as following: You can launch it locally as |
Thanks! The test passes now. |
|
Now it exposes additional issues: dependencies in default expressions are not handled correctly during column TTL. I’ll work on a proper fix. |
|
Any plans to backport to v25.8? |
Cherry pick #88860 to 25.10: Fix premature TTL column removal causing merge failures and wrong defaults
…rge failures and wrong defaults
Cherry pick #88860 to 25.11: Fix premature TTL column removal causing merge failures and wrong defaults
…rge failures and wrong defaults
Backport #88860 to 25.10: Fix premature TTL column removal causing merge failures and wrong defaults
Backport #88860 to 25.11: Fix premature TTL column removal causing merge failures and wrong defaults
Cherry pick #88860 to 25.8: Fix premature TTL column removal causing merge failures and wrong defaults
…ge failures and wrong defaults
Backport #88860 to 25.8: Fix premature TTL column removal causing merge failures and wrong defaults
Cherry pick #88860 to 25.9: Fix premature TTL column removal causing merge failures and wrong defaults
…ge failures and wrong defaults
…sing merge failures and wrong defaults"
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed several issues caused by premature column removal in TTL. Resolves #88002
Documentation entry for user-facing changes
Details