feat: Allow INDEX syntax sugar for projections with _part_offset#651
feat: Allow INDEX syntax sugar for projections with _part_offset#65129antonioac wants to merge 3 commits into
INDEX syntax sugar for projections with _part_offset#651Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 06962eb. Configure here.
| res = run_dbt(["run", "--select", "no_query_or_index"], expect_pass=False) | ||
| assert any( | ||
| "must specify either 'query' or 'index'" in (r.message or "") for r in res.results | ||
| ) |
There was a problem hiding this comment.
Missing seed call creates implicit test ordering dependency
Medium Severity
test_raises_when_neither_query_nor_index omits the run_dbt(["seed"]) call that every other test in this file includes. The model references {{ source('raw', 'people') }}, and the materialization template executes CREATE TABLE ... EMPTY AS (SELECT ... FROM people) before calling add_index_and_projections where the expected validation error is raised. Without the seed table in the database, the model fails at table creation with a missing-table error instead of the projection validation error, causing the assertion checking for "must specify either 'query' or 'index'" to fail for the wrong reason.
Reviewed by Cursor Bugbot for commit 06962eb. Configure here.


Summary
indexparameter toprojectionsmodel config to allow setting index projections nicer.ADD PROJECTION my_projection INDEX my, columns TYPE basicif ClickHouse 26.1+ADD PROJECTION my_projection (SELECT _part_offset ORDER BY my, columns)if ClickHouse 25.6+INDEXsyntax to add projections with_part_offsetfrom 26.1 #650Checklist
Delete items not relevant to your PR:
Note
Low Risk
Scoped to projection DDL generation in table materialization with backward-compatible
querybehavior and compile-time guards; main risk is wrong version-specific SQL on edge ClickHouse versions.Overview
Adds an optional
indexfield on each entry in theprojectionsmodel config so you can declare lightweight index projections without writing rawADD PROJECTIONSQL. Theadd_index_and_projectionsmacro still emitsADD PROJECTION … (query)whenqueryis set; withindexonly, it builds version-specific DDL:INDEX … TYPE basicon ClickHouse 26.1+, or(SELECT _part_offset ORDER BY …)on 25.6–26.0. Compile-time errors blockquery+index, missing both, orindexon servers before 25.6. The 1.10.1 changelog documents the feature; integration tests cover happy paths, validation messages, and version gating (existing projection tests were reformatted).Reviewed by Cursor Bugbot for commit 06962eb. Bugbot is set up for automated code reviews on this repo. Configure here.