Skip to content

chore: bump clickhouse-sql-parser to v1.1.1, Go 1.27, ClickHouse 26.8 - #251

Merged
orian merged 2 commits into
mainfrom
chore/clickhouse-26.8
Sep 28, 2026
Merged

orian merged 2 commits into
mainfrom
chore/clickhouse-26.8

Conversation

@orian

@orian orian commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • bump github.com/orian/clickhouse-sql-parser v1.0.2 → v1.1.1 (major breaking release); it requires Go 1.27, so go.mod is go 1.27 and the Dockerfile builder is golang:1.27-alpine
  • move docker-compose server and keeper to ClickHouse 26.8 LTS (26.8.11.7)
  • sql2hcl: a second SETTINGS clause silently discards the engine's settings #250: Kafka with a trailing query-level SETTINGS clause now keeps all kafka_* settings (parser#35 fixed); the interim fail-loudly guard is removed
  • TimeSeries RECENT SAMPLES target (new in 26.8, on by default) as recent_samples {}; every TimeSeries table failed to introspect on 26.8 without it
  • TimeSeries inner tables keep ttl, settings and full column definitions (codec/default); inner ttl is canonicalized like a table TTL. Without the TTL, a recreated recent-samples table never expires its data
  • sqlgen emits a TimeSeries table's SETTINGS before its target clauses (after them they are query-level, and ClickHouse rejects recent_samples_ttl_seconds)
  • fix: TimeSeries target diff compared the inner engine's HCL body, so any loaded inner {} target always differed from its introspected twin
  • single-column ORDER BY/PRIMARY KEY emitted bare (26.8 stores (id) verbatim)

The parser's other breaking changes (new ASTVisitor methods, nil TableIndex.Granularity, position changes) needed no code changes here.

Follow-ups (not in this PR, recorded in the plan doc)

  • a bare engine "time_series" {} never compares clean against the live table (synthesized columns, .inner_id.* tables, and on 26.8 the fully spelled-out default targets)
  • sql2hcl drops a query-level SETTINGS flatten_nested = 0

Tests

  • new timeseries_recent_samples_test.go: 26.8 default DDL introspect → sqlgen → re-introspect round trip, dump → load with no drift, inner TTL canonicalization
  • Kafka double-SETTINGS round-trip test replaces the fail-loudly test
  • go test ./...
  • go test -race ./internal/... ./cmd/...
  • go test ./test ./internal/loader/hcl -clickhouse against ClickHouse 26.8.11.7
  • go vet ./...

Closes #250.

Parser v1.1.x fixes the two upstream bugs that blocked the 26.8 move:
a repeated SETTINGS clause no longer overwrites the engine's
(orian/clickhouse-sql-parser#35), and TimeSeries RECENT SAMPLES targets
parse (#36). The parser requires Go 1.27, so go.mod and the Dockerfile
builder move to 1.27.

Kafka with a trailing query-level SETTINGS clause (#250) now round-trips
all kafka_* settings; the interim fail-loudly guard is removed, the
resolver still rejects a Kafka engine with no configuration.

ClickHouse 26.8 (docker-compose server and keeper):
- single-column ORDER BY / PRIMARY KEY are emitted bare, since 26.8
  stores the parenthesised form verbatim;
- TimeSeries gains a recent_samples target; inner target tables now
  keep ttl, settings and full column definitions (introspection used to
  drop the settings and keep only column name/type), and inner ttl is
  canonicalized like a table TTL;
- a TimeSeries table's SETTINGS are emitted before its target clauses;
  after them they are query-level and ClickHouse rejects engine
  settings such as recent_samples_ttl_seconds;
- TimeSeries target comparison ignores the inner engine's HCL body,
  which made every loaded inner target differ from its introspected
  twin.

Closes #250.
The v2.12.2 prebuilt binary is built with go1.26 and refuses to lint a
go 1.27 module. v2.14.0 is built with go1.27.0 and reports no issues.
@orian
orian merged commit 4dc6e5b into main Sep 28, 2026
16 checks passed
@orian
orian deleted the chore/clickhouse-26.8 branch September 28, 2026 15:33
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.

sql2hcl: a second SETTINGS clause silently discards the engine's settings

1 participant