KEMBAR78
feat: Add long alias support for aggregations. by ehsannas · Pull Request #1267 · googleapis/java-firestore · GitHub
Skip to content

Conversation

@ehsannas
Copy link
Contributor

No description provided.

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/java-firestore API. labels Apr 24, 2023
@ehsannas ehsannas requested a review from MarkDuckworth April 24, 2023 23:43
@ehsannas ehsannas changed the title Add long alias support for aggregations. feat: Add long alias support for aggregations. Apr 24, 2023
@ehsannas ehsannas force-pushed the ehsann/long-alias branch from a12a29d to 5dcc233 Compare April 24, 2023 23:44
@ehsannas ehsannas marked this pull request as ready for review April 26, 2023 23:20
@ehsannas ehsannas requested a review from a team as a code owner April 26, 2023 23:20
Copy link
Contributor

@MarkDuckworth MarkDuckworth left a comment

Choose a reason for hiding this comment

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

LGTM other than the test that uses field names longer than 1500-bytes

String serverAlias = "aggregate_" + aggregationNum++;
aliasMap.put(serverAlias, aggregateField.getAlias());
aggregation.setAlias(serverAlias);
aggregations.add(aggregation.build());
Copy link
Contributor

Choose a reason for hiding this comment

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

will the deduplication still work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is:
duplicate aliases are not allowed
duplicate aggregates are allowed

is that right @cherylEnkidu @MarkDuckworth ?

this code uses aggregate_<counter> as alias, so there should not be any duplicate aliases.

also, there's a test named canGetDuplicateAggregations below which currently passes against the emulator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah... it's coming back to me now... I believe we decided to remove duplicate aggregates even though they are allowed to improve performance.

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.

Followed what was done in Android. PTAL.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jul 28, 2023
String serverAlias = "aggregate_" + aggregationNum++;
aliasMap.put(serverAlias, aggregateField.getAlias());
aggregation.setAlias(serverAlias);
aggregations.add(aggregation.build());
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

@ehsannas
Copy link
Contributor Author

ehsannas commented Aug 2, 2023

The CI is expected to fail (uses prod)

@ehsannas ehsannas merged commit a74b284 into ehsann/sum-average Aug 2, 2023
@ehsannas ehsannas deleted the ehsann/long-alias branch August 2, 2023 22:01
ehsannas added a commit that referenced this pull request Aug 2, 2023
* feat: Add long alias support for aggregations.

* address comments.

* Better method name and replace hardcoded "count" with "aggregate_0".

* Remove duplicate aggregations.

* add static import.

* Fix tests. All tests pass.
ehsannas added a commit that referenced this pull request Aug 2, 2023
* feat: Add long alias support for aggregations.

* address comments.

* Better method name and replace hardcoded "count" with "aggregate_0".

* Remove duplicate aggregations.

* add static import.

* Fix tests. All tests pass.
ehsannas added a commit that referenced this pull request Aug 2, 2023
* feat: Add long alias support for aggregations.

* address comments.

* Better method name and replace hardcoded "count" with "aggregate_0".

* Remove duplicate aggregations.

* add static import.

* Fix tests. All tests pass.
ehsannas added a commit that referenced this pull request Oct 9, 2023
* feat: SUM / AVG (#1218)

* feat: SUM / AVG (real files)

* Remove aggregate field duplicates (if any).

* Clean up and fixes.

* Clean up comments, and add Nonnull where possible.

* Add more public docs.

* More cleanup.

* Update hashCode and equals for AggregateQuery.

* Address code review comments. more to come.

* fix test name.

* Better comment.

* Fix alias encoding.

* Remove TODO.

* Revert the way alias is constructed.

* Backport test updates.

fix format.

fix import stmt.

* feat: Add long alias support for aggregations. (#1267)

* feat: Add long alias support for aggregations.

* address comments.

* Better method name and replace hardcoded "count" with "aggregate_0".

* Remove duplicate aggregations.

* add static import.

* Fix tests. All tests pass.

* Address comments.

* Improve the documentation to match strongly typed languages.

* Do not use wildcard import.

* Do not use wildcard import (2).

* Do not use wildcard import (3).

* Do not use wildcard import (4).

* Fix the javadoc.

* Add license header, and remove unused test code.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* better regex.

* Add more tests for cursors.

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
cherylEnkidu pushed a commit that referenced this pull request Dec 11, 2023
* feat: SUM / AVG (#1218)

* feat: SUM / AVG (real files)

* Remove aggregate field duplicates (if any).

* Clean up and fixes.

* Clean up comments, and add Nonnull where possible.

* Add more public docs.

* More cleanup.

* Update hashCode and equals for AggregateQuery.

* Address code review comments. more to come.

* fix test name.

* Better comment.

* Fix alias encoding.

* Remove TODO.

* Revert the way alias is constructed.

* Backport test updates.

fix format.

fix import stmt.

* feat: Add long alias support for aggregations. (#1267)

* feat: Add long alias support for aggregations.

* address comments.

* Better method name and replace hardcoded "count" with "aggregate_0".

* Remove duplicate aggregations.

* add static import.

* Fix tests. All tests pass.

* Address comments.

* Improve the documentation to match strongly typed languages.

* Do not use wildcard import.

* Do not use wildcard import (2).

* Do not use wildcard import (3).

* Do not use wildcard import (4).

* Fix the javadoc.

* Add license header, and remove unused test code.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* better regex.

* Add more tests for cursors.

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants