Repository navigation
fix(sources, semantic_types): refuse a stored dict with a repeated key, at the source and when read as a dict (ITL-907) #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eywalker
merged 12 commits into
main
from
eywalker/itl-907-dict-edge-cases-left-after-the-key-order
Nov 29, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
346acbd
fix(sources, semantic_types): refuse a stored dict with a repeated ke…
eywalker f675815
chore: merge main into the ITL-907 branch
eywalker bd7f60f
fix(sources): validate repeated dict keys on every source stream
eywalker 4e0e293
fix(sources): preserve logical types when checking dict keys
eywalker afe2b16
chore: merge main into the ITL-907 branch
eywalker 3dda273
fix(sources): close repeated dict key review gaps
eywalker 068d98e
chore(merge): incorporate main provenance changes into ITL-907
eywalker 6387ce6
chore: merge main into ITL-907
eywalker 059f749
chore: sync ITL-907 with latest main
eywalker 28744d7
chore: merge main into ITL-907
eywalker d6f5d72
chore: merge main into ITL-907
eywalker eaf0869
fix(sources): validate dict storage consistently and reuse held streams
eywalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ### Breaking changes and migration | ||
|
|
||
| - A source refuses a dict column that holds one key twice in a cell, before presenting it | ||
| (`RepeatedDictKeyError`, an `InputValidationError`, naming the column and the key). To | ||
| Orcapod a bare Arrow list of `struct<key, value>` is a `dict[K, V]`, so this applies to | ||
| any such column of a table built outside Orcapod, at any depth. Remove the repeated | ||
| entries before building the source, or, if the column is meant as a list of pairs, give | ||
| the struct's fields other names. Every source kind applies the check to the rows it | ||
| presents, also to rows read back from a cache (`CachedSource`), from a job node's | ||
| store (`DerivedSource`) and from a SpiralDB table. Python values are checked as they | ||
| are stored: distinct Python keys that store as one key (for example, two floats narrowed | ||
| to the same `float32`) are refused as well. No stored value, path or hash changes (ITL-907). | ||
| Native lists and sets keep their declared element type. The check follows that type | ||
| into any user-class fields that hold dicts. | ||
|
|
||
| ### Fixed | ||
|
|
||
| - A stored dict with a repeated key is no longer read as a Python `dict` that silently lost | ||
| an entry. `as_dict()`, `iter_data()` and a function pod taking the column raise | ||
| `RepeatedDictKeyError`, also for a stream built from an Arrow table of your own, which | ||
| is not scanned when it is built. Two keys are the same key exactly when a Python `dict` | ||
| would keep one of them: `0.0` and `-0.0` are, two nulls are, two NaN keys are not | ||
| (ITL-907). |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ## `src/orcapod/semantic_types/universal_converter.py` | ||
|
|
||
| ### DK1 — A stored dict with a repeated key was read as a dict that lost an entry | ||
| **Status:** resolved | ||
| **Severity:** critical | ||
| **Issue:** ITL-907 | ||
|
|
||
| A `dict[K, V]` column is stored as a list of key/value structs. A table built outside | ||
| Orcapod can hold a cell with one key twice (`[{key: 'a', value: 1}, {key: 'a', value: 2}]`). | ||
| `ArrowTableSource` accepted it; the table and its hash held both entries, while `as_dict()` | ||
| returned `{'a': 2}` and a function pod reading the column received a dict that had silently | ||
| lost an entry. An explicit storage type can also cause distinct Python keys to store as one key. | ||
|
|
||
| **Fix:** Both refusals (developer, November 28, 2026). Which Arrow type is a dict has one | ||
| definition for bare Arrow types, `UniversalTypeConverter.dict_entry_fields`. Sources | ||
| follow declared logical types through native containers and user-class fields and check | ||
| dicts at the table-to-stream boundary (`source_stream`). That covers eager tables, | ||
| polling and SpiralDB batches, and cached or derived rows. The check uses Arrow values | ||
| when storage equality matches Python equality, and decoded keys otherwise. The Python | ||
| dict reader also refuses repeats on raw streams. Both raise `RepeatedDictKeyError` | ||
| with the key and column. Stored layouts and hashes are unchanged. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.