Conversation
…ordered series (closes #220) Before this change, calling Series.Get/TryGet with Lookup.Smaller, Lookup.Greater, or the ExactOr variants on an unordered series (and with a missing key for ExactOr variants) silently returned OptionalValue.Missing / None. This masked bugs where callers passed an unordered series by mistake. The fix adds an explicit match arm in LinearIndex.Lookup that raises InvalidOperationException with a clear message, consistent with how other ordered-only operations (windowing, resampling, KeyRange) are already guarded. Co-authored-by: Copilot <[email protected]>
The test 'series with datetime keys preserves time in Format' was failing on Windows because DateTime.ToString() uses the locale's AM/PM format. Apply the same fix as PR #643: use 'yyyy-MM-dd HH:mm:ss' with InvariantCulture for DateTime keys that have a non-zero time component. Co-authored-by: Copilot <[email protected]>
Contributor
Author
|
Commit pushed:
|
9 tasks
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.
🤖 Repo Assist — automated bug fix.
Summary
Fixes #220. Before this change, calling
Series.Get/TryGetwithLookup.Smaller,Lookup.Greater,Lookup.ExactOrSmaller(missing key), orLookup.ExactOrGreater(missing key) on an unordered series silently returnedOptionalValue.Missing/None. This masked programming errors where callers passed an unordered series by mistake.Root Cause
In
src/Deedle/Indices/LinearIndex.fs, theLookupdispatch had guarded arms for inexact semantics (when x.isOrdered). When those guards failed for an unordered index, the catch-all| _ -> OptionalValue.Missingsilently ate the request instead of surfacing an error.Fix
Added an explicit arm before the catch-all:
This is consistent with how other ordered-only operations (
KeyRange, windowing, resampling) are already protected withinvalidOp.Note:
ExactOrSmaller/ExactOrGreaterwith an existing key still return the exact value even in an unordered series — that path is handled earlier in the match and is correct.Tests
Added 4 new assertions to
tests/Deedle.Tests/Series.fs:Lookup.Smalleron existing key in unordered series →InvalidOperationExceptionLookup.Greateron existing key in unordered series →InvalidOperationExceptionLookup.ExactOrSmalleron absent key in unordered series →InvalidOperationExceptionLookup.ExactOrGreateron absent key in unordered series →InvalidOperationExceptionTest Status
✅ All 613 tests pass on Linux (net9.0).