Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
66359b8
document async transport requirement (#6541)
chlowell Jul 30, 2019
379c1a1
[AutoPR] alertsmanagement/resource-manager (#5697)
AutorestCI Jul 30, 2019
7a0f5d3
Synchronous username/password auth (#6416)
chlowell Jul 30, 2019
f9f2db1
Synchronous interactive browser authentication (#6466)
chlowell Jul 30, 2019
f583901
we dont need thread locks (#6551)
SuyogSoti Jul 30, 2019
e833df0
KV aiohttp by default (#6563)
lmazuel Jul 31, 2019
95220b7
[AutoPR hanaonazure/resource-manager] Removing monitoring hana instan…
AutorestCI Jul 31, 2019
02e17b7
KV moved paging return type to ItemPaged (#6558)
lmazuel Jul 31, 2019
37c46c6
azure-core history 1.0.0b2 (#6562)
lmazuel Jul 31, 2019
c6ebc93
Make private Cosmos modules private [WIP] (#6329)
bryevdv Jul 31, 2019
d3d96df
Accept extension of JSON content-type (#6583)
lmazuel Jul 31, 2019
d2ed7d8
Remove docdb mgmt package from master (#6585)
lmazuel Jul 31, 2019
92583cf
Revert "Remove docdb mgmt package from master (#6585)" (#6593)
lmazuel Jul 31, 2019
1d86ae8
azure-core black/pylint/mypy (#6581)
lmazuel Aug 1, 2019
a08c25a
adjusting to allow default omission of packages for CI. (#6595)
scbedd Aug 1, 2019
b0bd437
Synchronous device code credential (#6464)
chlowell Aug 1, 2019
f700299
[AutoPR alertsmanagement/resource-manager] fixing subscription id iss…
AutorestCI Aug 1, 2019
64b121c
Remove Configuration from public API (#6603)
chlowell Aug 1, 2019
ccd73c1
[AutoPR] security/resource-manager (#5709)
AutorestCI Aug 1, 2019
33d6e4a
Minimal change to disable code coverage publishing for PRs. (#6614)
mitchdenny Aug 1, 2019
0249a7c
Readme doc update for azure-core (#6611)
lmazuel Aug 1, 2019
e12b658
Mypy fixes for azure.core.tracing (#6590)
SuyogSoti Aug 2, 2019
abc3f20
MyPy azure-core (#6619)
lmazuel Aug 2, 2019
8eb5e9b
Update Key Vault docstrings (#6632)
chlowell Aug 2, 2019
2a7a965
Update Key Vault user agent (#6640)
chlowell Aug 2, 2019
b647582
Update README.md (#6635)
lmazuel Aug 2, 2019
f9ab732
mypy fixes (#6641)
SuyogSoti Aug 2, 2019
46c7ad6
Policies as kwargs for KeyVault (#6616)
lmazuel Aug 3, 2019
5b5ed26
Mypy fixes (#6646)
xiangyan99 Aug 3, 2019
8d17ca3
[AutoPR healthcareapis/resource-manager] Fixed healthcareapi readme.m…
AutorestCI Aug 5, 2019
c257006
fixed bug in maxItemCount propagation for Order by queries (#6608)
Aug 5, 2019
4470f79
Final azure-identity preview 2 changes (#6664)
chlowell Aug 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed bug in maxItemCount propagation for Order by queries (#6608)
* fixed bug with maxItemCount in order by queries

* fixed merge conflicts
  • Loading branch information
Srinath Narayanan authored Aug 5, 2019
commit c25700694fcab42f021b2de2e0e1ff87cb2c8c0d
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ class _DocumentProducer(object):
When handling an orderby query, MultiExecutionContextAggregator instantiates one instance of this class
per target partition key range and aggregates the result of each.
'''
def __init__(self, partition_key_target_range, client, collection_link, query, document_producer_comp):
def __init__(self, partition_key_target_range, client, collection_link, query, document_producer_comp, options):
'''
Constructor
'''
# TODO: is that fine we build the options dict and we don't inherit it?
self._options = {}
self._options = options
self._partition_key_target_range = partition_key_target_range
self._doc_producer_comp = document_producer_comp
self._client = client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _createTargetPartitionQueryExecutionContext(self, partition_key_target_range
else:
query = self._query

return document_producer._DocumentProducer(partition_key_target_range, self._client, self._resource_link, query, self._document_producer_comparator)
return document_producer._DocumentProducer(partition_key_target_range, self._client, self._resource_link, query, self._document_producer_comparator, self._options)

def _get_target_parition_key_range(self):

Expand Down
42 changes: 42 additions & 0 deletions sdk/cosmos/azure-cosmos/test/query_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
import uuid
import azure.cosmos.cosmos_client as cosmos_client
import azure.cosmos._retry_utility as retry_utility
import pytest
import test_config

Expand Down Expand Up @@ -172,6 +174,46 @@ def test_populate_query_metrics(self):
self.assertTrue(len(metrics) > 1)
self.assertTrue(all(['=' in x for x in metrics]))

def test_max_item_count_honored_in_order_by_query(self):
created_collection = self.config.create_multi_partition_collection_with_custom_pk_if_not_exist(self.client)
docs = []
for i in range(10):
document_definition = {'pk': 'pk', 'id': 'myId' + str(uuid.uuid4())}
docs.append(created_collection.create_item(body=document_definition))

query = 'SELECT * from c ORDER BY c._ts'
query_iterable = created_collection.query_items(
query=query,
max_item_count=1,
enable_cross_partition_query=True
)
# 1 call to get query plans, 1 call to get pkr, 10 calls to one partion with the documents, 1 call each to other 4 partitions
self.validate_query_requests_count(query_iterable, 16 * 2)

query_iterable = created_collection.query_items(
query=query,
max_item_count=100,
enable_cross_partition_query=True
)

# 1 call to get query plan 1 calls to one partition with the documents, 1 call each to other 4 partitions
self.validate_query_requests_count(query_iterable, 6 * 2)

def validate_query_requests_count(self, query_iterable, expected_count):
self.count = 0
self.OriginalExecuteFunction = retry_utility.ExecuteFunction
retry_utility.ExecuteFunction = self._MockExecuteFunction
block = query_iterable.fetch_next_block()
while block:
block = query_iterable.fetch_next_block()
retry_utility.ExecuteFunction = self.OriginalExecuteFunction
self.assertEquals(self.count, expected_count)
self.count = 0

def _MockExecuteFunction(self, function, *args, **kwargs):
self.count += 1
return self.OriginalExecuteFunction(function, *args, **kwargs)


if __name__ == "__main__":
unittest.main()