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
[Feature]: Map,Reduce,Filter in AQL with Special Aggregation Types #611
Comments
As a smaller proposal I’d try to model this with two new features: aggregating into an object with dynamic keys, and lambdas. The right-hand side of the
The above is suitable when there are not so many location updates and lots of users. If there are only a few users, the below would be faster:
If in the first case we want to keep also the previous location, we could do it like this:
(actually I found that the update function needs on the |
Is it safe to have a lambda replacement for a value? I am concerned that, if we introduce lambda in different place, different circumstances, it will work differently? (e.g.. If we introduce lambda in other place than aggregate, then it will behave differently, different param is supplied into the lambda) |
You’re asking the right question: before introducing lambdas we need to decide on very clear semantics for them. This does not only pertain to capturing behaviour / hygiene, but also to whether a lambda is a value (that can be stored in objects) or something else. In the syntax, we could allow lambdas only in certain places, but the less uniform the rules are the more users will be confused. My current thinking is that regarding a lambda as a value means defining its serialized form, making it possible to store it and recreate it. The most common problem with this approach is that all referenced context needs to be captured by value and serialized — you may search for “Java Serialization” to get a picture of the issues. We may be able to optimise this, but it remains a potential foot gun, e.g. when capturing another function and so on. It may be easier to declare functions to belong to a difference universe than values, so you cannot store them in objects, arrays, etc. A LET binding would then either refer to a value or a function. This limits the number of functional programming patterns that can be used, but I also think that we shouldn’t embed a roughly hewn Haskell into our peculiar database :-) (aeh, sorry, databank) |
So now we have two problems: 1.) Internal representation of a lambda and its serialization problem I would like to propose a solution similar to my initial solution which may solve those two at the same time because they are related.
For example, with a new processor
|
Product
Actyx
When
Querying with AQL
I want to
use map/reduce/filter-like capabilities with bound variables
So that
I can form efficient query which would normally require multiple requests (e.g. WHERE IN) type queries
Additional notes
For example: Finding all users that reside in a particular location can be done in this way
The text was updated successfully, but these errors were encountered: