Repository navigation
fix(value): validate list and array elements against the declared child type - #55
Open
pratik-saptarshi wants to merge 1 commit into
Open
pratik-saptarshi wants to merge 1 commit into
pratik-saptarshi wants to merge 1 commit into
Conversation
…ld type Restacked onto main at 0bbf510 after parent PR LadybugDB#47 merged. This single commit carries the reviewed residual of d7c29d1 (PR LadybugDB#55) unchanged: per-file added/removed line multisets proven byte-identical to the saved residual before pushing.
pratik-saptarshi
force-pushed
the
fix/nested-type-validation-c3
branch
from
November 14, 2026 04:21
d7c29d1 to
7f3880d
Compare
pratik-saptarshi
added a commit
to pratik-saptarshi/ladybug-rust
that referenced
this pull request
Nov 14, 2026
Restacked onto the restacked PR LadybugDB#55 branch (7f3880d) after parent PR LadybugDB#47 merged. This single commit carries the reviewed residual of 0645721 (PR LadybugDB#56) unchanged: per-file added/removed line multisets proven byte-identical to the saved residual before pushing.
pratik-saptarshi
added a commit
to pratik-saptarshi/ladybug-rust
that referenced
this pull request
Nov 14, 2026
Restacked onto the restacked PR LadybugDB#55 branch (7f3880d) after parent PR LadybugDB#47 merged. This single commit carries the reviewed residual of 43fcc7b (PR LadybugDB#57) unchanged: per-file added/removed line multisets proven byte-identical to the saved residual before pushing.
Contributor
Author
|
Restack note: this branch was rebuilt after PR #47 merged into main (merge commit — Musebot-Astro |
This was referenced Nov 14, 2026
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.
Addresses #50. Stacked on #47: this branch is based on the head of #47 (
fix/decimal-conversion-f1-f3), so until #47 merges the diff includes its commits. The new work is the top two commits.Problem
Value::List(LogicalType, Vec<Value>)andValue::Array(LogicalType, Vec<Value>)carry a caller-declared child type. The write conversion inserted the converted elements under the declared type without checking them against it, and the engine reinterprets each element at the declared width at storage time:List(Int32, [Int64(4294967301)])bound into anINT32[]column inserted successfully and read back asInt32(5).Array(Int16, [Int64(70000), Int64(-70000)])read back as[4464, -4464].No error at any layer. The binding is the only layer that can catch this, because the engine accepts the internally inconsistent value.
Fix
Every element of a
ListorArrayis validated against the declared child type before conversion; a mismatch returns the newConversionError::TypeMismatch(declared type, actual type). Types must match exactly, with one exactness-preserving exception: a decimal value may be stored under a declared decimal type with the same scale and at least the value's precision. Nested lists are covered from both sides — an inner list's own elements are validated against its declared child type when it is converted, and the inner list's declared type must match the outer declared type. The validation helper (check_nested_type) is shared so the map (#51) and union (#52) fixes can reuse it.Tests
list_and_array_child_type_mismatch_returns_error— the two reproductions above, a heterogeneous list, a nested list with a mismatched inner declared type, and a decimal exceeding the declared precision.list_and_array_child_type_match_round_trips— matching elements, including a decimal stored under a wider declared precision at the same scale, round-trip unchanged.list_mismatched_child_type_fails_insert— the original database reproduction now fails at execute time instead of storing a truncated element.Full library test suite: 195 passed, 0 failed.
— Musebot-Astro