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

feat: Count queries (not available for use yet) #1033

Merged
merged 24 commits into from
Sep 22, 2022
Merged

feat: Count queries (not available for use yet) #1033

merged 24 commits into from
Sep 22, 2022

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Sep 14, 2022

Add support for "count" queries; that is, a query that gets the number of documents in the result set without actually downloading the documents.

This PR implements all of the logic but does not expose the API. A follow-up PR will change the visibility of the related classes and methods to public.

@dconeybe dconeybe self-assigned this Sep 14, 2022
@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/java-firestore API. label Sep 14, 2022
@generated-files-bot

This comment was marked as outdated.

@dconeybe dconeybe changed the title Add Count Aggregation Query Support feat: Count Aggregation Query Support added Sep 15, 2022
@dconeybe dconeybe changed the title feat: Count Aggregation Query Support added feat: Count Queries Sep 15, 2022
@dconeybe dconeybe changed the title feat: Count Queries feat: Count Queries (implementation only - API is not public yet) Sep 15, 2022
@dconeybe dconeybe changed the title feat: Count Queries (implementation only - API is not public yet) feat: Count Queries Sep 15, 2022
@dconeybe dconeybe changed the title feat: Count Queries feat: Count queries implemented (not available for use yet) Sep 16, 2022
@dconeybe dconeybe changed the title feat: Count queries implemented (not available for use yet) feat: Count queries (not available for use yet) Sep 16, 2022
…ackage

This fixes the following warning from `mvn -B dependency:analyze -DfailOnWarning=true`

```
[WARNING] Used undeclared dependencies found:
[WARNING]    com.google.http-client:google-http-client:jar:1.42.2:compile
[WARNING] Non-test scoped test only dependencies found:
[WARNING]    com.google.http-client:google-http-client:jar:1.42.2:compile
```
@dconeybe dconeybe marked this pull request as ready for review September 17, 2022 04:53
@dconeybe dconeybe requested review from a team as code owners September 17, 2022 04:53
@dconeybe dconeybe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 17, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 17, 2022
@dconeybe dconeybe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 19, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 19, 2022
@dconeybe dconeybe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 20, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 20, 2022
@dconeybe dconeybe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 21, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 21, 2022
Copy link
Contributor

@ehsannas ehsannas left a comment

Choose a reason for hiding this comment

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

The testing is very thorough. Love it.

There are a few things that need to be addressed.
1- comments for the class and methods of AggregateQuery
2- comments for the class and methods of AggregateQuerySnapshot
3- Moving the integration test to it/

I'd say land this PR as is and address my comments in the next PR.


@Override
public void onResponse(RunAggregationQueryResponse response) {
if (!isFutureNotified.compareAndSet(false, true)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

May be good to add a comment that we expect only one response and why. Please do as part of the next PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: #1041

@@ -1846,6 +1846,12 @@ private boolean isRetryableError(Throwable throwable) {
return false;
}

// TODO(count) Make this method public
Copy link
Contributor

Choose a reason for hiding this comment

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

Also need a comment for the method. Please do as part of the next PR.

@dconeybe
Copy link
Contributor Author

The testing is very thorough. Love it.

There are a few things that need to be addressed. 1- comments for the class and methods of AggregateQuery 2- comments for the class and methods of AggregateQuerySnapshot 3- Moving the integration test to it/

I'd say land this PR as is and address my comments in the next PR.

Thanks for the review, @ehsannas!

Regarding your comments...

  1. I have a separate task in TaskFlow to update all of the public documentation in all SDKs, so I'll make sure to update the documentation in this repo as well (b/245781713).
  2. Same
  3. Since the classes under test have default visibility (and not public visibility) I needed to temporarily move those integration tests into the same package as the classes they are testing. Once they're changed to "public" then I'll move them into their proper location, in the "it" subdirectory. I left a "TODO" comment in the code to do that.

@dconeybe dconeybe merged commit 8b60612 into main Sep 22, 2022
@dconeybe dconeybe deleted the count branch September 22, 2022 00:19
gcf-merge-on-green bot pushed a commit that referenced this pull request Oct 5, 2022
🤖 I have created a release *beep* *boop*
---


## [3.6.0](https://togithub.com/googleapis/java-firestore/compare/v3.5.0...v3.6.0) (2022-10-04)


### Features

* Count queries (not available for use yet) ([#1033](https://togithub.com/googleapis/java-firestore/issues/1033)) ([8b60612](https://togithub.com/googleapis/java-firestore/commit/8b60612f1922a4c377fac357ee7f4304362622f3))
* Make count queries publicly available for use ([#1042](https://togithub.com/googleapis/java-firestore/issues/1042)) ([1c8d242](https://togithub.com/googleapis/java-firestore/commit/1c8d2428d94ab8b3c18a8cad14daa2a1e39af369))


### Documentation

* AggregateQuery.java: describe why we ignore subsequent responses ([#1041](https://togithub.com/googleapis/java-firestore/issues/1041)) ([8150544](https://togithub.com/googleapis/java-firestore/commit/8150544aee0aa04a5e6239dbc4994ddd056393ba))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#1053](https://togithub.com/googleapis/java-firestore/issues/1053)) ([9b4c26e](https://togithub.com/googleapis/java-firestore/commit/9b4c26eac062fa73c8b275978f35c5bfb8cdfc21))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.14 ([#1045](https://togithub.com/googleapis/java-firestore/issues/1045)) ([04b3861](https://togithub.com/googleapis/java-firestore/commit/04b3861d874dcd63713e62bd7717097ca8f68a3c))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.14 ([#1046](https://togithub.com/googleapis/java-firestore/issues/1046)) ([6631a58](https://togithub.com/googleapis/java-firestore/commit/6631a58553a12e1f48d060d0b87cfa8683492b94))
* Update dependency org.junit.vintage:junit-vintage-engine to v5.9.1 ([#1039](https://togithub.com/googleapis/java-firestore/issues/1039)) ([84423f4](https://togithub.com/googleapis/java-firestore/commit/84423f4db6e35f9d30a34a5bc2d29050380840ec))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
cherylEnkidu pushed a commit that referenced this pull request Dec 11, 2023
🤖 I have created a release *beep* *boop*
---


## [3.6.0](https://togithub.com/googleapis/java-firestore/compare/v3.5.0...v3.6.0) (2022-10-04)


### Features

* Count queries (not available for use yet) ([#1033](https://togithub.com/googleapis/java-firestore/issues/1033)) ([8b60612](https://togithub.com/googleapis/java-firestore/commit/8b60612f1922a4c377fac357ee7f4304362622f3))
* Make count queries publicly available for use ([#1042](https://togithub.com/googleapis/java-firestore/issues/1042)) ([1c8d242](https://togithub.com/googleapis/java-firestore/commit/1c8d2428d94ab8b3c18a8cad14daa2a1e39af369))


### Documentation

* AggregateQuery.java: describe why we ignore subsequent responses ([#1041](https://togithub.com/googleapis/java-firestore/issues/1041)) ([8150544](https://togithub.com/googleapis/java-firestore/commit/8150544aee0aa04a5e6239dbc4994ddd056393ba))


### Dependencies

* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#1053](https://togithub.com/googleapis/java-firestore/issues/1053)) ([9b4c26e](https://togithub.com/googleapis/java-firestore/commit/9b4c26eac062fa73c8b275978f35c5bfb8cdfc21))
* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.14 ([#1045](https://togithub.com/googleapis/java-firestore/issues/1045)) ([04b3861](https://togithub.com/googleapis/java-firestore/commit/04b3861d874dcd63713e62bd7717097ca8f68a3c))
* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.14 ([#1046](https://togithub.com/googleapis/java-firestore/issues/1046)) ([6631a58](https://togithub.com/googleapis/java-firestore/commit/6631a58553a12e1f48d060d0b87cfa8683492b94))
* Update dependency org.junit.vintage:junit-vintage-engine to v5.9.1 ([#1039](https://togithub.com/googleapis/java-firestore/issues/1039)) ([84423f4](https://togithub.com/googleapis/java-firestore/commit/84423f4db6e35f9d30a34a5bc2d29050380840ec))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants