Azure / Azure/azure-sdk-for-java

[BUG] conflict feed queries with count aggregation return empty results

Open
#43,777 0 comments 0 reactions 1 assignee Claimed by @tvaron3 View on GitHub
Cosmos
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

**Describe the bug**
conflict feed queries with count aggregation return empty results. Serialization of query node is failing because expecting storeResponse with resourceKey Document instead of Conflict.

**To Reproduce**
Steps to reproduce the behavior:
Create some conflicts in a container. Try a count query on a conflict feed.

***Code Snippet***

```java
CosmosAsyncClient client = new CosmosClientBuilder().endpoint(serviceEndpoint).key(key).buildAsyncClient();
CosmosAsyncDatabase db = client.getDatabase("db1");
CosmosAsyncContainer cont = db.getContainer("container");
CosmosQueryRequestOptions options = new CosmosQueryRequestOptions();
options.setPartitionKey(new PartitionKey(0));

CosmosPagedFlux conflictCountQuery = cont.queryConflicts("select value count(1) from c");

List> conflictCountQueryResults = conflictCountQuery.byPage().collectList().block();
for (FeedResponse conflictCountQueryResult: conflictCountQueryResults) {
System.out.println("Number of count conflicts: " + conflictCountQueryResult.getResults().size());
System.out.println("Cosmos Diagnostics: " + conflictCountQueryResult.getCosmosDiagnostics());
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Setup (please complete the following information):**
- OS: [e.g. iOS]
- IDE: [e.g. IntelliJ]
- Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)]
- Java version: [e.g. 8]
- App Server/Environment: [e.g. Tomcat, WildFly, Azure Function, Apache Spark, Databricks, IDE plugin or anything special]
- Frameworks: [e.g. Spring Boot, Micronaut, Quarkus, etc]

If you suspect a dependency version mismatch (e.g. you see `NoClassDefFoundError`, `NoSuchMethodError` or similar), please check out [Troubleshoot dependency version conflict article](https://aka.ms/azsdk/java/dependency/troubleshoot) first. If it doesn't provide solution for the problem, please provide:
- verbose dependency tree (`mvn dependency:tree -Dverbose`)
- exception message, full stack trace, and any available logs

**Additional context**
Add any other context about the problem here.

**Information Checklist**
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x] Bug Description Added
- [x] Repro Steps Added
- [x] Setup information Added

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.