Repository navigation
fix: spurious schema change for named Tuple columns on the HTTP driver - #836
Open
Ragdoll-dbs wants to merge 5 commits into
Open
Ragdoll-dbs wants to merge 5 commits into
Ragdoll-dbs wants to merge 5 commits into
Conversation
Ragdoll-dbs
force-pushed
the
fix/http-named-tuple-schema-change
branch
from
November 27, 2026 19:27
ec64995 to
58132aa
Compare
AI review gate — AI review passedClean review from: Cursor Bugbot. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit dd45a0c. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #835
On the HTTP driver, incremental models with
on_schema_change: failorappend_new_columnsfail when they have a namedTuplecolumn, even though the schema hasn't changed:check_incremental_schema_changescompares type names as plain strings, but the two sides come from different places:system.columns, which uses the server's spelling:Array(Tuple(id UInt64, name String, request_count UInt64)).JSON(max_dynamic_paths = 10)where the server writesmax_dynamic_paths=10.The bug already existed, but #802 made it much more common. Models without a
unique_keyused to skip the schema check, and they now run it.The schema check now compares both types with
comparable_type_name()(incolumn.py), which ignores quotes that aren't needed, whitespace around(,),,and=, and escaping differences. String literals such as Enum values and time zones are left as they are.The comparison is shared by
incremental,distributed_incremental,table(mv_on_schema_change) andmaterialized_view, so the fix covers all four. On the native driver both sides already used the server's spelling, so nothing changes there.Tests:
tests/unit/test_type_comparison.py):it's, and JSON parameters.check_incremental_schema_changesignores the HTTP spelling but still detects a real type change inside a tuple.TestNamedTupleSchemaChange: it mirrors the model from on_schema_change fails with a spurious type change for named Tuple columns on the HTTP driver since 1.10.4 #835, with nounique_key,on_schema_change='fail'and an empty array of named tuples, plus a tuple whose elements are namedfromandtable.Checklist
Delete items not relevant to your PR:
Note
Medium Risk
Touches shared schema-change and contract validation paths; logic is comparison-only (DDL unchanged) but incorrect normalization could mask real type mismatches.
Overview
Fixes false schema-change and contract failures on the HTTP driver when column types are semantically the same but spelled differently (e.g.
Tuple(id UInt64)vsTuple(\id` UInt64), orJSON(max_dynamic_paths=10)vs spaced=`).Adds
comparable_type_name()incolumn.pyto normalize identifier quoting and punctuation spacing for comparisons only, plusadapter.data_types_match()wired intocheck_incremental_schema_changesandclickhouse__get_assert_columns_equivalentsoon_schema_change/mv_on_schema_changeand enforced contracts compare normalized types instead of raw strings. Unit and integration tests cover named tuples, JSON, and real type changes inside tuples.Reviewed by Cursor Bugbot for commit e9b7d66. Bugbot is set up for automated code reviews on this repo. Configure here.