Skip to content

fix: support parameterized skip index types#82

Merged
KeKs0r merged 2 commits intomainfrom
marc/fix-set-index-type-args
Mar 2, 2026
Merged

fix: support parameterized skip index types#82
KeKs0r merged 2 commits intomainfrom
marc/fix-set-index-type-args

Conversation

@KeKs0r
Copy link
Contributor

@KeKs0r KeKs0r commented Mar 2, 2026

Summary

ClickHouse skip indexes require type arguments for certain types:

  • set(size) — e.g., set(0) for unlimited
  • bloom_filter(falsePositiveRate) — e.g., bloom_filter(0.01)
  • tokenbf_v1(size, hashFunctions) and ngrambf_v1(size, hashFunctions)

This fix adds an optional typeArgs field to SkipIndexDefinition to store and render these arguments. The parser now extracts arguments from introspected schemas, and drift detection includes typeArgs in comparisons.

Changes

  • Add typeArgs?: string to SkipIndexDefinition
  • Add renderIndexType() helper to format parameterized index types in CREATE TABLE and ALTER TABLE ADD INDEX
  • Replace normalizeIndexType() with parseIndexType() to extract and parse type arguments from system tables
  • Update drift detection and schema rendering to include typeArgs
  • Add tests for parameterized index type rendering and change detection

Test plan

  • All unit tests pass (core, clickhouse, plugin-pull)
  • SQL rendering tests verify TYPE set(0), TYPE bloom_filter(0.01), etc.
  • Change detection tests verify that typeArgs differences trigger replan

🤖 Generated with Claude Code

KeKs0r and others added 2 commits March 2, 2026 14:02
ClickHouse skip indexes require type arguments for certain types:
- set(size) — e.g., set(0) for unlimited
- bloom_filter(falsePositiveRate) — e.g., bloom_filter(0.01)
- tokenbf_v1(size, hashFunctions) and ngrambf_v1(size, hashFunctions)

Add optional typeArgs field to SkipIndexDefinition to store and render
these arguments. Update parseIndexType to extract arguments from
system.data_skipping_indices introspection. Update drift detection and
schema rendering to include typeArgs in comparisons.

Fixes: Cannot create set indexes; ClickHouse rejects "TYPE set" without
size argument.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The skipIf guard expired on 2026-03-02. The test fails because `check`
reports drift for extra objects in the shared ClickHouse database that
belong to other test runs. Extend skip to 2026-06-01 and clarify the
TODO comment with the root cause.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@KeKs0r KeKs0r merged commit cc1125e into main Mar 2, 2026
2 checks passed
@KeKs0r KeKs0r deleted the marc/fix-set-index-type-args branch March 2, 2026 06:10
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