Repository navigation
Conversation
|
@claude review |
1 similar comment
|
@claude review |
|
@claude review |
|
@claude review |
…ields `refuse_key_fields_that_changed_identity` checked only the definitions a list allocates. A writer that carries a retained definition plans whatever it publishes alongside the list (metadata derived from the keys, a removal) against the key fields as it read them, so a key renamed, retyped or re-parented between its read snapshot and the landing manifest invalidates that plan just as it would an allocation. Every listed definition's key fields must now keep their identity; the refusal is the same commit conflict, and unrelated appends and metadata writes still rebase. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ined list A retained definition whose key is dropped between the writer's read and the landing manifest is refused like a rename or a cast, while a key that was already absent when the writer read the table is history: such a list still lands, allocates and removes. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…key as a conflict A key field's identity is its path of names and logical types from the root, so renaming a nested key's parent struct is a change while metadata or nullability edits below it are not. A key the writer read that the landing schema no longer has is a changed dependency for every listed definition, new or retained, and refuses as the same commit conflict; a key the writer's own snapshot already lacked stays history. The Merge fence uses the same identity. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Comparing only the path to a key let a struct key's child be retyped, renamed, added or removed under a carried list, since a struct's logical type names no children. The identity now also compares every descendant's id, name and logical type in order, while metadata and nullability edits anywhere still rebase, and a primitive key inside a struct still does not depend on its siblings. The Merge fence shares the helper. Co-Authored-By: Claude Fable 5.1 <[email protected]>
134a58d to
2a444d1
Compare
|
@claude review |
…dependency Brings the test-fixture initializers from lance-format#10427 and the compaction changes from lance-format#10440; the key-dependency change touches none of those files. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…tdoc The previous commit added the rewritten doc without removing the old block above it, leaving two descriptions; only the current one stays. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
14c8065: the previous doc commit left the superseded rustdoc block in place above the new one; removed. Documentation only. |
|
@claude review |
…ce, and lets additive merges through `keeps_every_field_identity` compared every read field by walking both schemas' ancestries and equating whole subtrees, so a concurrent Merge that only added a child under a struct was refused although added fields are meant to be fine, and the walk allocated quadratically on wide schemas. It now builds one map of the landing fields and checks each read field shallowly: same name, logical type and parent under its id. Every read field is visited, so a parent's identity covers the path above it and a child's the shape below; a renamed, retyped, moved or missing read field is still refused. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@claude review |
…ile is written An id in the dependency list that the definitions list does not hold was refused inside the manifest build, after the transaction file had been written, leaving an orphan file behind. The builder now refuses it beside its existing precheck, before any I/O; the build-time check stays as the authority. A unit test pins the first-activation fence's contract on a struct the writer read: an added child is compatible, a renamed, retyped, missing or moved child is not. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@claude review |
…pendencies Drop CommitBuilder::with_clustering_dependencies and its ManifestWriteConfig / ManifestBuildConfig plumbing. The commit already carries the read manifest and the complete desired list, so the definitions it allocates are the ones whose id lies above the read manifest's max_clustering_id; every one of them is checked against the landing schema from the read schema (field id and logical type along the path and typed subtree), not only the highest, and a failure in any refuses the whole commit. The mark is the read snapshot's and stays fixed across rebase attempts; retained definitions are not prerequisites, and the allocator and first-activation fence are unchanged. Tests cover two allocations in one submission with a retype or drop on the lower id, the allocation mark versus the largest present id, same-id rename, timestamp unit/timezone, retained keys changing under an unrelated submission, and re-planning from the landing snapshot. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@claude review |
There was a problem hiding this comment.
The updated PR description and example now match the allocation-only guard; the earlier documentation request is addressed.
A later spec update for a retained definition can still publish after a key type change. To use this guard for spec publication, allocate a fresh definition and publish the spec in the same commit.
The allocation-key and manifest-build tests passed locally. Dataset integration tests remain unverified locally.
Please mark this PR with the breaking-change label.
What this PR does
When committing new clustering definitions, reject concurrent column type changes or deletions, but allow renames that preserve the field ID and type.
Clustering groups rows with similar column values together. An application saves two kinds of information to do this:
customer_idandevent_time. Lance calls the record of their field IDs a clustering definition.Why field IDs are not enough
A column has a name and a field ID. The name is what users write in SQL; the field ID identifies the column inside Lance. Clustering definitions use field IDs because they survive renames:
customer_idcan becomeaccount_idwithout becoming a different column.When the first clustering definition is allocated, Lance enables its existing non-reusable field-ID protection. A rename keeps the ID, and a dropped column's ID cannot be reused for a newly added column. This prevents a definition from accidentally referring to a different column that happens to reuse the old ID.
However, a stable field ID does not freeze the column's type. The type can still change, even when the field ID stays the same.
Why clustering depends on the type
Clustering methods commonly normalize each selected column into a numerical coordinate before grouping rows. That conversion depends on the column's logical type: an integer, a string and a timestamp need different handling. For timestamps, even the unit matters: interpreting the same number as seconds or milliseconds produces different values.
A clustering spec records the rules prepared from those typed values. If those rules are saved together with a new definition, the commit must not succeed after a selected column changes type. A rename alone does not change how the values are normalized.
The race this PR prevents
Suppose an application is preparing a new definition and grouping rules for
customer_id: int64:customer_idto a different type before the worker commits the new definition and rules together.Checking the schema before submitting the commit is not enough: another writer can change it after that check. Lance therefore checks again inside the commit path, including when retrying against a newer table version.
The scope is new definitions only. An update that only attaches rules to an already allocated definition does not get this type-change protection. To protect publication of those rules with this check, allocate a new definition and save both in the same commit.
If the other writer only renames
customer_idtoaccount_id, keeping the same field ID and type, this typed-field check allows the commit. Unrelated appends and unrelated schema changes do not invalidate these columns either. The first activation of non-reusable field IDs retains its existing stricter identity checks.How callers use it
Callers supply the complete desired definition list through the existing API. No separate dependency list is required:
Lance automatically compares definition IDs with
max_clustering_idfrom the transaction's original read manifest. Every ID above that allocation high-water mark is new and must be checked. The mark does not fall when old definitions are removed, and it stays fixed across commit retries.For example, if the read mark is
10and the submission adds11and12, Lance checks every selected column in both definitions, not just12. A type change or deletion affecting either definition rejects the entire commit; neither the new definitions nor their accompanying metadata are published.The check includes timestamp units/time zones and nested field structure, but ignores column names. A missing or incompatible field causes a commit conflict; the caller must reload and validate its request.
New-allocation checking already exists in #10383. This PR makes its field comparison type-based rather than name-based and allows additive schema changes through the first-activation identity fence without repeated ancestry scans. Retained definitions do not become extra column-type dependencies; existing allocation/removal conflict checks remain in place.