Azure / azure-cosmosdb-java

Java Async SDK for SQL API of Azure Cosmos DB
MIT License
54 stars 61 forks source link

"sortedRanges" exception when querying Unique Key IN list #378

Closed krisnik closed 3 years ago

krisnik commented 3 years ago

Describe the bug

We are using queryItems method to run a SQL query and query multiple items from Cosmos DB

public <T> CosmosPagedIterable<T> queryItems(SqlQuerySpec querySpec, CosmosQueryRequestOptions options, Class<T> classType) {
        return this.getCosmosPagedIterable(this.asyncContainer.queryItems(querySpec, options, classType));
    }

The SQL Query that we have had is as follows

WHERE c.id IN ("opendes:at:slb-osdu-dev-sis-internal-hqtechlog--A52C-4031-99D1---124CBB92-8C80-4668-BB48-1329C5FE241-0","opendes:at:slb-osdu-dev-sis-internal-hqtechlog--A52C-4031-99D1---124CBB92-8C80-4668-BB48-1329C5FE241-1")

Here id is the partition key. The partition key is hashed based on the first 100 bytes. We haven't migrated to 2k bytes partition hashing yet.

To Reproduce

The above Where clause query with IN keyword consistently reproduces the issue.

Expected behavior The query items API should successfully fetch the records.

Actual behavior Exception thrown from RoutingMapProviderHelper -> throw new IllegalArgumentException("sortedRanges");

Environment summary SDK Version: com.azure:azure-cosmos:4.7.1 Java JDK version: 1.8 OS Version (e.g. Windows, Linux, MacOSX) N/A

Additional context Similar issue was reported for C# SDK - https://github.com/Azure/azure-cosmos-dotnet-v3/issues/833

krisnik commented 3 years ago

Created issue at different location - https://github.com/Azure/azure-sdk-for-java/issues/19911