-
Notifications
You must be signed in to change notification settings - Fork 794
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
feat: Support &
, |
, ~
on all ...Predicate
classes
#3668
Merged
Merged
Conversation
This file contains 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
- Initial use-case is `SelectionPredicateComposition` -> `PredicateComposition` - Something similar might be a good idea for `Expression` -> `Expr` in #3616
This functionality is now part of its parent `core.PredicateComposition`
…icateComposition` - Ensures backwards compat if anyone was using this directly - Existing tests not breaking is confirmation that this is safe
Features some specific cases from the user guide - https://altair-viz.github.io/user_guide/transform/filter.html#logical-operands - https://altair-viz.github.io/gallery/line_chart_with_cumsum_faceted.html #695
28 tasks
6 tasks
The original only demonstrated `~`, but I've now included `&`. It also shows mixing `datum` with `PredicateComposition`
mattijn
approved these changes
Nov 3, 2024
dangotbanned
added a commit
that referenced
this pull request
Nov 3, 2024
Makes use of #3668 Resolves #3664 (comment)
dangotbanned
added a commit
to dangotbanned/altair
that referenced
this pull request
Nov 4, 2024
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.
Resolves #695
Description
This PR enables the use of logical composition operators (
&
,|
,~
) directly on all 12 of:...Predicate
classescore.FieldEqualPredicate
core.FieldGTEPredicate
core.FieldGTPredicate
core.FieldLTEPredicate
core.FieldLTPredicate
core.FieldOneOfPredicate
core.FieldRangePredicate
core.FieldValidPredicate
core.LogicalAndPredicate
core.LogicalOrPredicate
core.LogicalNotPredicate
core.ParameterPredicate
It appears this functionality has been desired for some time, but never implemented fully.
api.SelectionPredicateComposition
already contained the code required to get this working - this PR moves that tocore.PredicateComposition
.The change is fully backwards compatible, turning the old class into an alias (1dc15b7)
This also provides a cleaner solution to (#3664 (comment)) - than any of the alternatives documented there
Example
Output
User Guide
Tasks
Other Future Work
expr.core.Expression
->core.Expr
Expression
|expr
|Expr
|ExprRef
) UX & ergonomics #3616agg
,field
utility classes #3505_wrap_composition
Related
Chart.transform_filter(*predicates, **constraints)
#3664when-then-otherwise
in User Guide #3544 (comment)