Skip to content

Commit 1d80281

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 4221 b: refs/heads/gcs-nio c: 35ea69a h: refs/heads/master i: 4219: 01854b2
1 parent a14d3ed commit 1d80281

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ refs/tags/v0.0.12: 2fd8066e891fb3dfea69b65f6bf6461db79342b9
1111
refs/heads/compute-alpha: 969cba2627f1d53d352cc4a5ffe0879dacf65e6c
1212
refs/heads/dns-alpha: 2f90e7e338349287ace33375896907af0f032ca1
1313
refs/heads/dns-alpha-batch: 17442b07867021b85d0452f5f3eda29a3413288f
14-
refs/heads/gcs-nio: 0c2f9e93ffb78aadb55c3abf558e47c616336c18
14+
refs/heads/gcs-nio: 35ea69a5a4102de920f7732b52e29ebc8372d974
1515
refs/heads/logging-alpha: db5312bffa7fccac194f6a7feb8cc3066de16aff
1616
refs/tags/v0.1.0: a615317f7424ed58621b1f65d5c4d8cbbe8a6ed8
1717
refs/tags/v0.1.1: 7a7f6985fe465e9dd6a075af55493f42b4933be0

branches/gcs-nio/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/QueryResultsImpl.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class QueryResultsImpl<T> extends AbstractIterator<T> implements QueryResults<T>
3434
private Query<T> query;
3535
private ResultType<?> actualResultType;
3636
private com.google.datastore.v1beta3.QueryResultBatch queryResultBatchPb;
37+
private com.google.datastore.v1beta3.Query mostRecentQueryPb;
3738
private boolean lastBatch;
3839
private Iterator<com.google.datastore.v1beta3.EntityResult> entityResultPbIter;
3940
private ByteString cursor;
@@ -58,7 +59,7 @@ class QueryResultsImpl<T> extends AbstractIterator<T> implements QueryResults<T>
5859
if (queryResultBatchPb.getSkippedResults() > 0) {
5960
cursor = queryResultBatchPb.getSkippedCursor();
6061
} else {
61-
cursor = ByteString.EMPTY;
62+
cursor = mostRecentQueryPb.getStartCursor();
6263
}
6364
}
6465

@@ -70,7 +71,13 @@ private void sendRequest() {
7071
}
7172
requestPb.setPartitionId(partitionIdPb);
7273
query.populatePb(requestPb);
73-
queryResultBatchPb = datastore.runQuery(requestPb.build()).getBatch();
74+
com.google.datastore.v1beta3.RunQueryResponse runQueryResponsePb =
75+
datastore.runQuery(requestPb.build());
76+
queryResultBatchPb = runQueryResponsePb.getBatch();
77+
mostRecentQueryPb = runQueryResponsePb.getQuery();
78+
if (mostRecentQueryPb == null) {
79+
mostRecentQueryPb = requestPb.getQuery();
80+
}
7481
lastBatch = queryResultBatchPb.getMoreResults() != MoreResultsType.NOT_FINISHED;
7582
entityResultPbIter = queryResultBatchPb.getEntityResultsList().iterator();
7683
actualResultType = ResultType.fromPb(queryResultBatchPb.getEntityResultType());

0 commit comments

Comments
 (0)