Azure / azure-cosmosdb-java

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

Wrong delimiter in Query Metrics #338

Open psdutkiewicz opened 4 years ago

psdutkiewicz commented 4 years ago

Describe the bug Calling CosmosAsyncContainer.queryItems() with FeedOptions.isPopulateQueryMetrics() == true produces java.lang.NumberFormatException

To Reproduce Call CosmosAsyncContainer.queryItems() with FeedOptions.isPopulateQueryMetrics() == true

Expected behavior Should parse metrics.

Actual behavior java.lang.NumberFormatException is thrown

Environment summary SDK Version: 4.0.1 Java JDK version: 11 OS Version: Win10

Additional context Adding Locale.US into String.format() should fix this issue.

https://github.com/Azure/azure-cosmosdb-java/blob/5fe53f7a1920e42568b150aaa58af0f8ceabe0b4/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java#L91

kushagraThapar commented 4 years ago

@psdutkiewicz - this repository represents azure-cosmosdb version 2.x.x v4 cosmos SDK is located here : https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-cosmos which version of SDK are you using, since 4.0.1 is not released yet.

psdutkiewicz commented 4 years ago

@kushagraThapar Of course I made a mistake and made an issue in wrong repo... Sorry for that.

Nevertheless, here is the same issue. Of course, default Locale can be set by user to properly parse double to string, but I think this code should not depend on user Locale settings.

https://github.com/Azure/azure-cosmosdb-java/blob/5fe53f7a1920e42568b150aaa58af0f8ceabe0b4/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java#L91