-
Notifications
You must be signed in to change notification settings - Fork 66
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: Add long alias support for aggregations. #1267
Conversation
a12a29d
to
5dcc233
Compare
There was a problem hiding this 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
google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryAggregationsTest.java
Outdated
Show resolved
Hide resolved
// This avoids issues with client-side aliases that exceed the 1500-byte string size limit. | ||
String serverAlias = "aggregate_" + aggregationNum++; | ||
aliasMap.put(serverAlias, aggregateField.getAlias()); | ||
aggregation.setAlias(serverAlias); | ||
aggregations.add(aggregation.build()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITQueryAggregationsTest.java
Show resolved
Hide resolved
// This avoids issues with client-side aliases that exceed the 1500-byte string size limit. | ||
String serverAlias = "aggregate_" + aggregationNum++; | ||
aliasMap.put(serverAlias, aggregateField.getAlias()); | ||
aggregation.setAlias(serverAlias); | ||
aggregations.add(aggregation.build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The CI is expected to fail (uses prod) |
* 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.
* 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.
* 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.
* 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>
* 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>
No description provided.