-
Notifications
You must be signed in to change notification settings - Fork 0
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
start of work to match cql2 against json #55
Conversation
So, trying to set this up so that the reduce function can actually be used for any CQL2 expression to collapse things that don't need to go through to the base data. So say you had a CQL2 query like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know CQL so I didn't look too closely at the body of reduce
(yet)
Co-authored-by: Pete Gadomski <[email protected]>
Co-authored-by: Pete Gadomski <[email protected]>
src/geometry.rs
Outdated
@@ -45,6 +49,18 @@ impl Geometry { | |||
} | |||
} | |||
|
|||
impl PartialEq for Geometry { | |||
fn eq(&self, other: &Self) -> bool { | |||
self.to_wkt().unwrap() == other.to_wkt().unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably just return false if to_wkt
fails, not unwrap
* fix: take ownership when reducing * fix: remove identical branches
This PR adds a reduce and match function to Expr. Both functions take an optional json argument that will be used to get the values of any properties to compare against.
expr.reduce(json) will attempt to solve any operations. If there is no json, this will reduce the expression by evaluating any operations that use constants. If there is a json passed in, it will pull any properties from that json and turn them into constants before trying to reduce.
expr.matches(json) will attempt to reduce the expression and if that expression gets reduced to just a single Expr::Bool, it will return that value.