-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format exception when using culture and partitionKey, difference between Windows and Linux #3796
Comments
Looks to be the same behaviour as #542, but only happens on Linux and not cross-partition |
@mlankamp can you confirm this happens only with LINQ? If you change the query to be a QueryDefinition with Parameters instead of the .Where(), does it work? |
The same happens with a normal query, like "SELECT * FROM c WHERE c.area > 5.12345". |
@mlankamp Can you share the full stacktrace exception that happens on the non-LINQ scenario? |
Using the following code: var options = new QueryRequestOptions() { PartitionKey = new PartitionKey("bc7df108-4c93-4534-ba32-167d77274511") };
var withCultureWithPartitionKey = container.GetItemQueryIterator<QueryObject>("SELECT * FROM c WHERE c.area > 5.65252", null, options);
while (withCultureWithPartitionKey.HasMoreResults) {
var response = await withCultureWithPartitionKey.ReadNextAsync();
Console.WriteLine(response.Count);
} gives the following error:
|
Maybe azure-cosmos-dotnet-v3/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs Line 966 in f262f89
should be: number64 = double.Parse(text, CultureInfo.InvariantCulture); |
Maybe this helps to find the problem. When I use the query, but make the partition part of the query it works: var options = new QueryRequestOptions() { PartitionKey = null) };
var withCultureWithPartitionKey = container.GetItemQueryIterator<QueryObject>("SELECT * FROM c WHERE c.area > 5.65252 and c.partitionKey='bc7df108-4c93-4534-ba32-167d77274511'", null, options);
while (withCultureWithPartitionKey.HasMoreResults) {
var response = await withCultureWithPartitionKey.ReadNextAsync();
Console.WriteLine(response.Count);
} This causes Lines 191 to 192 in f262f89
SqlQueryParser which doesn't result in the error
|
Might be this line: azure-cosmos-dotnet-v3/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs Line 966 in e41eea5
@neildsh Could you help confirm if this might be the culprit? The double.Parse not having invariant culture might be causing this exception on query parsing? EDIT: I see this is repeated as it was also highlighted by @mlankamp |
This looks like the correct diagnosis. I'll get this issue assigned. Thanks @mlankamp |
I can provide a PR (and unit-test also ) if you want |
Describe the bug
We see different behavior between running queries on Linux versus Windows, when using culture Info and partition key/cross-partition key queries.
To Reproduce
Results on Windows:
Results on Linux:
Expected behavior
Same behavior when running on Windows/Linux/Docker, independent on the thread culture.
Actual behavior
We are running a docker container with an webapi which uses request localization based on the accept language header. Customers from Norway, France are running into problems, because of the "Input string was not in a correct format." exception (all our queries are on a specific partition key).
Environment summary
SDK Version: 2.32.3
OS Version Windows vs Linux (Ubuntu) vs Official Docker images
Additional context
Add any other context about the problem here (for example, complete stack traces or logs).
The text was updated successfully, but these errors were encountered: