internal abstract Task <PartitionedQueryExecutionInfo> ExecuteQueryPlanRequestAsync( Uri resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, SqlQuerySpec sqlQuerySpec, PartitionKey?partitionKey, string supportedQueryFeatures, CancellationToken cancellationToken);
public abstract Task <PartitionedQueryExecutionInfo> ExecuteQueryPlanRequestAsync( string resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, SqlQuerySpec sqlQuerySpec, PartitionKey?partitionKey, string supportedQueryFeatures, CosmosDiagnosticsContext diagnosticsContext, CancellationToken cancellationToken);
private FeedResponse <T> CreateChangeFeedResponseHelper <T>( ResponseMessage cosmosResponseMessage, Documents.ResourceType resourceType) { return(ReadFeedResponse <T> .CreateResponse <T>( cosmosResponseMessage, this.serializerCore, resourceType)); }
public abstract Task <PartitionedQueryExecutionInfo> ExecuteQueryPlanRequestAsync( string resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, SqlQuerySpec sqlQuerySpec, PartitionKey?partitionKey, string supportedQueryFeatures, Guid clientQueryCorrelationId, ITrace trace, CancellationToken cancellationToken);
internal abstract Task <QueryResponseCore> ExecuteItemQueryAsync <QueryRequestOptionType>( Uri resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, QueryRequestOptionType requestOptions, SqlQuerySpec sqlQuerySpec, string continuationToken, Documents.PartitionKeyRangeIdentity partitionKeyRange, bool isContinuationExpected, int pageSize, CancellationToken cancellationToken);
public abstract Task <TryCatch <PartitionedQueryExecutionInfo> > TryGetPartitionedQueryExecutionInfoAsync( SqlQuerySpec sqlQuerySpec, Documents.ResourceType resourceType, Documents.PartitionKeyDefinition partitionKeyDefinition, bool requireFormattableOrderByQuery, bool isContinuationExpected, bool allowNonValueAggregateQuery, bool hasLogicalPartitionKey, bool allowDCount, bool useSystemPrefix, CancellationToken cancellationToken);
public abstract Task <QueryResponseCore> ExecuteItemQueryAsync( string resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, Guid clientQueryCorrelationId, QueryRequestOptions requestOptions, Action <QueryPageDiagnostics> queryPageDiagnostics, SqlQuerySpec sqlQuerySpec, string continuationToken, Documents.PartitionKeyRangeIdentity partitionKeyRange, bool isContinuationExpected, int pageSize, CancellationToken cancellationToken);
public abstract Task <TryCatch <QueryPage> > ExecuteItemQueryAsync( string resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, Guid clientQueryCorrelationId, FeedRange feedRange, QueryRequestOptions requestOptions, SqlQuerySpec sqlQuerySpec, string continuationToken, bool isContinuationExpected, int pageSize, ITrace trace, CancellationToken cancellationToken);
private FeedResponse <T> CreateQueryFeedResponseHelper <T>( ResponseMessage cosmosResponseMessage, Documents.ResourceType resourceType) { if (cosmosResponseMessage is QueryResponse queryResponse) { return(QueryResponse <T> .CreateResponse <T>( cosmosQueryResponse : queryResponse, serializerCore : this.serializerCore)); } return(ReadFeedResponse <T> .CreateResponse <T>( cosmosResponseMessage, this.serializerCore)); }
public async Task <TryCatch <PartitionedQueryExecutionInfo> > TryGetQueryPlanAsync( SqlQuerySpec sqlQuerySpec, Documents.ResourceType resourceType, PartitionKeyDefinition partitionKeyDefinition, QueryFeatures supportedQueryFeatures, bool hasLogicalPartitionKey, bool useSystemPrefix, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); if (sqlQuerySpec == null) { throw new ArgumentNullException($"{nameof(sqlQuerySpec)}"); } if (partitionKeyDefinition == null) { throw new ArgumentNullException($"{nameof(partitionKeyDefinition)}"); } TryCatch <PartitionedQueryExecutionInfo> tryGetQueryInfo = await this.TryGetQueryInfoAsync( sqlQuerySpec, resourceType, partitionKeyDefinition, hasLogicalPartitionKey, useSystemPrefix, cancellationToken); if (!tryGetQueryInfo.Succeeded) { return(tryGetQueryInfo); } if (QueryPlanExceptionFactory.TryGetUnsupportedException( tryGetQueryInfo.Result.QueryInfo, supportedQueryFeatures, out Exception queryPlanHandlerException)) { return(TryCatch <PartitionedQueryExecutionInfo> .FromException(queryPlanHandlerException)); } return(tryGetQueryInfo); }
internal override Task <PartitionedQueryExecutionInfo> ExecuteQueryPlanRequestAsync( Uri resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, SqlQuerySpec sqlQuerySpec, Cosmos.PartitionKey?partitionKey, string supportedQueryFeatures, CancellationToken cancellationToken) { return(this.QueryClient.ExecuteQueryPlanRequestAsync( resourceUri, resourceType, operationType, sqlQuerySpec, partitionKey, supportedQueryFeatures, this.diagnosticsContext, cancellationToken)); }
public CosmosQueryContext( CosmosQueryClient client, ResourceType resourceTypeEnum, OperationType operationType, Type resourceType, string resourceLink, Guid correlatedActivityId, bool isContinuationExpected, bool allowNonValueAggregateQuery, string containerResourceId = null) { this.OperationTypeEnum = operationType; this.QueryClient = client ?? throw new ArgumentNullException(nameof(client)); this.ResourceTypeEnum = resourceTypeEnum; this.ResourceType = resourceType ?? throw new ArgumentNullException(nameof(resourceType)); this.ResourceLink = resourceLink; this.ContainerResourceId = containerResourceId; this.IsContinuationExpected = isContinuationExpected; this.AllowNonValueAggregateQuery = allowNonValueAggregateQuery; this.CorrelatedActivityId = (correlatedActivityId == Guid.Empty) ? throw new ArgumentOutOfRangeException(nameof(correlatedActivityId)) : correlatedActivityId; }
private FeedResponse <T> CreateQueryFeedResponseHelper <T>( ResponseMessage cosmosResponseMessage, Documents.ResourceType resourceType) { //Throw the exception cosmosResponseMessage.EnsureSuccessStatusCode(); QueryResponse queryResponse = cosmosResponseMessage as QueryResponse; if (queryResponse != null) { return(QueryResponse <T> .CreateResponse <T>( cosmosQueryResponse : queryResponse, serializerCore : this.serializerCore)); } return(ReadFeedResponse <T> .CreateResponse <T>( cosmosResponseMessage, this.serializerCore, resourceType)); }
internal override Task <PartitionedQueryExecutionInfo> ExecuteQueryPlanRequestAsync( string resourceUri, Documents.ResourceType resourceType, Documents.OperationType operationType, SqlQuerySpec sqlQuerySpec, Cosmos.PartitionKey?partitionKey, string supportedQueryFeatures, ITrace trace, CancellationToken cancellationToken) { return(this.QueryClient.ExecuteQueryPlanRequestAsync( resourceUri, resourceType, operationType, sqlQuerySpec, partitionKey, supportedQueryFeatures, this.CorrelatedActivityId, trace, cancellationToken)); }
/// <summary> /// Used in the compute gateway to support legacy gateways query execution pattern. /// </summary> public async Task <TryCatch <(PartitionedQueryExecutionInfo queryPlan, bool supported)> > TryGetQueryInfoAndIfSupportedAsync( QueryFeatures supportedQueryFeatures, SqlQuerySpec sqlQuerySpec, Documents.ResourceType resourceType, PartitionKeyDefinition partitionKeyDefinition, bool hasLogicalPartitionKey, bool useSystemPrefix, CancellationToken cancellationToken = default) { if (sqlQuerySpec == null) { throw new ArgumentNullException(nameof(sqlQuerySpec)); } if (partitionKeyDefinition == null) { throw new ArgumentNullException(nameof(partitionKeyDefinition)); } cancellationToken.ThrowIfCancellationRequested(); TryCatch <PartitionedQueryExecutionInfo> tryGetQueryInfo = await this.TryGetQueryInfoAsync( sqlQuerySpec, resourceType, partitionKeyDefinition, hasLogicalPartitionKey, useSystemPrefix, cancellationToken); if (tryGetQueryInfo.Failed) { return(TryCatch <(PartitionedQueryExecutionInfo, bool)> .FromException(tryGetQueryInfo.Exception)); } QueryFeatures neededQueryFeatures = QueryPlanSupportChecker.GetNeededQueryFeatures( tryGetQueryInfo.Result.QueryInfo, supportedQueryFeatures); return(TryCatch <(PartitionedQueryExecutionInfo, bool)> .FromResult((tryGetQueryInfo.Result, neededQueryFeatures == QueryFeatures.None))); }
private Task <TryCatch <PartitionedQueryExecutionInfo> > TryGetQueryInfoAsync( SqlQuerySpec sqlQuerySpec, Documents.ResourceType resourceType, PartitionKeyDefinition partitionKeyDefinition, bool hasLogicalPartitionKey, bool useSystemPrefix, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); return(this.queryClient.TryGetPartitionedQueryExecutionInfoAsync( sqlQuerySpec: sqlQuerySpec, resourceType: resourceType, partitionKeyDefinition: partitionKeyDefinition, requireFormattableOrderByQuery: true, isContinuationExpected: false, allowNonValueAggregateQuery: true, hasLogicalPartitionKey: hasLogicalPartitionKey, allowDCount: true, useSystemPrefix: useSystemPrefix, cancellationToken: cancellationToken)); }
public abstract FeedResponse <T> CreateQueryFeedResponse <T>( ResponseMessage responseMessage, Documents.ResourceType resourceType);
public override FeedIteratorInternal GetReadFeedIterator(QueryDefinition queryDefinition, QueryRequestOptions queryRequestOptions, string resourceLink, Documents.ResourceType resourceType, string continuationToken, int pageSize) { return(base.GetReadFeedIterator(queryDefinition, queryRequestOptions, resourceLink, resourceType, continuationToken, pageSize)); }
public abstract FeedResponse <T> CreateChangeFeedUserTypeResponse <T>( ResponseMessage responseMessage, Documents.ResourceType resourceType);
public CosmosQueryExecutionContextFactory( CosmosQueryClient client, Documents.ResourceType resourceTypeEnum, Documents.OperationType operationType, Type resourceType, SqlQuerySpec sqlQuerySpec, string continuationToken, QueryRequestOptions queryRequestOptions, Uri resourceLink, bool isContinuationExpected, bool allowNonValueAggregateQuery, Guid correlatedActivityId) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (sqlQuerySpec == null) { throw new ArgumentNullException(nameof(sqlQuerySpec)); } if (queryRequestOptions == null) { throw new ArgumentNullException(nameof(queryRequestOptions)); } if (resourceLink == null) { throw new ArgumentNullException(nameof(resourceLink)); } // Prevent users from updating the values after creating the execution context. QueryRequestOptions cloneQueryRequestOptions = queryRequestOptions.Clone(); // Swapping out negative values in feedOptions for int.MaxValue if (cloneQueryRequestOptions.MaxBufferedItemCount.HasValue && cloneQueryRequestOptions.MaxBufferedItemCount < 0) { cloneQueryRequestOptions.MaxBufferedItemCount = int.MaxValue; } if (cloneQueryRequestOptions.MaxConcurrency.HasValue && cloneQueryRequestOptions.MaxConcurrency < 0) { cloneQueryRequestOptions.MaxConcurrency = int.MaxValue; } if (cloneQueryRequestOptions.MaxItemCount.HasValue && cloneQueryRequestOptions.MaxItemCount < 0) { cloneQueryRequestOptions.MaxItemCount = int.MaxValue; } this.InitialUserContinuationToken = continuationToken; this.CosmosQueryContext = new CosmosQueryContext( client: client, resourceTypeEnum: resourceTypeEnum, operationType: operationType, resourceType: resourceType, sqlQuerySpecFromUser: sqlQuerySpec, queryRequestOptions: cloneQueryRequestOptions, resourceLink: resourceLink, isContinuationExpected: isContinuationExpected, allowNonValueAggregateQuery: allowNonValueAggregateQuery, correlatedActivityId: correlatedActivityId); }