feat(datacube): deterministic dimension ordering in from_datacube#107
Merged
Conversation
- from_datacube now sorts remaining (unordered) dimensions alphabetically for deterministic tree structure - When order is provided, unlisted dimensions are appended in sorted order - When order is None, all dimensions are sorted alphabetically - Add unit tests for explicit, no-order, and partial-order cases
This was referenced Jun 23, 2026
mathleur
approved these changes
Jul 10, 2026
mathleur
marked this pull request as ready for review
July 10, 2026 10:34
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
Makes
from_datacubeproduce deterministic tree structure regardless of HashMap iteration order.Problem
Previously, dimensions not specified in the
orderparameter were iterated from theHashMapin arbitrary order, meaning the same datacube could produce different tree structures across runs.Solution
orderisNone: all dimensions are sorted alphabetically.orderisSome: specified dimensions come first in order, remaining dimensions are appended alphabetically.Tests
from_datacube_with_explicit_order: verifies explicit ordering is respectedfrom_datacube_no_order_falls_back_to_alphabetical: verifies alphabetical defaultfrom_datacube_partial_order_appends_remaining_alphabetically: verifies hybrid casePart of the split from #102. Independently mergeable.