Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package com.azure.cosmos.benchmark;

import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.implementation.RequestOptions;
import org.apache.commons.lang3.RandomStringUtils;
Expand Down Expand Up @@ -37,7 +37,7 @@ protected void performWorkload(BaseSubscriber<Object> documentBaseSubscriber, lo

} else if (i % 100 == 0) {

FeedOptions options = new FeedOptions();
QueryRequestOptions options = new QueryRequestOptions();

String sqlQuery = "Select top 100 * from c order by c._ts";
obs = cosmosAsyncContainer.queryItems(sqlQuery, options, PojoizedJson.class).byPage(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package com.azure.cosmos.benchmark;

import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.models.SqlParameter;
Expand Down Expand Up @@ -72,7 +72,7 @@ protected void onSuccess() {
protected void performWorkload(BaseSubscriber<FeedResponse<PojoizedJson>> baseSubscriber, long i) throws InterruptedException {
Flux<FeedResponse<PojoizedJson>> obs;
Random r = new Random();
FeedOptions options = new FeedOptions();
QueryRequestOptions options = new QueryRequestOptions();

if (configuration.getOperationType() == Configuration.Operation.QueryCross) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package com.azure.cosmos.benchmark;

import com.azure.cosmos.util.CosmosPagedFlux;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.PartitionKey;
import reactor.core.publisher.BaseSubscriber;
Expand All @@ -13,12 +13,12 @@
class AsyncQuerySinglePartitionMultiple extends AsyncBenchmark<FeedResponse<PojoizedJson>> {

private static final String SQL_QUERY = "Select * from c where c.pk = \"pk\"";
private FeedOptions options;
private QueryRequestOptions options;
private int pageCount = 0;

AsyncQuerySinglePartitionMultiple(Configuration cfg) {
super(cfg);
options = new FeedOptions();
options = new QueryRequestOptions();
options.setPartitionKey(new PartitionKey("pk"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.azure.cosmos.implementation.AsyncDocumentClient;
import com.azure.cosmos.implementation.Database;
import com.azure.cosmos.implementation.Document;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.implementation.NotFoundException;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.models.SqlParameter;
Expand Down Expand Up @@ -242,7 +242,7 @@ private SqlQuerySpec generateRandomQuery() {
* @return Observable document
*/
private Flux<Document> xPartitionQuery(SqlQuerySpec query) {
FeedOptions options = new FeedOptions();
QueryRequestOptions options = new QueryRequestOptions();
options.setMaxDegreeOfParallelism(-1);

return client.<Document>queryDocuments(getCollectionLink(), query, options)
Expand All @@ -257,7 +257,7 @@ private Flux<Document> xPartitionQuery(SqlQuerySpec query) {
* @return Observable document
*/
private Flux<Document> singlePartitionQuery(Document d) {
FeedOptions options = new FeedOptions();
QueryRequestOptions options = new QueryRequestOptions();
options.setPartitionKey(new PartitionKey(d.get(partitionKey)));

SqlQuerySpec sqlQuerySpec = new SqlQuerySpec(String.format("Select top 100 * from c where c.%s = '%s'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.azure.cosmos.CosmosException;
import com.azure.cosmos.models.CosmosContainerProperties;
import com.azure.cosmos.util.CosmosPagedFlux;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.PartitionKey;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -113,7 +113,7 @@ private void createDbAndContainerBlocking() {
private void queryItems() {
log("+ Querying the collection ");
String query = "SELECT * from root";
FeedOptions options = new FeedOptions();
QueryRequestOptions options = new QueryRequestOptions();
options.setMaxDegreeOfParallelism(2);
CosmosPagedFlux<TestObject> queryFlux = container.queryItems(query, options, TestObject.class);

Expand All @@ -129,7 +129,7 @@ private void queryItems() {
private void queryWithContinuationToken() {
log("+ Query with paging using continuation token");
String query = "SELECT * from root r ";
FeedOptions options = new FeedOptions();
QueryRequestOptions options = new QueryRequestOptions();
options.setQueryMetricsEnabled(true);
String continuation = null;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.azure.cosmos.implementation.AsyncDocumentClient;
import com.azure.cosmos.CosmosException;
import com.azure.cosmos.implementation.Document;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.ModelBridgeInternal;
import org.slf4j.Logger;
Expand Down Expand Up @@ -85,8 +85,8 @@ public Mono<Void> readAllAsync(int expectedNumberOfDocuments) {
FeedResponse<Document> response = null;
do {

FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);

response = this.client.readDocuments(this.documentCollectionUri, options).take(1)
.subscribeOn(schedulerForBlockingWork).single().block();
Expand Down Expand Up @@ -122,8 +122,8 @@ void deleteAll() {
FeedResponse<Document> response = null;
do {

FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsContinuationToken(options, response != null ? response.getContinuationToken() : null);

response = this.client.readDocuments(this.documentCollectionUri, options).take(1)
.subscribeOn(schedulerForBlockingWork).single().block();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
import com.azure.cosmos.DirectConnectionConfig;
import com.azure.cosmos.implementation.AsyncDocumentClient;
import com.azure.cosmos.implementation.Conflict;
import com.azure.cosmos.ConnectionMode;
import com.azure.cosmos.implementation.ConnectionPolicy;
import com.azure.cosmos.ConsistencyLevel;
import com.azure.cosmos.implementation.Database;
import com.azure.cosmos.implementation.Document;
import com.azure.cosmos.DocumentClientTest;
import com.azure.cosmos.implementation.DocumentCollection;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.ModelBridgeInternal;
import com.azure.cosmos.models.PartitionKeyDefinition;
Expand Down Expand Up @@ -106,8 +105,8 @@ public void shutdown() {
public void readConflicts_toBlocking_toIterator() {
// read all conflicts
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Conflict>> conflictReadFeedObservable = client
.readConflicts(getCollectionLink(), options);
Expand Down Expand Up @@ -136,8 +135,8 @@ public void readConflicts_toBlocking_toIterator() {
@Test(groups = "samples", timeOut = TIMEOUT)
public void transformObservableToCompletableFuture() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Conflict>> conflictReadFeedObservable = client
.readConflicts(getCollectionLink(), options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.azure.cosmos.ConsistencyLevel;
import com.azure.cosmos.CosmosException;
import com.azure.cosmos.DocumentClientTest;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.models.PartitionKeyDefinition;
Expand Down Expand Up @@ -416,7 +416,7 @@ public void documentDelete_Async() throws Exception {
assertThat(capturedResponse, hasSize(1));

// Assert document is deleted
FeedOptions queryOptions = new FeedOptions();
QueryRequestOptions queryOptions = new QueryRequestOptions();
List<Document> listOfDocuments = client
.queryDocuments(getCollectionLink(), String.format("SELECT * FROM r where r.id = '%s'", createdDocument.getId()), queryOptions)
.map(FeedResponse::getResults) // Map page to its list of documents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

import com.azure.cosmos.DirectConnectionConfig;
import com.azure.cosmos.implementation.AsyncDocumentClient;
import com.azure.cosmos.ConnectionMode;
import com.azure.cosmos.implementation.ConnectionPolicy;
import com.azure.cosmos.ConsistencyLevel;
import com.azure.cosmos.implementation.Database;
import com.azure.cosmos.implementation.Document;
import com.azure.cosmos.DocumentClientTest;
import com.azure.cosmos.implementation.DocumentCollection;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.ModelBridgeInternal;
import com.azure.cosmos.models.PartitionKeyDefinition;
Expand Down Expand Up @@ -132,8 +131,8 @@ public void shutdown() {
@Test(groups = "samples", timeOut = TIMEOUT)
public void queryDocuments_Async() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Document>> documentQueryObservable = client
.queryDocuments(getCollectionLink(), "SELECT * FROM root", options);
Expand Down Expand Up @@ -177,8 +176,8 @@ public void queryDocuments_Async() throws Exception {
@Test(groups = "samples", timeOut = TIMEOUT)
public void queryDocuments_Async_withoutLambda() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Document>> documentQueryObservable = client
.queryDocuments(getCollectionLink(), "SELECT * FROM root", options);
Expand Down Expand Up @@ -225,8 +224,8 @@ public void accept(FeedResponse<Document> t) {
@Test(groups = "samples", timeOut = TIMEOUT)
public void queryDocuments_findTotalRequestCharge() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<Double> totalChargeObservable = client
.queryDocuments(getCollectionLink(), "SELECT * FROM root", options)
Expand All @@ -249,8 +248,8 @@ public void queryDocuments_findTotalRequestCharge() throws Exception {
@Test(groups = "samples", timeOut = TIMEOUT)
public void queryDocuments_unsubscribeAfterFirstPage() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Document>> requestChargeObservable = client
.queryDocuments(getCollectionLink(), "SELECT * FROM root", options);
Expand Down Expand Up @@ -285,8 +284,8 @@ public void queryDocuments_unsubscribeAfterFirstPage() throws Exception {
@Test(groups = "samples", timeOut = TIMEOUT)
public void queryDocuments_filterFetchedResults() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Predicate<Document> isPrimeNumber = new Predicate<Document>() {

Expand Down Expand Up @@ -346,8 +345,8 @@ public boolean test(Document doc) {
public void queryDocuments_toBlocking_toIterator() {
// Query for documents
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Document>> documentQueryObservable = client
.queryDocuments(getCollectionLink(), "SELECT * FROM root", options);
Expand Down Expand Up @@ -395,8 +394,8 @@ public void qrderBy_Async() throws Exception {

// Query for the documents order by the prop field
SqlQuerySpec query = new SqlQuerySpec("SELECT r.id FROM r ORDER BY r.prop", new ArrayList<>());
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, 5);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 5);

// Max degree of parallelism determines the number of partitions that
// the SDK establishes simultaneous connections to.
Expand Down Expand Up @@ -431,8 +430,8 @@ public void qrderBy_Async() throws Exception {
@Test(groups = "samples", timeOut = TIMEOUT)
public void transformObservableToCompletableFuture() throws Exception {
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<FeedResponse<Document>> documentQueryObservable = client
.queryDocuments(getCollectionLink(), "SELECT * FROM root", options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

import com.azure.cosmos.DirectConnectionConfig;
import com.azure.cosmos.implementation.AsyncDocumentClient;
import com.azure.cosmos.ConnectionMode;
import com.azure.cosmos.implementation.ConnectionPolicy;
import com.azure.cosmos.ConsistencyLevel;
import com.azure.cosmos.implementation.Database;
import com.azure.cosmos.implementation.Document;
import com.azure.cosmos.DocumentClientTest;
import com.azure.cosmos.implementation.DocumentCollection;
import com.azure.cosmos.models.FeedOptions;
import com.azure.cosmos.models.QueryRequestOptions;
import com.azure.cosmos.models.ModelBridgeInternal;
import com.azure.cosmos.models.PartitionKeyDefinition;
import com.azure.cosmos.models.SqlParameter;
Expand Down Expand Up @@ -108,8 +107,8 @@ public void shutdown() {
public void groupByInMemory() {
// If you want to understand the steps in more details see groupByInMemoryMoreDetail()
int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<Document> documentsObservable = client
.<Document>queryDocuments(getCollectionLink(),
Expand Down Expand Up @@ -139,8 +138,8 @@ public void groupByInMemory() {
public void groupByInMemory_MoreDetail() {

int requestPageSize = 3;
FeedOptions options = new FeedOptions();
ModelBridgeInternal.setFeedOptionsMaxItemCount(options, requestPageSize);
QueryRequestOptions options = new QueryRequestOptions();
ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, requestPageSize);

Flux<Document> documentsObservable = client
.<Document>queryDocuments(getCollectionLink(),
Expand Down
Loading