Example #1
0
        public static Task <PartitionedQueryExecutionInfo> GetQueryPlanThroughGatewayAsync(
            CosmosQueryContext queryContext,
            SqlQuerySpec sqlQuerySpec,
            Uri resourceLink,
            PartitionKey?partitionKey,
            CancellationToken cancellationToken = default)
        {
            if (queryContext == null)
            {
                throw new ArgumentNullException(nameof(queryContext));
            }

            if (sqlQuerySpec == null)
            {
                throw new ArgumentNullException(nameof(sqlQuerySpec));
            }

            if (resourceLink == null)
            {
                throw new ArgumentNullException(nameof(resourceLink));
            }

            cancellationToken.ThrowIfCancellationRequested();

            return(queryContext.ExecuteQueryPlanRequestAsync(
                       resourceLink,
                       ResourceType.Document,
                       OperationType.QueryPlan,
                       sqlQuerySpec,
                       partitionKey,
                       QueryPlanRetriever.SupportedQueryFeaturesString,
                       cancellationToken));
        }
Example #2
0
        public static Task <PartitionedQueryExecutionInfo> GetQueryPlanThroughGatewayAsync(
            CosmosQueryContext queryContext,
            SqlQuerySpec sqlQuerySpec,
            string resourceLink,
            PartitionKey?partitionKey,
            ITrace trace,
            CancellationToken cancellationToken = default)
        {
            if (queryContext == null)
            {
                throw new ArgumentNullException(nameof(queryContext));
            }

            if (sqlQuerySpec == null)
            {
                throw new ArgumentNullException(nameof(sqlQuerySpec));
            }

            if (resourceLink == null)
            {
                throw new ArgumentNullException(nameof(resourceLink));
            }

            cancellationToken.ThrowIfCancellationRequested();

            using (ITrace gatewayQueryPlanTrace = trace.StartChild("Gateway QueryPlan", TraceComponent.Query, TraceLevel.Info))
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
                    Documents.ServiceInteropWrapper.Is64BitProcess)
                {
                    // It's Windows and x64, should have loaded the DLL
                    gatewayQueryPlanTrace.AddDatum("ServiceInterop unavailable", true);
                }

                return(queryContext.ExecuteQueryPlanRequestAsync(
                           resourceLink,
                           ResourceType.Document,
                           OperationType.QueryPlan,
                           sqlQuerySpec,
                           partitionKey,
                           QueryPlanRetriever.SupportedQueryFeaturesString,
                           trace,
                           cancellationToken));
            }
        }
Example #3
0
        public static Task <PartitionedQueryExecutionInfo> GetQueryPlanThroughGatewayAsync(
            CosmosQueryContext queryContext,
            SqlQuerySpec sqlQuerySpec,
            string resourceLink,
            PartitionKey?partitionKey,
            ITrace trace,
            CancellationToken cancellationToken = default)
        {
            if (queryContext == null)
            {
                throw new ArgumentNullException(nameof(queryContext));
            }

            if (sqlQuerySpec == null)
            {
                throw new ArgumentNullException(nameof(sqlQuerySpec));
            }

            if (resourceLink == null)
            {
                throw new ArgumentNullException(nameof(resourceLink));
            }

            cancellationToken.ThrowIfCancellationRequested();

            using (ITrace gatewayQueryPlanTrace = trace.StartChild("Gateway QueryPlan", TraceComponent.Query, TraceLevel.Info))
            {
                return(queryContext.ExecuteQueryPlanRequestAsync(
                           resourceLink,
                           ResourceType.Document,
                           OperationType.QueryPlan,
                           sqlQuerySpec,
                           partitionKey,
                           QueryPlanRetriever.SupportedQueryFeaturesString,
                           trace,
                           cancellationToken));
            }
        }