OR, XOR and NOT in filters #296
Draft
yfukai wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #296 +/- ##
==========================================
- Coverage 87.75% 87.73% -0.02%
==========================================
Files 57 57
Lines 4947 5055 +108
Branches 872 899 +27
==========================================
+ Hits 4341 4435 +94
- Misses 381 393 +12
- Partials 225 227 +2 ☔ View full report in Codecov by Sentry. 🚀 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.
Human summary
Currently only "AND" concatenation is supported for the
AttrComparison. I updated theAttrcodebase to support intuitive "OR", "XOR" and "NOT" operations (nowAttrFilterexists for this purpose). I chose not to allow combining node and edge filters inAttrFiltersince that would complicate the codebase significantly.Copilot summary
This pull request introduces a new
AttrFilterclass to enable expressive, compound boolean filtering of node and edge attributes using logical operators (&,|,^,~). It updates the API throughout the codebase to support these compound filters, allowing for more flexible and readable queries.Major new feature: Compound attribute filtering
AttrFilterclass, which allows combiningAttrComparisonobjects (and nestedAttrFilters) using logical operators (&,|,^,~) to build complex boolean filters for graph queries. This enables expressions like(NodeAttr("t") == 1) | (NodeAttr("t") == 2)and ensures that filters are type-safe and validated.API and type annotation updates
filter,split_attr_comps, etc.) to accept bothAttrComparisonandAttrFilterobjects, using the newFilterInputtype alias. This ensures that all relevant methods and internal logic can handle compound filters transparently. [1] [2] [3] [4] [5] [6] [7]Filtering logic and backend improvements
Documentation and usage examples
attrs.pyto explain and demonstrate the use of logical operators for combining attribute comparisons, with clear code examples for users.Comprehensive testing for new filter functionality
AttrFiltercovering construction, operator overloading, error handling, filter splitting, and evaluation with polars, ensuring robust and correct behavior for all supported logical operations. [1] [2]