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

Add batching api for groups #3698

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

acrrd
Copy link

@acrrd acrrd commented Feb 26, 2024

The PR adds the batching API for groups. Closes: #2326

This is still a draft to get some feedback on the direction of this PR.
The current change adds support for batching groups API.
GRPC, Openapi and tests are still missing.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@acrrd
Copy link
Author

acrrd commented Feb 26, 2024

@generall Do you think this is going in the right direction?

@@ -34,6 +34,21 @@ where
{
/// Creates a basic GroupBy builder
pub fn new(group_by: GroupRequest, collection: &'a Collection, collection_by_name: F) -> Self {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this signature as is to avoid changing too much in the tests.

@@ -176,7 +176,38 @@ impl TableOfContent {
group_by
.execute()
.await
.map(|groups| GroupsResult { groups })
.map(|mut groups| GroupsResult {
groups: groups.pop().unwrap_or_default(),
Copy link
Author

@acrrd acrrd Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, execute should always return one element. Would it be preferable to return an error or use unwrap() instead of unwrap_or_default()?

@@ -176,7 +176,38 @@ impl TableOfContent {
group_by
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can rewrite fn group to use fn group_batch

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

Successfully merging this pull request may close these issues.

Support batch requests to all Grouping APIs
1 participant