Assigned
Status Update
Comments
ba...@google.com <ba...@google.com>
ha...@google.com <ha...@google.com> #2
This issue should now be fixed in production by a parser change.
Description
Please provide as much information as possible. At least, this should include a description of your issue and steps to reproduce the problem. If possible please provide a summary of what steps or workarounds you have already tried, and any docs or articles you found (un)helpful.
Problem you have encountered:
Receiving an INTERNAL error [1] while running an aggregation query that filters on a map value.
When converted the GQL into the pipeline form, interestingly - the issue is no longer reproducible
```
AGGREGATE COUNT(*) OVER (
SELECT * from testCase WHERE contexts.contextType = 'test'
)
```
What you expected to happen:
Is this intended behavior? Since there appears to be no documented, known limitations with map fields being ineligible for use in aggregation queries, and since the query executes successfully in the pipelined form, there should not have been an INTERNAL error, as seen here. If there is a limitation, it should be documented & INTERNAL error message is expected to be replaced with a more meaningful message.
Steps to reproduce:
The issue is consistently reproducible using the Java client library, as well as using Pantheon's "Query by GQL" feature. Example code snippet in [2].
The GQL that reproduces the issue looks like this:
```
select COUNT(*) as total
from testCase
where contexts.contextType = 'test'
```
where contexts.contextType is the map value that the aggregation query attempts to filter on. We can easily reproduce the issue via Pantheon as well, using 'Entities'>>'QUERY BY GQL'
Other information (workarounds you have tried, documentation consulted, etc):
[1]
```
com.google.cloud.datastore.DatastoreException: An internal error occurred.
at
com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.translate(HttpDatastoreRpc.java:141)
~[google-cloud-datastore-2.16.0.jar:2.16.0]
[2]
```
GqlQuery.Builder<Entity> dsCountAllQueryBuilder =
Query.newGqlQueryBuilder(Query.ResultType.ENTITY, countAllQuery);
GqlQuery<Entity> dsCountQuery = dsCountAllQueryBuilder.build();
AggregationQuery countQuery =
GqlQuery.newAggregationQueryBuilder().over(dsCountQuery).addAggregation(count()).build();
AggregationResult countResult =
Iterables.getOnlyElement(datastore.runAggregation(countQuery));
```
```