Fix bug join operation with non-annotating table#864
Merged
LucaMarconato merged 1 commit intomainfrom Feb 6, 2025
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #864 +/- ##
==========================================
+ Coverage 91.95% 91.96% +0.01%
==========================================
Files 47 47
Lines 7345 7355 +10
==========================================
+ Hits 6754 6764 +10
Misses 591 591
🚀 New features to boost your workflow:
|
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.
This PR is very small (I modified only
src/spatialdata/_core/query/relational_query.py, the rest is from the new ruff pre-commit).This PR fixes a subtle bug that originated when all the following occurred simultaneously:
This occurred for instance with this code:
This occurred because in the cases above

regionwas astr, not alist[str], and therefore, in the screenshot below,the check in the highlighted line, which should fail (because the table is not annotating the element), instead succeeds (because
nameis a substring ofregions).But
nameis not a valid group ofgroups_df, which leads to aKeyError.Solution
The solution is very simple. Still, two observations (CC @melonora):
regionfrom the metadata Dropregion(region_keyandinstance_keyare enough) #629 and avoid future technical debts, which occurs as this bug showed.left_exclusivejoin #824 (comment). The current PR exemplify the code redundancy.