GeezerVison is showing github.com — Binding a FullEntity to a GqlQuery fails · Issue #1485 · googleapis/google-cloud-java
Binding a FullEntity to a GqlQuery fails #1485
Labels
api: datastoreIssues related to the Datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue. Description
The GqlQuery.Builder allows positional and named bindings for FullEntity values. However, when I try to use those methods, the query execution fails with the below exception. Is this supposed to work? Same error occurs when using StructuredQuery.PropertyFilter. Am I misunderstanding the purpose of these methods?
Exception in thread "main" com.google.cloud.datastore.DatastoreException: An entity value is not allowed
at com.google.cloud.datastore.spi.DefaultDatastoreRpc.translate(DefaultDatastoreRpc.java:110)
at com.google.cloud.datastore.spi.DefaultDatastoreRpc.translate(DefaultDatastoreRpc.java:96)
at com.google.cloud.datastore.spi.DefaultDatastoreRpc.runQuery(DefaultDatastoreRpc.java:164)
at com.google.cloud.datastore.DatastoreImpl$1.call(DatastoreImpl.java:93)
at com.google.cloud.datastore.DatastoreImpl$1.call(DatastoreImpl.java:89)
at com.google.cloud.RetryHelper.doRetry(RetryHelper.java:179)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:244)
at com.google.cloud.datastore.DatastoreImpl.runQuery(DatastoreImpl.java:88)
at com.google.cloud.datastore.QueryResultsImpl.sendRequest(QueryResultsImpl.java:73)
at com.google.cloud.datastore.QueryResultsImpl.<init>(QueryResultsImpl.java:57)
at com.google.cloud.datastore.DatastoreImpl.run(DatastoreImpl.java:82)
at com.google.cloud.datastore.DatastoreImpl.run(DatastoreImpl.java:73)
Caused by: com.google.datastore.v1.client.DatastoreException: An entity value is not allowed, code=INVALID_ARGUMENT
at com.google.datastore.v1.client.RemoteRpc.makeException(RemoteRpc.java:126)
at com.google.datastore.v1.client.RemoteRpc.makeException(RemoteRpc.java:169)
at com.google.datastore.v1.client.RemoteRpc.call(RemoteRpc.java:89)
at com.google.datastore.v1.client.Datastore.runQuery(Datastore.java:108)
at com.google.cloud.datastore.spi.DefaultDatastoreRpc.runQuery(DefaultDatastoreRpc.java:162)
Sample Code
Datastore datastore = DatastoreOptions.getDefaultInstance().getService();
FullEntity<IncompleteKey> cellNumber = FullEntity.newBuilder().set("countryCode", "1").set("areaCode", "111").set("subscriberNumber", "2223333").build();
GqlQuery query = Query.newGqlQueryBuilder(Query.ResultType.ENTITY, "SELECT * FROM Contact WHERE cellNumber=@1").addBinding(cellNumber).build();
System.out.println(query);
QueryResults<Entity> results = datastore.run(query);
while (results.hasNext()) {
System.out.println(results.next());
}
Activity
added
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. on Feb 23, 2017shinfan commented on Feb 23, 2017
@lesv Can you determine if this is release blocking?
lesv commented on Feb 23, 2017
@tswast Care to look? I need to lookup a bunch of stuff that you might know off the top of your head.
tswast commented on Feb 23, 2017
@lesv I'm not familiar with this specific feature of Datastore, either. I've only built queries with scalar types.
Metadata
Metadata
api: datastoreIssues related to the Datastore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue. Development
No branches or pull requestsIssue actions