Skip to content

fix(clickhouse): accept ClickHouse Cloud SharedMergeTree engines - #1168

Closed
kvlonge wants to merge 2 commits into
mainfrom
fix/clickhouse-shared-merge-tree
Closed

kvlonge wants to merge 2 commits into
mainfrom
fix/clickhouse-shared-merge-tree

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Why

ClickHouse Cloud uses the SharedMergeTree engine family. Model validation rejected every Shared* engine name, so a model could not name SharedMergeTree or SharedReplacingMergeTree explicitly, even though Cloud already turns a plain MergeTree into SharedMergeTree.

Changes

  • Model validation accepts Shared* MergeTree-family engines like their MergeTree counterparts. Replicated* engines and engines outside the MergeTree family are still rejected; the error now says "non-replicated MergeTree-family".
  • The ClickHouse adapter has no engine-name logic: DDL renders the configured engine verbatim, and partition rewrites, clones and promotion use CREATE TABLE ... AS, ATTACH/REPLACE PARTITION ... FROM and EXCHANGE TABLES, which copy the source table's engine. Shared tables therefore take the same paths as MergeTree tables. FINAL reads come from the source final flag, not the engine name.
  • Docs: the ClickHouse adapter page lists Shared* engines as accepted, best effort and untested on ClickHouse Cloud. Skill reference pages are regenerated.

Verification

  • cargo test -p sqlbuild-model-config physical_storage: Shared variants accepted, ReplicatedReplacingMergeTree and SharedSet rejected.
  • pytest tests/unit/src/sqlbuild/adapters/clickhouse/test_table_layout.py: DDL with SharedMergeTree and SharedReplacingMergeTree(version).
  • make check-ci passed (clippy, fmt, ruff, ty, fensu, docs skill check).
  • No ClickHouse Cloud access, so there is no live test, and the local ClickHouse server cannot run Shared engines.

Shared* MergeTree engines now pass model validation like their
MergeTree counterparts. Replicated* engines stay rejected. Support is
best effort and untested on ClickHouse Cloud.
@kvlonge
kvlonge enabled auto-merge (squash) October 19, 2026 22:17
@kvlonge

kvlonge commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of one combined PR (H2 + fensu 0.27 + SharedMergeTree on top of the merged deadlock fix) so these share a single CI run; the branch is being fixed for an interaction between H2's broken-pipe parity tests and the merged changes.

@kvlonge kvlonge closed this Oct 19, 2026
auto-merge was automatically disabled October 19, 2026 23:21

Pull request was closed

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