Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
ce4c149
Add method in Datastore client to invoke rpc for aggregation query
jainsahab Aug 29, 2022
100115f
Creating count aggregation and using it to populate Aggregation proto
jainsahab Aug 29, 2022
c1956d8
Moving aggregation builder method to root level aggregation class
jainsahab Aug 30, 2022
493edfa
Introducing RecordQuery to represent queries which returns entity rec…
jainsahab Sep 7, 2022
9c7c4ba
Updating gitignore with patch extension
jainsahab Sep 7, 2022
cf49a37
Setting up structure of Aggregation query and its builder
jainsahab Sep 8, 2022
78fd6c9
Introducing ProtoPreparer to populate the request protos
jainsahab Sep 9, 2022
2ae957a
Delegating responsibility of preparing query proto to QueryPreparer
jainsahab Sep 9, 2022
14ac55f
Populating aggregation query with nested structured query
jainsahab Sep 9, 2022
3ff182f
Delegating responsibility of preparing query proto in GqlQuery to Que…
jainsahab Sep 9, 2022
7de95e6
Removing RecordQuery from the query hierarchy and making it a standal…
jainsahab Sep 12, 2022
d62964f
Populating aggregation query with nested gql query
jainsahab Sep 12, 2022
1f5b1a4
Removing deprecation warning by using assertThrows instead of Expecte…
jainsahab Sep 12, 2022
b69b166
Making DatastoreRpc call aggregation query method on client
jainsahab Sep 12, 2022
9589f5c
Creating response transformer to transform aggregation query response…
jainsahab Sep 13, 2022
2103b80
Implementing aggregation query executor to execute AggergationQuery
jainsahab Sep 13, 2022
775c341
Adding missing assertion statements
jainsahab Sep 13, 2022
8872a55
Creating RetryExecutor to inject it as a dependency in other components
jainsahab Sep 14, 2022
1dfafb7
Making RetryExecutor accept RetrySettings when creating it
jainsahab Sep 14, 2022
f6bf0ce
Revert "Making RetryExecutor accept RetrySettings when creating it"
jainsahab Sep 14, 2022
deb63bf
Revert "Creating RetryExecutor to inject it as a dependency in other …
jainsahab Sep 14, 2022
428e9e3
Introducing RetryAndTraceDatastoreRpcDecorator to have retry and trac…
jainsahab Sep 14, 2022
c86913e
Extracting out the responsibility of preparing ReadOption in it's own…
jainsahab Sep 14, 2022
b235935
Making QueryExecutor to execute query with provided ReadOptions
jainsahab Sep 14, 2022
f1c3379
Exposing readTime to the user
jainsahab Sep 14, 2022
168b864
Ignoring runAggregationQuery method from clirr check
jainsahab Sep 14, 2022
005429b
Making readTime final
jainsahab Sep 15, 2022
dfbdf60
Allowing namespace to be optional in AggregationQuery
jainsahab Sep 15, 2022
0565ba6
Add capability to fetch aggregation result by passing alias
jainsahab Sep 15, 2022
0e8e7b9
Implementing User facing datastore.runAggrgation method to run aggreg…
jainsahab Sep 15, 2022
fc0f0dd
Add integration test for count aggregation
jainsahab Sep 15, 2022
e6cbca6
Add transaction Id support in ReadOptionsProtoPreparer
jainsahab Sep 19, 2022
d205997
Supporting aggregation query with transactions
jainsahab Sep 19, 2022
5097cd6
Allowing user to create Aggregation directly without involving its bu…
jainsahab Sep 19, 2022
6508ff6
Preventing creating duplicated aggregation when creating an aggregati…
jainsahab Sep 19, 2022
5f1e419
Marking RecordQuery implemented method as InternalApi
jainsahab Sep 19, 2022
5e2fcb3
Writing comments and JavaDoc for aggregation query related class
jainsahab Sep 20, 2022
372a2d7
Adding a default implementation in the public interfaces to avoid com…
jainsahab Sep 22, 2022
31e0c5a
Merge branch 'main' into count_feature
jainsahab Sep 22, 2022
2c2cf63
covering a scenario to maintain consistent snapshot when executing ag…
jainsahab Sep 22, 2022
4719ae8
Creating emulator proxy to simulate AggregationQuery response from em…
jainsahab Sep 23, 2022
8edebda
Integration test to execute an aggregation query in a read only trans…
jainsahab Sep 27, 2022
ecdc04e
Merge branch 'main' into count_feature
jainsahab Sep 28, 2022
394a642
Count aggregation samples with structuredQuery and gql query
jainsahab Sep 28, 2022
41cbef7
Count aggregation samples to demonstrate stale read
jainsahab Sep 28, 2022
842df2d
Getting rid off limit operation on count aggregation as same behaviou…
jainsahab Sep 29, 2022
8c81b9f
Removing import statement from javadoc and undo changes in .gitignore…
jainsahab Sep 29, 2022
1584d9f
Using Optional instead of returning null from ReadOptionsProtoPreparer
jainsahab Sep 29, 2022
bc425dd
using assertThat from Truth library
jainsahab Sep 29, 2022
5801641
Removing 'limit' api from count query samples
jainsahab Oct 7, 2022
8479fd2
Merge branch 'main' into count_feature
jainsahab Oct 7, 2022
41df1bc
fixing unit test
jainsahab Oct 7, 2022
1606584
Getting rid off Double braces initialization syntax
jainsahab Oct 7, 2022
ca27e75
Fixing lint
jainsahab Oct 7, 2022
9ff91d9
Getting rid off emulator proxy and using easy mock to check the aggre…
jainsahab Oct 7, 2022
6953efe
Deleting a entity created locally in other test which is causing fail…
jainsahab Oct 7, 2022
d2e1969
Deleting all keys in datastore in integration test so that new test c…
jainsahab Oct 7, 2022
39812d4
Executing two read write transaction simultaneously and verifying the…
jainsahab Oct 7, 2022
2d9e81a
Removing tests to verify serializability as it's an underlying implem…
jainsahab Oct 7, 2022
90ab7cb
Fixing lint
jainsahab Oct 7, 2022
a48b323
Merge branch 'main' into count_feature
jainsahab Oct 10, 2022
aae2620
Adding runAggregationQuery method to reflect config so that it's avai…
jainsahab Oct 10, 2022
c2a8bc7
Merge branch 'count_feature' into count_feature_sample
jainsahab Oct 10, 2022
f9b41b2
Aggregation query samples with limit and order by option
jainsahab Oct 10, 2022
a4cf366
Aggregation query samples with transactions
jainsahab Oct 10, 2022
e265f35
fixing lint and reusing sysoutRule
jainsahab Oct 10, 2022
4a9c7ba
correcting region tag
jainsahab Oct 13, 2022
485212d
simplifying tearDown method
jainsahab Oct 13, 2022
9c93a6c
Merge branch 'main' into count_feature_sample
jainsahab Oct 18, 2022
7d66848
Reverting back to using Task domain for aggregation query samples
jainsahab Oct 18, 2022
1af69af
Limiting tearDown method to delete only Task entities
jainsahab Oct 18, 2022
9871515
Splitting count aggregation query samples into individual java files
jainsahab Oct 19, 2022
6e6a423
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Oct 19, 2022
54ace27
Adding missing header
jainsahab Oct 19, 2022
170590b
Sticking to the practise of deleting the old created data in setUp of…
jainsahab Oct 19, 2022
670face
Moving comment to the top of statement.
jainsahab Oct 19, 2022
67b2602
Making builder syntax multiline
jainsahab Oct 19, 2022
ebc998d
Adding comment describing the purpose of GQL query
jainsahab Oct 19, 2022
9988599
Rephrasing the comment
jainsahab Oct 19, 2022
c3fa6d7
Adding a comment describing the purpose of the GQL query
jainsahab Oct 19, 2022
11a4230
Rephrasing the comment
jainsahab Oct 19, 2022
7189f80
Relocating region tags to include import statments
jainsahab Oct 19, 2022
350ab61
Few styling and comment fixes
jainsahab Oct 19, 2022
abd2b95
Adding comment in the transaction block
jainsahab Oct 19, 2022
1adf105
Adding fullstop to the comment lines
jainsahab Oct 19, 2022
e89fde6
Showcasing with/without alias usage separately
jainsahab Oct 20, 2022
36f82fa
Importing static methods are we are now including import statements i…
jainsahab Oct 20, 2022
de89eb9
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Oct 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Few styling and comment fixes
  • Loading branch information
jainsahab committed Oct 19, 2022
commit 350ab615f353a32d3a7a12648f66d9dc91ed0ffa
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static void invoke() {
Entity.newBuilder(task2Key).set("done", false).build(),
Entity.newBuilder(task3Key).set("done", true).set("priority", 2).build());

// OrderBy acts as an existence filter.
EntityQuery selectAllTasks =
Query.newEntityQueryBuilder()
.setKind(kind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.example.datastore;

import static org.junit.Assert.assertThrows;

import com.example.datastore.aggregation.CountAggregationInTransaction;
import com.example.datastore.aggregation.CountAggregationOnKind;
import com.example.datastore.aggregation.CountAggregationWithGqlQuery;
Expand All @@ -31,7 +33,6 @@
import com.google.cloud.datastore.QueryResults;
import com.google.common.collect.ImmutableList;
import com.rule.SystemsOutRule;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -44,6 +45,7 @@ public class AggregationQuerySampleTestIT {

@Before
public void setUp() throws Exception {
// Retrieving and deleting all the 'Task' entities.
KeyQuery allKeysQuery = Query.newKeyQueryBuilder().setKind("Task").build();
Comment thread
jainsahab marked this conversation as resolved.
QueryResults<Key> allKeys = datastore.run(allKeysQuery);
Key[] keysToDelete = ImmutableList.copyOf(allKeys).toArray(new Key[0]);
Expand All @@ -53,37 +55,32 @@ public void setUp() throws Exception {
@Test
public void testAggregationQueryAndCountAggregationSample() {
CountAggregationOnKind.invoke();

systemsOutRule.assertContains("Total tasks count is 3");
systemsOutRule.assertContains("Total tasks (accessible from default alias) is 3");
}

@Test
public void testAggregationQueryAndCountAggregationWithLimitSample() {
CountAggregationWithLimit.invoke();

systemsOutRule.assertContains("We have at least 2 tasks");
}

@Test
public void testAggregationQueryAndCountAggregationWithOrderBySample() {
CountAggregationWithOrderBy.invoke();

systemsOutRule.assertContains("Total 2 tasks found with priority field");
}

@Test
public void testAggregationQueryAndCountAggregationWithPropertyFilterSample() {
CountAggregationWithPropertyFilter.invoke();

systemsOutRule.assertContains("Total completed tasks count is 2");
systemsOutRule.assertContains("Total remaining tasks count is 1");
}

@Test
public void testAggregationQueryAndCountAggregationSampleWithGqlQuery() {
CountAggregationWithGqlQuery.invoke();

systemsOutRule.assertContains("We have at least 2 tasks");
systemsOutRule.assertContains("Total tasks count is 3");
systemsOutRule.assertContains("Total completed tasks count is 2");
Expand All @@ -92,15 +89,13 @@ public void testAggregationQueryAndCountAggregationSampleWithGqlQuery() {
@Test
public void testAggregationQueryAndCountWithStaleRead() throws InterruptedException {
CountAggregationWithStaleRead.invoke();

systemsOutRule.assertContains("Latest tasks count is 3");
systemsOutRule.assertContains("Stale tasks count is 2");
}

@Test
public void testAggregationQueryAndCountWithTransaction() throws InterruptedException {
Assert.assertThrows(Exception.class, CountAggregationInTransaction::invoke);

assertThrows(Exception.class, CountAggregationInTransaction::invoke);
systemsOutRule.assertContains("Found existing 2 tasks, rolling back");
}
}