Skip to content
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

Support for aggregating queries #42

Open
ak0rz opened this issue Feb 13, 2019 · 2 comments
Open

Support for aggregating queries #42

ak0rz opened this issue Feb 13, 2019 · 2 comments

Comments

@ak0rz
Copy link
Contributor

ak0rz commented Feb 13, 2019

Let's think about adding groupBy functionality for query

@ak0rz ak0rz changed the title Support for aggragating queries Support for aggregating queries Mar 4, 2019
@incubos
Copy link
Contributor

incubos commented Mar 13, 2019

We'd better start with specific use-cases.

@ak0rz
Copy link
Contributor Author

ak0rz commented Mar 13, 2019

We'd better start with specific use-cases.

Use case for groupBy:
Consider you want to count documents for each distinct value of a field in a fetch. Now you may only do it using a Map in a DocumentProcessor to collect all of the documents and process them all. On the other hand, groupBy may process it as distinct fetches for each value of a field using a function as (value, subFetch) -> T.

Next, consider you want to find the maximum value for field field1 on the specific fetch from the database. Now you have the only option - run over all of the documents of fetch and find the maximum. But if we evolve querying API, we may provide a way to find the maximum value of a field in a fetch with only O(log N).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants