Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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 @@ -161,29 +161,7 @@ private static async Task<TryCatch<IQueryPipelineStage>> TryCreateCoreContextAsy
}

PartitionedQueryExecutionInfo partitionedQueryExecutionInfo;
if (inputParameters.ForcePassthrough)
{
partitionedQueryExecutionInfo = new PartitionedQueryExecutionInfo()
{
QueryInfo = new QueryInfo()
{
Aggregates = null,
DistinctType = DistinctQueryType.None,
GroupByAliases = null,
GroupByAliasToAggregateType = null,
GroupByExpressions = null,
HasSelectValue = false,
Limit = null,
Offset = null,
OrderBy = null,
OrderByExpressions = null,
RewrittenQuery = null,
Top = null,
},
QueryRanges = new List<Documents.Routing.Range<string>>(),
};
}
else if (queryPlanFromContinuationToken != null)
if (queryPlanFromContinuationToken != null)
{
partitionedQueryExecutionInfo = queryPlanFromContinuationToken;
}
Expand Down Expand Up @@ -285,11 +263,9 @@ private static async Task<TryCatch<IQueryPipelineStage>> TryCreateFromPartitione
&& !partitionedQueryExecutionInfo.QueryInfo.HasLimit
&& !partitionedQueryExecutionInfo.QueryInfo.HasOffset;
bool streamingCrossContinuationQuery = !singleLogicalPartitionKeyQuery && clientStreamingQuery;

bool createPassthroughQuery = streamingSinglePartitionQuery || streamingCrossContinuationQuery;

TryCatch<IQueryPipelineStage> tryCreatePipelineStage;

TryCatch<IQueryPipelineStage> tryCreatePipelineStage;
Documents.PartitionKeyRange targetRange = await TryGetTargetRangeOptimisticDirectExecutionAsync(
inputParameters,
partitionedQueryExecutionInfo,
Expand Down Expand Up @@ -432,7 +408,6 @@ private static TryCatch<IQueryPipelineStage> TryCreateSpecializedDocumentQueryEx
inputParameters.PartitionedQueryExecutionInfo,
inputParameters.ExecutionEnvironment,
inputParameters.ReturnResultsInDeterministicOrder,
inputParameters.ForcePassthrough,
inputParameters.EnableOptimisticDirectExecution,
inputParameters.TestInjections);
}
Expand Down Expand Up @@ -746,7 +721,7 @@ private static void SetTestInjectionPipelineType(InputParameters inputParameters
{
responseStats.PipelineType = TestInjections.PipelineType.Specialized;
}
else
else
{
responseStats.PipelineType = TestInjections.PipelineType.Passthrough;
}
Expand Down Expand Up @@ -865,7 +840,6 @@ public InputParameters(
PartitionedQueryExecutionInfo partitionedQueryExecutionInfo,
ExecutionEnvironment? executionEnvironment,
bool? returnResultsInDeterministicOrder,
bool forcePassthrough,
bool enableOptimisticDirectExecution,
TestInjections testInjections)
{
Expand Down Expand Up @@ -899,7 +873,6 @@ public InputParameters(
this.PartitionedQueryExecutionInfo = partitionedQueryExecutionInfo;
this.ExecutionEnvironment = executionEnvironment.GetValueOrDefault(InputParameters.DefaultExecutionEnvironment);
this.ReturnResultsInDeterministicOrder = returnResultsInDeterministicOrder.GetValueOrDefault(InputParameters.DefaultReturnResultsInDeterministicOrder);
this.ForcePassthrough = forcePassthrough;
this.EnableOptimisticDirectExecution = enableOptimisticDirectExecution;
this.TestInjections = testInjections;
}
Expand All @@ -916,7 +889,6 @@ public InputParameters(
public ExecutionEnvironment ExecutionEnvironment { get; }
public bool ReturnResultsInDeterministicOrder { get; }
public TestInjections TestInjections { get; }
public bool ForcePassthrough { get; }
public bool EnableOptimisticDirectExecution { get; }

public InputParameters WithContinuationToken(CosmosElement token)
Expand All @@ -933,7 +905,6 @@ public InputParameters WithContinuationToken(CosmosElement token)
this.PartitionedQueryExecutionInfo,
this.ExecutionEnvironment,
this.ReturnResultsInDeterministicOrder,
this.ForcePassthrough,
this.EnableOptimisticDirectExecution,
this.TestInjections);
}
Expand Down
2 changes: 0 additions & 2 deletions Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public static QueryIterator Create(
string resourceLink,
bool isContinuationExpected,
bool allowNonValueAggregateQuery,
bool forcePassthrough,
PartitionedQueryExecutionInfo partitionedQueryExecutionInfo,
Documents.ResourceType resourceType)
{
Expand Down Expand Up @@ -145,7 +144,6 @@ public static QueryIterator Create(
partitionedQueryExecutionInfo: partitionedQueryExecutionInfo,
executionEnvironment: queryRequestOptions.ExecutionEnvironment,
returnResultsInDeterministicOrder: queryRequestOptions.ReturnResultsInDeterministicOrder,
forcePassthrough: forcePassthrough,
enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution,
testInjections: queryRequestOptions.TestSettings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public override async Task<TryExecuteQueryResult> TryExecuteQueryAsync(
if (feedRangeInternal != null)
{
// The user has scoped down to a physical partition or logical partition.
// In either case let the query execute as a passthrough.
// In either case, Ode pipeline should be able to execute this query if Ode has been enabled by the user.
QueryIterator passthroughQueryIterator = QueryIterator.Create(
containerCore: this,
client: this.queryClient,
Expand All @@ -374,7 +374,6 @@ public override async Task<TryExecuteQueryResult> TryExecuteQueryAsync(
resourceLink: this.LinkUri,
isContinuationExpected: false,
allowNonValueAggregateQuery: true,
forcePassthrough: true, // Forcing a passthrough, since we don't want to get the query plan nor try to rewrite it.
partitionedQueryExecutionInfo: null,
resourceType: ResourceType.Document);

Expand Down Expand Up @@ -438,7 +437,6 @@ public override async Task<TryExecuteQueryResult> TryExecuteQueryAsync(
resourceLink: this.LinkUri,
isContinuationExpected: false,
allowNonValueAggregateQuery: true,
forcePassthrough: false,
partitionedQueryExecutionInfo: queryPlan,
resourceType: ResourceType.Document);

Expand Down Expand Up @@ -835,7 +833,6 @@ public override FeedIteratorInternal GetItemQueryStreamIteratorInternal(
resourceLink: this.LinkUri,
isContinuationExpected: isContinuationExcpected,
allowNonValueAggregateQuery: true,
forcePassthrough: false,
partitionedQueryExecutionInfo: null,
resourceType: ResourceType.Document);
}
Expand Down Expand Up @@ -874,7 +871,6 @@ public override FeedIteratorInternal GetReadFeedIterator(
resourceLink: resourceLink,
isContinuationExpected: false,
allowNonValueAggregateQuery: true,
forcePassthrough: false,
partitionedQueryExecutionInfo: null,
resourceType: resourceType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,10 @@ private async Task TestTryExecuteQueryHelper(
}

{
// Test that the force passthrough mechanism works
// Test that this query is unsupported
ContainerInternal.TryExecuteQueryResult tryExecuteQueryResult = await conatinerCore.TryExecuteQueryAsync(
supportedQueryFeatures: QueryFeatures.None, // Not supporting any features
queryDefinition: new QueryDefinition("SELECT VALUE [{\"item\": {\"sum\": SUM(c.blah), \"count\": COUNT(c.blah)}}] FROM c"), // Query has aggregates
queryDefinition: new QueryDefinition("SELECT VALUE [{\"item\": {\"sum\": SUM(c.blah), \"count\": COUNT(c.blah)}}] FROM c"), // Query has composition of aggregates
requestOptions: new QueryRequestOptions()
{
MaxConcurrency = 1,
Expand All @@ -664,7 +664,7 @@ private async Task TestTryExecuteQueryHelper(
Assert.IsTrue(tryExecuteQueryResult is ContainerInternal.QueryPlanIsSupportedResult);
ContainerInternal.QueryPlanIsSupportedResult queryPlanIsSupportedResult = (ContainerInternal.QueryPlanIsSupportedResult)tryExecuteQueryResult;
ResponseMessage response = await queryPlanIsSupportedResult.QueryIterator.ReadNextAsync();
Assert.IsTrue(response.IsSuccessStatusCode, response.ErrorMessage);
Assert.IsFalse(response.IsSuccessStatusCode, response.ErrorMessage);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,6 @@ public override OptimisticDirectExecutionTestOutput ExecuteTest(OptimisticDirect
partitionedQueryExecutionInfo: null,
executionEnvironment: null,
returnResultsInDeterministicOrder: null,
forcePassthrough: false,
enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution,
testInjections: queryRequestOptions.TestSettings);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ private async Task TestPageSizeAsync(string query, int expectedPageSize, int exp
partitionedQueryExecutionInfo: null,
executionEnvironment: null,
returnResultsInDeterministicOrder: null,
forcePassthrough: false,
enableOptimisticDirectExecution: queryRequestOptions.EnableOptimisticDirectExecution,
testInjections: queryRequestOptions.TestSettings);

Expand Down