-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Labels
api: datastoreIssues related to the googleapis/java-datastore API.Issues related to the googleapis/java-datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
A query result from a query that starts at a cursor will say getCursorAfter is actually the default cursor (Cursor{bytes=}) rather than the cursor it started with.
This creates complications for testing / resuming a result set that was never iterated.
The old Java 8 datastore SDK didn't have this issue.
Environment details
- Specify the API at the beginning of the title. For example, "BigQuery: ...").
General, Core, and Other are also allowed as types - OS type and version: any
- Java version: 8/11
- datastore version(s): current master (0.87.1)
Steps to reproduce
Start cloud_datastore_emulator on localhost:8081
Run code example
Code example
import com.google.cloud.datastore.*;
Datastore ds = DatastoreOptions.newBuilder().setProjectId("project").setHost("localhost:8081").build().getService();
ds.put(Entity.newBuilder(Key.newBuilder("project", "Kind", "name-01").build()).build());
ds.put(Entity.newBuilder(Key.newBuilder("project", "Kind", "name-02").build()).build());
ds.put(Entity.newBuilder(Key.newBuilder("project", "Kind", "name-03").build()).build());
QueryResults<Entity> run = ds.run(Query.newEntityQueryBuilder().setKind("Kind").build());
run.next();
Cursor cursor = run.getCursorAfter();
QueryResults<Entity> run2 = ds.run(Query.newEntityQueryBuilder().setKind("Kind").setStartCursor(cursor).build());
// expected:
assert run2.getCursorAfter().equals(cursor);
// actual: run2.getCursorAfter() is the default cursor until run2.next() is calledMetadata
Metadata
Assignees
Labels
api: datastoreIssues related to the googleapis/java-datastore API.Issues related to the googleapis/java-datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.