Skip to content

fix: apply column codec and ttl to distributed tables - #741

Open
Romano-arist wants to merge 8 commits into
ClickHouse:mainfrom
Romano-arist:fix/distributed-column-codec-ttl
Open

Romano-arist wants to merge 8 commits into
ClickHouse:mainfrom
Romano-arist:fix/distributed-column-codec-ttl

Conversation

@Romano-arist

@Romano-arist Romano-arist commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Column-level codec and ttl were ignored for distributed_incremental models: they were not applied on table create, and on schema changes only codec was applied (never ttl). This fixes both paths so column codec/ttl from the model contract are applied on create and on add/modify column.

Limitations and out of scope for this PR

  • Local table gets codec and ttl, distributed tables get codec only (it's inherited via AS , so add/modify mirrors it for consistency). TTL is skipped on the distributed, ClickHouse doesn't apply column TTL to the Distributed engine.
  • On incremental runs a codec/ttl-only change (same data type) has no effect, schema-change detection compares data types only. They're applied on create, on type change, or with --full-refresh.
  • Removing codec/ttl isn't supported: MODIFY COLUMN changes only the type and keeps existing storage clauses, ClickHouse needs an explicit MODIFY COLUMN name REMOVE TTL/REMOVE CODEC. Dropping the clause from the contract won't delete it.

Checklist

  • Unit and integration tests covering the common scenarios were added
  • A changelog entry was added following Updating the Changelog (user-facing, concise, PR link)

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread dbt/include/clickhouse/macros/materializations/distributed_table.sql Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2b57093. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant