You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have a Microsoft.Azure.Cosmos.Container instance where I'm using GetItemQueryIterator<T> to get an iterator, then I do await iterator.ReadNextAsync() - if I give the iterator any valid sql query, the response's StatusCode property value is 0 but I do get my data. If I don't give the iterator a sql query (leave the parameter to be null) the StatusCode is 202 Accepted and I get the expected data. If I use GetItemQueryStreamIterator instead, with a valid sql query, I get StatusCode 200 OK.
To Reproduce
//query has been simplified for testing purposes - I confirmed the issue is present with this query. The value of "_container.Id" is the name of my collection in CosmosDb.
QueryDefinition sqlQuery = new QueryDefinition($"select * from {_container.Id}");
//QueryStreamIterator implementation start --- Using a stream iterator works fine
var streamIterator = _container.GetItemQueryStreamIterator(sqlQuery, continuationToken,
new QueryRequestOptions()
{
MaxItemCount = maxItems
});
while (streamIterator.HasMoreResults)
{
var results = await streamIterator.ReadNextAsync();
//At this point results.StatusCode is 200 OK
Stream stream = results.Content;
using (var reader = new StreamReader(stream))
{
//all expected data is received.
string data = await reader.ReadToEndAsync();
}
}
//QueryStreamIterator implementation end ---
//QueryIterator implementation start ---
var iterator = _container.GetItemQueryIterator<T>(sqlQuery, continuationToken,
new QueryRequestOptions()
{
MaxItemCount = maxItems
});
var result = await iterator.ReadNextAsync();
//Here result.StatusCode is 0, but I do get my data. If I make "sqlQuery" null - here I get StatusCode 202 Accepted.
if (result.StatusCode == HttpStatusCode.Accepted)
{
return new ExportResult<T>
{
HasMore = iterator.HasMoreResults, //this is "true", as expected
Items = result.Resource.ToList(), //my data is received as expected
ContinuationToken = result.ContinuationToken //this is populated and works as expected when provided on subsequent call
};
}
Expected behavior
To not receive StatusCode 0 when I actually got my data in the response. Also, why when using GetItemQueryStreamIterator's ReadNextAsync the response's StatusCode is 200 OK but when using GetItemQueryIterator<T> with a null query string parameter value the response's StatusCode is 202 Accepted? I'd expect both of them to be 200 OK.
Environment summary
SDK Version: first observed in v3.0, issue persists in v3.1.0
OS Version: Windows 10
The text was updated successfully, but these errors were encountered:
Describe the bug
I have a
Microsoft.Azure.Cosmos.Container
instance where I'm usingGetItemQueryIterator<T>
to get an iterator, then I doawait iterator.ReadNextAsync()
- if I give the iterator any valid sql query, the response's StatusCode property value is 0 but I do get my data. If I don't give the iterator a sql query (leave the parameter to be null) the StatusCode is 202 Accepted and I get the expected data. If I useGetItemQueryStreamIterator
instead, with a valid sql query, I get StatusCode 200 OK.To Reproduce
Expected behavior
To not receive StatusCode 0 when I actually got my data in the response. Also, why when using
GetItemQueryStreamIterator
'sReadNextAsync
the response's StatusCode is 200 OK but when usingGetItemQueryIterator<T>
with a null query string parameter value the response's StatusCode is 202 Accepted? I'd expect both of them to be 200 OK.Environment summary
SDK Version: first observed in v3.0, issue persists in v3.1.0
OS Version: Windows 10
The text was updated successfully, but these errors were encountered: