From fc1a03457ed786f2b4cddea66a2c8e3ae69660cd Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 12:07:50 -0700 Subject: [PATCH 01/13] Code changes to update Direct version to 3.39.1 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2d959927aa..fc13be431c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ 3.51.0 3.52.0 preview.0 - 3.38.0 + 3.39.1 1.0.0 beta.0 2.0.5 From 4b696ab29bb0f261dd21795b9426acbffebd438f Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 11:57:36 -0700 Subject: [PATCH 02/13] Code changes to fix address cache test. --- .../GatewayAddressCacheTests.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs index 54b49e4f82..aa088340fd 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs @@ -1097,10 +1097,11 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabled_ShouldValidat Assert.AreEqual(0, addressInfo.AllAddresses.Count(x => x.PhysicalUri == newAddress)); // Because force refresh is requested, an unhealthy replica is added to the failed endpoint so that it's status could be validted. - request.RequestContext.FailedEndpoints.Value.Add( - new TransportAddressUri( + request.RequestContext.FailedEndpoints.Value.TryAdd( + key: new TransportAddressUri( addressUri: new Uri( - uriString: addressTobeMarkedUnhealthy))); + uriString: addressTobeMarkedUnhealthy)), + value: true); addressInfo = await cache.TryGetAddressesAsync( request: request, @@ -1250,10 +1251,11 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr Assert.AreEqual(0, addressInfo.AllAddresses.Count(x => x.PhysicalUri == newAddress)); // Because force refresh is requested, an unhealthy replica is added to the failed endpoint so that it's health status could be validted. - request.RequestContext.FailedEndpoints.Value.Add( - new TransportAddressUri( + request.RequestContext.FailedEndpoints.Value.TryAdd( + key: new TransportAddressUri( addressUri: new Uri( - uriString: addressTobeMarkedUnhealthy))); + uriString: addressTobeMarkedUnhealthy)), + value: true); addressInfo = await cache.TryGetAddressesAsync( request: request, @@ -1554,10 +1556,11 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationDisabled_ShouldNotVal Assert.AreEqual(0, addressInfo.AllAddresses.Count(x => x.PhysicalUri == newAddress)); // Because force refresh is requested, an unhealthy replica is added to the failed endpoint so that it's status could be validted. - request.RequestContext.FailedEndpoints.Value.Add( - new TransportAddressUri( + request.RequestContext.FailedEndpoints.Value.TryAdd( + key: new TransportAddressUri( addressUri: new Uri( - uriString: addressTobeMarkedUnhealthy))); + uriString: addressTobeMarkedUnhealthy)), + value: true); addressInfo = await cache.TryGetAddressesAsync( request: request, From 0f255613f39dbe072b11f6120dac827b797da538 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 12:05:38 -0700 Subject: [PATCH 03/13] Code changes to introduce East US 3 Region in the .NET SDK. --- Microsoft.Azure.Cosmos/src/Regions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Microsoft.Azure.Cosmos/src/Regions.cs b/Microsoft.Azure.Cosmos/src/Regions.cs index b510b10c3e..2be568ec55 100644 --- a/Microsoft.Azure.Cosmos/src/Regions.cs +++ b/Microsoft.Azure.Cosmos/src/Regions.cs @@ -35,6 +35,11 @@ public static class Regions /// public const string EastUS2 = "East US 2"; + /// + /// Name of the Azure East US 3 region in the Azure Cosmos DB service. + /// + public const string EastUS3 = "East US 3"; + /// /// Name of the Azure Central US region in the Azure Cosmos DB service. /// From 9c5e92e67cd4a70c16b199280e7667855f753548 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 15:37:17 -0700 Subject: [PATCH 04/13] Code changes to update contract --- ...alBaselineTests.TestOrderByTranslation.xml | 13 ------------ ...lineTests.TestFullTextContainsFunction.xml | 20 +++++++++++++++++++ .../QueryPlanBaselineTests.Distinct.xml | 2 +- .../QueryPlanBaselineTests.OffsetLimit.xml | 4 ++-- .../QueryPlanBaselineTests.Top.xml | 2 +- .../Contracts/DotNetSDKAPI.json | 5 +++++ 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml index ae6a5a4d77..8b8e7e9e54 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml @@ -121,19 +121,6 @@ FROM root ORDER BY root["FamilyId"] ASC]]> - - - Skip]]> - f.FamilyId).Skip(1)]]> - - - - - order by]]> diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml index 8171c1a2fe..ddf5a7e581 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml @@ -9,6 +9,7 @@ SELECT VALUE root FROM root WHERE FullTextContains(root["StringField"], "test")]]> + @@ -21,6 +22,7 @@ WHERE FullTextContains(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE (FullTextContains(root["StringField"], "test1") OR FullTextContains(root["StringField"], "test2"))]]> + @@ -33,6 +35,7 @@ WHERE (FullTextContains(root["StringField"], "test1") OR FullTextContains(root[" SELECT VALUE root FROM root WHERE (FullTextContains(root["StringField"], "test1") AND FullTextContains(root["StringField"], "test2"))]]> + @@ -44,6 +47,7 @@ WHERE (FullTextContains(root["StringField"], "test1") AND FullTextContains(root[ + @@ -69,6 +73,7 @@ ORDER BY FullTextContains(root["StringField"], "test") ASC]]> SELECT VALUE FullTextContains(root["StringField"], "test") FROM root GROUP BY FullTextContains(root["StringField"], "test") ]]> + @@ -82,6 +87,7 @@ SELECT VALUE number0 FROM root JOIN number0 IN root["EnumerableField"] WHERE FullTextContains(root["StringField"], "test")]]> + @@ -94,6 +100,7 @@ WHERE FullTextContains(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAll(root["StringField"], "test")]]> + @@ -106,6 +113,7 @@ WHERE FullTextContainsAll(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAll(root["StringField"], "test1", "test2", "test3")]]> + @@ -118,6 +126,7 @@ WHERE FullTextContainsAll(root["StringField"], "test1", "test2", "test3")]]> + @@ -130,6 +139,7 @@ WHERE (FullTextContainsAll(root["StringField"], "test") OR FullTextContainsAll(r SELECT VALUE root FROM root WHERE (FullTextContainsAll(root["StringField"], "test") AND FullTextContainsAll(root["StringField"], "test1", "test2", "test3"))]]> + @@ -141,6 +151,7 @@ WHERE (FullTextContainsAll(root["StringField"], "test") AND FullTextContainsAll( + @@ -166,6 +177,7 @@ ORDER BY FullTextContainsAll(root["StringField"], "test") ASC]]> SELECT VALUE FullTextContainsAll(root["StringField"], "test") FROM root GROUP BY FullTextContainsAll(root["StringField"], "test") ]]> + @@ -179,6 +191,7 @@ SELECT VALUE number0 FROM root JOIN number0 IN root["EnumerableField"] WHERE FullTextContainsAll(root["StringField"], "test")]]> + @@ -191,6 +204,7 @@ WHERE FullTextContainsAll(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAny(root["StringField"], "test")]]> + @@ -203,6 +217,7 @@ WHERE FullTextContainsAny(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAny(root["StringField"], "test1", "test2", "test3")]]> + @@ -215,6 +230,7 @@ WHERE FullTextContainsAny(root["StringField"], "test1", "test2", "test3")]]> + @@ -227,6 +243,7 @@ WHERE (FullTextContainsAny(root["StringField"], "test") OR FullTextContainsAny(r SELECT VALUE root FROM root WHERE (FullTextContainsAny(root["StringField"], "test") AND FullTextContainsAny(root["StringField"], "test1", "test2", "test3"))]]> + @@ -238,6 +255,7 @@ WHERE (FullTextContainsAny(root["StringField"], "test") AND FullTextContainsAny( + @@ -263,6 +281,7 @@ ORDER BY FullTextContainsAny(root["StringField"], "test") ASC]]> SELECT VALUE FullTextContainsAny(root["StringField"], "test") FROM root GROUP BY FullTextContainsAny(root["StringField"], "test") ]]> + @@ -276,6 +295,7 @@ SELECT VALUE number0 FROM root JOIN number0 IN root["EnumerableField"] WHERE FullTextContainsAny(root["StringField"], "test")]]> + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml index de339d029c..893b368e5d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml @@ -125,7 +125,7 @@ [[],"Infinity") - diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml index bdcc60b180..7521a89657 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml @@ -574,7 +574,7 @@ OFFSET 0 LIMIT 18]]> Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Skip') @@ -836,7 +836,7 @@ OFFSET 0 LIMIT 18]]> Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml index 2597905fa8..22cab01da0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml @@ -576,7 +576,7 @@ ORDER BY _FullTextScore(c.text, ["swim"], {documentdb-formattablehybridsearchque Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index 2bccdd548f..54e00c2a53 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -7987,6 +7987,11 @@ "Attributes": [], "MethodInfo": "System.String EastUS2EUAP;IsInitOnly:False;IsStatic:True;" }, + "System.String EastUS3": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String EastUS3;IsInitOnly:False;IsStatic:True;" + }, "System.String EastUSSLV": { "Type": "Field", "Attributes": [], From 35b425f1ca5fcdb35c1d5ea4534c7362ae28d400 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 16:41:32 -0700 Subject: [PATCH 05/13] Code changes to fix baseline tests. --- ...lineTests.TestFullTextContainsFunction.xml | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml index ddf5a7e581..8171c1a2fe 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestFullTextContainsFunction.xml @@ -9,7 +9,6 @@ SELECT VALUE root FROM root WHERE FullTextContains(root["StringField"], "test")]]> - @@ -22,7 +21,6 @@ WHERE FullTextContains(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE (FullTextContains(root["StringField"], "test1") OR FullTextContains(root["StringField"], "test2"))]]> - @@ -35,7 +33,6 @@ WHERE (FullTextContains(root["StringField"], "test1") OR FullTextContains(root[" SELECT VALUE root FROM root WHERE (FullTextContains(root["StringField"], "test1") AND FullTextContains(root["StringField"], "test2"))]]> - @@ -47,7 +44,6 @@ WHERE (FullTextContains(root["StringField"], "test1") AND FullTextContains(root[ - @@ -73,7 +69,6 @@ ORDER BY FullTextContains(root["StringField"], "test") ASC]]> SELECT VALUE FullTextContains(root["StringField"], "test") FROM root GROUP BY FullTextContains(root["StringField"], "test") ]]> - @@ -87,7 +82,6 @@ SELECT VALUE number0 FROM root JOIN number0 IN root["EnumerableField"] WHERE FullTextContains(root["StringField"], "test")]]> - @@ -100,7 +94,6 @@ WHERE FullTextContains(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAll(root["StringField"], "test")]]> - @@ -113,7 +106,6 @@ WHERE FullTextContainsAll(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAll(root["StringField"], "test1", "test2", "test3")]]> - @@ -126,7 +118,6 @@ WHERE FullTextContainsAll(root["StringField"], "test1", "test2", "test3")]]> - @@ -139,7 +130,6 @@ WHERE (FullTextContainsAll(root["StringField"], "test") OR FullTextContainsAll(r SELECT VALUE root FROM root WHERE (FullTextContainsAll(root["StringField"], "test") AND FullTextContainsAll(root["StringField"], "test1", "test2", "test3"))]]> - @@ -151,7 +141,6 @@ WHERE (FullTextContainsAll(root["StringField"], "test") AND FullTextContainsAll( - @@ -177,7 +166,6 @@ ORDER BY FullTextContainsAll(root["StringField"], "test") ASC]]> SELECT VALUE FullTextContainsAll(root["StringField"], "test") FROM root GROUP BY FullTextContainsAll(root["StringField"], "test") ]]> - @@ -191,7 +179,6 @@ SELECT VALUE number0 FROM root JOIN number0 IN root["EnumerableField"] WHERE FullTextContainsAll(root["StringField"], "test")]]> - @@ -204,7 +191,6 @@ WHERE FullTextContainsAll(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAny(root["StringField"], "test")]]> - @@ -217,7 +203,6 @@ WHERE FullTextContainsAny(root["StringField"], "test")]]> SELECT VALUE root FROM root WHERE FullTextContainsAny(root["StringField"], "test1", "test2", "test3")]]> - @@ -230,7 +215,6 @@ WHERE FullTextContainsAny(root["StringField"], "test1", "test2", "test3")]]> - @@ -243,7 +227,6 @@ WHERE (FullTextContainsAny(root["StringField"], "test") OR FullTextContainsAny(r SELECT VALUE root FROM root WHERE (FullTextContainsAny(root["StringField"], "test") AND FullTextContainsAny(root["StringField"], "test1", "test2", "test3"))]]> - @@ -255,7 +238,6 @@ WHERE (FullTextContainsAny(root["StringField"], "test") AND FullTextContainsAny( - @@ -281,7 +263,6 @@ ORDER BY FullTextContainsAny(root["StringField"], "test") ASC]]> SELECT VALUE FullTextContainsAny(root["StringField"], "test") FROM root GROUP BY FullTextContainsAny(root["StringField"], "test") ]]> - @@ -295,7 +276,6 @@ SELECT VALUE number0 FROM root JOIN number0 IN root["EnumerableField"] WHERE FullTextContainsAny(root["StringField"], "test")]]> - \ No newline at end of file From 6da006f49a91376160df9982c16bedd541b4f125 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 16:42:25 -0700 Subject: [PATCH 06/13] Code changes to fix emulator test --- .../TestBaseline/QueryPlanBaselineTests.Distinct.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml index 893b368e5d..de339d029c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml @@ -125,7 +125,7 @@ [[],"Infinity") - From ba9a4d8c1cdb8fcd6a195e8c9cc3e70572918a71 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 17:49:27 -0700 Subject: [PATCH 07/13] Revert "Code changes to fix emulator test" This reverts commit 6da006f49a91376160df9982c16bedd541b4f125. --- .../TestBaseline/QueryPlanBaselineTests.Distinct.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml index de339d029c..893b368e5d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Distinct.xml @@ -125,7 +125,7 @@ [[],"Infinity") - From e3f7274445a6d972988dae27bda0ea6ca3091b7f Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Tue, 10 Jun 2025 17:51:44 -0700 Subject: [PATCH 08/13] Code changes to fix order by. --- ...qGeneralBaselineTests.TestOrderByTranslation.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml index 8b8e7e9e54..ae6a5a4d77 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestOrderByTranslation.xml @@ -121,6 +121,19 @@ FROM root ORDER BY root["FamilyId"] ASC]]> + + + Skip]]> + f.FamilyId).Skip(1)]]> + + + + + order by]]> From 1d7e7105bb3c4f3a4539fd62ed16e215be2a88d7 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Wed, 11 Jun 2025 13:13:22 -0700 Subject: [PATCH 09/13] Code changes to update vector distance function baseline. --- .../LinqTranslationBaselineTests.TestVectorDistanceFunction.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml index 48b99e5336..52b349202c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestVectorDistanceFunction.xml @@ -599,7 +599,7 @@ FROM root]]> - + \ No newline at end of file From d5fcd3e75869b5acf426f150f0488202c40039ee Mon Sep 17 00:00:00 2001 From: "REDMOND\\adityasa" Date: Wed, 11 Jun 2025 16:04:16 -0700 Subject: [PATCH 10/13] Suite0 fix --- .../Query/QueryPlanRetrieverTests.cs | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs index e3e78edf9c..6c4c376276 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/QueryPlanRetrieverTests.cs @@ -307,13 +307,13 @@ public async Task SanityTests() expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[""c.zipcode""],""groupByAliases"":[""zipcode"",""valid_count""],""aggregates"":[],""groupByAliasToAggregateType"":{""zipcode"":null,""valid_count"":""CountIf""},""rewrittenQuery"":""SELECT [{\""item\"": c.zipcode}] AS groupByItems, {\""zipcode\"": c.zipcode, \""valid_count\"": {\""item\"": COUNTIF(c.valid)}} AS payload\nFROM c\nGROUP BY c.zipcode"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), MakeTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK FullTextScore(c.text, ['swim', 'run'])", - expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":null,""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), MakeTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(FullTextScore(c.text, ['swim', 'run']), VectorDistance(c.image, [1, 2, 3]))", - expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":null,""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), MakeTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]))", - expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.backup_image, [0.5, 0.2, 0.33])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.backup_image, [0.5, 0.2, 0.33])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":null,""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.backup_image, [0.5, 0.2, 0.33])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.backup_image, [0.5, 0.2, 0.33])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), MakeTest( query: "SELECT * FROM c WHERE FullTextContains(c.abstract, 'calculation')", expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":"""",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), @@ -322,21 +322,13 @@ public async Task SanityTests() expected: @"{""distinctType"":""None"",""top"":null,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[""$1"",""$2""],""aggregates"":[],""groupByAliasToAggregateType"":{""$1"":""CountIf"",""$2"":""CountIf""},""rewrittenQuery"":""SELECT {\""$1\"": {\""item\"": COUNTIF((_FullTextWordCount(c.abstract) > 10))}, \""$2\"": {\""item\"": COUNTIF(FullTextContains(c.abstract, \""inspiration\""))}} AS payload\nFROM c"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}"), MakeHybridSearchOptimizationTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK FullTextScore(c.text, 'swim', 'run')", - expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":null,""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": []} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), MakeHybridSearchOptimizationTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(FullTextScore(c.text, 'swim', 'run'), VectorDistance(c.image, [1, 2, 3]))", - expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":null,""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), - }; - - // Test cases to be added after direct package upgrade - TestCase[] _ = new TestCase[] - { + expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [{\""totalWordCount\"": SUM(_FullTextWordCount(c.text)), \""hitCounts\"": [COUNTIF(FullTextContains(c.text, \""swim\"")), COUNTIF(FullTextContains(c.text, \""run\""))]}] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)] AS componentScores\nFROM c\nORDER BY _FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_FullTextScore(c.text, [\""swim\"", \""run\""], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1), (_VectorScore(c.image, [1, 2, 3]) ?? -1.79769e+308)] AS componentScores\nFROM c\nORDER BY _VectorScore(c.image, [1, 2, 3])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[],""skip"":null,""take"":10,""requiresGlobalStatistics"":true}"), MakeTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]), [1, -0.3])", expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Descending""],""orderByExpressions"":[""_VectorScore(c.backup_image, [0.5, 0.2, 0.33])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.backup_image, [0.5, 0.2, 0.33])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[""Ascending""],""orderByExpressions"":[""_VectorScore(c.image, [1, 2, 3])""],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, [{\""item\"": _VectorScore(c.image, [1, 2, 3])}] AS orderByItems, {\""payload\"": c, \""componentScores\"": [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _VectorScore(c.image, [1, 2, 3]) ASC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":true}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[1.0,0.3],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), - MakeTest( - query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]), [1, -0.3])", - expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (-1 * (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308))] AS componentScores\nFROM c\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (-1 * (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308))] AS componentScores\nFROM c\nORDER BY _VectorScore(c.image, [1, 2, 3]) ASC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[1.0,0.3],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), MakeHybridSearchOptimizationTest( query: "SELECT TOP 10 * FROM c ORDER BY RANK RRF(VectorDistance(c.backup_image, [0.5, 0.2, 0.33]), VectorDistance(c.image, [1, 2, 3]), [1, -0.3])", expected: @"{""globalStatisticsQuery"":""SELECT COUNT(1) AS documentCount, [] AS fullTextStatistics\nFROM c"",""componentQueryInfos"":[{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (-1 * (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308))] AS componentScores\nFROM c\nORDER BY _VectorScore(c.backup_image, [0.5, 0.2, 0.33])"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false},{""distinctType"":""None"",""top"":120,""offset"":null,""limit"":null,""orderBy"":[],""orderByExpressions"":[],""groupByExpressions"":[],""groupByAliases"":[],""aggregates"":[],""groupByAliasToAggregateType"":{},""rewrittenQuery"":""SELECT TOP 120 c._rid, c AS payload, [(_VectorScore(c.backup_image, [0.5, 0.2, 0.33]) ?? -1.79769e+308), (-1 * (_VectorScore(c.image, [1, 2, 3]) ?? 1.79769e+308))] AS componentScores\nFROM c\nORDER BY _VectorScore(c.image, [1, 2, 3]) ASC"",""hasSelectValue"":false,""dCountInfo"":null,""hasNonStreamingOrderBy"":false}],""componentWithoutPayloadQueryInfos"":[],""projectionQueryInfo"":null,""componentWeights"":[1.0,0.3],""skip"":null,""take"":10,""requiresGlobalStatistics"":false}"), @@ -368,7 +360,7 @@ private static async Task RunTestAsync(CosmosQueryClient queryClient, TestCase t testCase.HasLogicalPartitionKey, Cosmos.GeospatialType.Geography, useSystemPrefix: false, - isHybridSearchQueryPlanOptimizationDisabled: false, + isHybridSearchQueryPlanOptimizationDisabled: testCase.HybridSearchQueryPlanOptimizationDisabled, NoOpTrace.Singleton); JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings @@ -449,7 +441,7 @@ public TestCase( private static class DebugTraceHelper { - private const bool Enabled = false; + private const bool Enabled = true; #pragma warning disable CS0162 // Unreachable code detected public static void Trace(TestCase testCase) From fe72e8feb09d546a14f9913c10f625e3c809414c Mon Sep 17 00:00:00 2001 From: "Arooshi Avasthy (from Dev Box)" Date: Thu, 12 Jun 2025 16:50:06 -0700 Subject: [PATCH 11/13] Fix substatus mapping issue. --- .../OpenTelemetryAttributeKeys.cs | 27 ++-- .../Tracing/TraceWriter.TraceJsonWriter.cs | 115 +--------------- .../src/Util/SubStatusMappingUtil.cs | 123 ++++++++++++++++++ 3 files changed, 141 insertions(+), 124 deletions(-) create mode 100644 Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs index e0db3e9c1f..200a5a698d 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs @@ -9,7 +9,8 @@ namespace Microsoft.Azure.Cosmos.Telemetry using System.Linq; using System.Net; using global::Azure.Core; - using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Util; using Microsoft.Azure.Documents; /// @@ -484,17 +485,19 @@ private static string GetRegion(ClientSideRequestStatisticsTraceDatum.StoreRespo /// Status code /// Sub status code /// error.type dimension value - private static string GetErrorType(Exception exception, int? statusCode, int? subStatusCode) - { - if (exception == null) - { - return null; - } - - HttpStatusCode? code = statusCode.HasValue ? (HttpStatusCode)statusCode.Value : null; - SubStatusCodes? subCode = subStatusCode.HasValue ? (SubStatusCodes)subStatusCode.Value : null; - - return $"{exception.GetType().Name}_{code?.ToString()}_{subCode?.ToString()}"; + private static string GetErrorType(Exception exception, int? statusCode, int? subStatusCode) + { + if (exception == null) + { + return null; + } + + string codeString = statusCode.HasValue ? ((StatusCodes)statusCode.Value).ToString() : string.Empty; + string mappedSubStatusCode = (statusCode.HasValue && subStatusCode.HasValue) + ? SubStatusMappingUtil.GetSubStatusCodeString((StatusCodes)statusCode.Value, (SubStatusCodes)subStatusCode.Value) + : string.Empty; + + return $"{exception.GetType().Name}_{codeString}_{mappedSubStatusCode}"; } private static int GetSubStatusCode(ClientSideRequestStatisticsTraceDatum.StoreResponseStatistics tcpStats, ClientSideRequestStatisticsTraceDatum.HttpResponseStatistics? httpStats) diff --git a/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs b/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs index 9a3da7971b..f3880a517c 100644 --- a/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Tracing/TraceWriter.TraceJsonWriter.cs @@ -11,7 +11,8 @@ namespace Microsoft.Azure.Cosmos.Tracing using System.Net.Http; using System.Text; using Microsoft.Azure.Cosmos.Json; - using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Cosmos.Util; using Microsoft.Azure.Documents; internal static partial class TraceWriter @@ -394,7 +395,7 @@ public void Visit(StoreResult storeResult) this.jsonWriter.WriteStringValue(storeResult.StatusCode.ToString()); this.jsonWriter.WriteFieldName(nameof(storeResult.SubStatusCode)); - this.jsonWriter.WriteStringValue(this.GetSubStatusCodeString(storeResult.StatusCode, storeResult.SubStatusCode)); + this.jsonWriter.WriteStringValue(SubStatusMappingUtil.GetSubStatusCodeString(storeResult.StatusCode, storeResult.SubStatusCode)); this.jsonWriter.WriteFieldName(nameof(storeResult.LSN)); this.jsonWriter.WriteNumberValue(storeResult.LSN); @@ -452,116 +453,6 @@ public void Visit(StoreResult storeResult) this.jsonWriter.WriteObjectEnd(); } - internal string GetSubStatusCodeString(StatusCodes statusCode, SubStatusCodes subStatusCode) - { - if ((int)subStatusCode == 1002) - { - return statusCode == StatusCodes.NotFound - ? "ReadSessionNotAvailable" - : SubStatusCodes.PartitionKeyRangeGone.ToString(); - } - - if ((int)subStatusCode == 2001) - { - return statusCode == StatusCodes.NoContent - ? "MissedTargetLsn" - : SubStatusCodes.SplitIsDisabled.ToString(); - } - - if ((int)subStatusCode == 2002) - { - return statusCode == StatusCodes.NoContent - ? "MissedTargetLsnOver100" - : SubStatusCodes.CollectionsInPartitionGotUpdated.ToString(); - } - - if ((int)subStatusCode == 2003) - { - return statusCode == StatusCodes.NoContent - ? "MissedTargetLsnOver1000" - : SubStatusCodes.CanNotAcquirePKRangesLock.ToString(); - } - - if ((int)subStatusCode == 2004) - { - return statusCode == StatusCodes.NoContent - ? "MissedTargetLsnOver10000" - : SubStatusCodes.ResourceNotFound.ToString(); - } - - if ((int)subStatusCode == 2011) - { - return statusCode == StatusCodes.NoContent - ? "MissedTargetGlobalCommittedLsn" - : SubStatusCodes.StorageSplitConflictingWithNWayThroughputSplit.ToString(); - } - - if ((int)subStatusCode == 2012) - { - return statusCode == StatusCodes.NoContent - ? "MissedTargetGlobalCommittedLsnOver100" - : SubStatusCodes.MergeIsDisabled.ToString(); - } - - if ((int)subStatusCode == 1004) - { - return statusCode == StatusCodes.BadRequest - ? "CrossPartitionQueryNotServable" - : SubStatusCodes.ConfigurationNameNotFound.ToString(); - } - - if ((int)subStatusCode == 1007) - { - return statusCode == StatusCodes.Gone - ? "CompletingSplit" - : SubStatusCodes.InsufficientBindablePartitions.ToString(); - } - - if ((int)subStatusCode == 1008) - { - return statusCode == StatusCodes.Gone - ? "CompletingPartitionMigration" - : SubStatusCodes.DatabaseAccountNotFound.ToString(); - } - - if ((int)subStatusCode == 1005) - { - return statusCode == StatusCodes.NotFound - ? "ConfigurationPropertyNotFound" - : SubStatusCodes.ProvisionLimitReached.ToString(); - } - - if ((int)subStatusCode == 3207) - { - return statusCode == StatusCodes.Conflict - ? "ConfigurationNameAlreadyExists" - : SubStatusCodes.PrepareTimeLimitExceeded.ToString(); - } - - if ((int)subStatusCode == 6001) - { - return statusCode == StatusCodes.ServiceUnavailable - ? "AggregatedHealthStateError" - : SubStatusCodes.PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringCompleteMigrationFromBackend.ToString(); - } - - if ((int)subStatusCode == 6002) - { - return statusCode == StatusCodes.ServiceUnavailable - ? "ApplicationHealthStateError" - : SubStatusCodes.PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringAbortMigrationFromBackend.ToString(); - } - - if ((int)subStatusCode == 6003) - { - return statusCode == StatusCodes.ServiceUnavailable - ? "HealthStateError" - : SubStatusCodes.PartitionMigrationFinalizeMigrationsDidNotCompleteInTenRetries.ToString(); - } - - return subStatusCode.ToString(); - } - public void Visit(PartitionKeyRangeCacheTraceDatum partitionKeyRangeCacheTraceDatum) { this.jsonWriter.WriteObjectStart(); diff --git a/Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs b/Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs new file mode 100644 index 0000000000..46fe1790d3 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Util/SubStatusMappingUtil.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.Util +{ + using Microsoft.Azure.Documents; + + /// + /// Utility for correctly mapping duplicate SubStatus codes. + /// + internal class SubStatusMappingUtil + { + public static string GetSubStatusCodeString(StatusCodes statusCode, SubStatusCodes subStatusCode) + { + if ((int)subStatusCode == 1002) + { + return statusCode == StatusCodes.NotFound + ? nameof(SubStatusCodes.ReadSessionNotAvailable) + : nameof(SubStatusCodes.PartitionKeyRangeGone); + } + + if ((int)subStatusCode == 2001) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsn) + : nameof(SubStatusCodes.SplitIsDisabled); + } + + if ((int)subStatusCode == 2002) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsnOver100) + : nameof(SubStatusCodes.CollectionsInPartitionGotUpdated); + } + + if ((int)subStatusCode == 2003) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsnOver1000) + : nameof(SubStatusCodes.CanNotAcquirePKRangesLock); + } + + if ((int)subStatusCode == 2004) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetLsnOver10000) + : nameof(SubStatusCodes.ResourceNotFound); + } + + if ((int)subStatusCode == 2011) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetGlobalCommittedLsn) + : nameof(SubStatusCodes.StorageSplitConflictingWithNWayThroughputSplit); + } + + if ((int)subStatusCode == 2012) + { + return statusCode == StatusCodes.NoContent + ? nameof(SubStatusCodes.MissedTargetGlobalCommittedLsnOver100) + : nameof(SubStatusCodes.MergeIsDisabled); + } + + if ((int)subStatusCode == 1004) + { + return statusCode == StatusCodes.BadRequest + ? nameof(SubStatusCodes.CrossPartitionQueryNotServable) + : nameof(SubStatusCodes.ConfigurationNameNotFound); + } + + if ((int)subStatusCode == 1007) + { + return statusCode == StatusCodes.Gone + ? nameof(SubStatusCodes.CompletingSplit) + : nameof(SubStatusCodes.InsufficientBindablePartitions); + } + + if ((int)subStatusCode == 1008) + { + return statusCode == StatusCodes.Gone + ? nameof(SubStatusCodes.CompletingPartitionMigration) + : nameof(SubStatusCodes.DatabaseAccountNotFound); + } + + if ((int)subStatusCode == 1005) + { + return statusCode == StatusCodes.NotFound + ? nameof(SubStatusCodes.ConfigurationPropertyNotFound) + : nameof(SubStatusCodes.ProvisionLimitReached); + } + + if ((int)subStatusCode == 3207) + { + return statusCode == StatusCodes.Conflict + ? nameof(SubStatusCodes.ConfigurationNameAlreadyExists) + : nameof(SubStatusCodes.PrepareTimeLimitExceeded); + } + + if ((int)subStatusCode == 6001) + { + return statusCode == StatusCodes.ServiceUnavailable + ? nameof(SubStatusCodes.AggregatedHealthStateError) + : nameof(SubStatusCodes.PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringCompleteMigrationFromBackend); + } + + if ((int)subStatusCode == 6002) + { + return statusCode == StatusCodes.ServiceUnavailable + ? nameof(SubStatusCodes.ApplicationHealthStateError) + : nameof(SubStatusCodes.PartitionMigrationWaitForFullSyncReceivedInternalServerErrorDuringAbortMigrationFromBackend); + } + + if ((int)subStatusCode == 6003) + { + return statusCode == StatusCodes.ServiceUnavailable + ? nameof(SubStatusCodes.HealthStateError) + : nameof(SubStatusCodes.PartitionMigrationFinalizeMigrationsDidNotCompleteInTenRetries); + } + + return subStatusCode.ToString(); + } + } +} From f8210b2a9758e4705a9c53e9f421c5b0c4abc68d Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Thu, 12 Jun 2025 21:24:49 -0700 Subject: [PATCH 12/13] Code changes to revert some of the query baselines. --- .../TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml | 4 ++-- .../BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml index 7521a89657..bdcc60b180 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml @@ -574,7 +574,7 @@ OFFSET 0 LIMIT 18]]> Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Skip') @@ -836,7 +836,7 @@ OFFSET 0 LIMIT 18]]> Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml index 22cab01da0..2597905fa8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml @@ -576,7 +576,7 @@ ORDER BY _FullTextScore(c.text, ["swim"], {documentdb-formattablehybridsearchque Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') From 240ee4d9c167fe1398a9704ecbc4e16a3fc1c537 Mon Sep 17 00:00:00 2001 From: Debdatta Kunda Date: Fri, 13 Jun 2025 00:03:49 -0700 Subject: [PATCH 13/13] Revert "Code changes to revert some of the query baselines." This reverts commit f8210b2a9758e4705a9c53e9f421c5b0c4abc68d. --- .../TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml | 4 ++-- .../BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml index bdcc60b180..7521a89657 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.OffsetLimit.xml @@ -574,7 +574,7 @@ OFFSET 0 LIMIT 18]]> Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":2147483648,"take":10,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Skip') @@ -836,7 +836,7 @@ OFFSET 0 LIMIT 18]]> Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","offset":0,"limit":20,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC\nOFFSET 0 LIMIT 20","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"skip":10,"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take') diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml index 2597905fa8..22cab01da0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.Top.xml @@ -576,7 +576,7 @@ ORDER BY _FullTextScore(c.text, ["swim"], {documentdb-formattablehybridsearchque Microsoft.Azure.Cosmos.Query.Core.Monads.ExceptionWithStackTraceException : TryCatch resulted in an exception. -Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"take":2147483648,"requiresGlobalStatistics":true}} +Microsoft.Azure.Cosmos.Query.Core.Exceptions.ExpectedQueryPartitionProviderException : {"queryRanges":[{"min":[],"max":"Infinity","isMinInclusive":true,"isMaxInclusive":false}],"hybridSearchQueryInfo":{"globalStatisticsQuery":"SELECT COUNT(1) AS documentCount, [{\"totalWordCount\": SUM(_FullTextWordCount(c.text)), \"hitCounts\": [COUNTIF(FullTextContains(c.text, \"swim\"))]}] AS fullTextStatistics\nFROM c","componentQueryInfos":[{"distinctType":"None","top":0,"groupByExpressions":[],"groupByAliases":[],"orderBy":["Descending"],"orderByExpressions":["_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})"],"aggregates":[],"hasSelectValue":0,"rewrittenQuery":"SELECT TOP 4294967296 c._rid, [{\"item\": _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0})}] AS orderByItems, {\"payload\": {\"name\": c.name}, \"componentScores\": [(_FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) ?? -1)]} AS payload\nFROM c\nWHERE ({documentdb-formattableorderbyquery-filter})\nORDER BY _FullTextScore(c.text, [\"swim\"], {documentdb-formattablehybridsearchquery-totaldocumentcount}, {documentdb-formattablehybridsearchquery-totalwordcount-0}, {documentdb-formattablehybridsearchquery-hitcountsarray-0}) DESC","groupByAliasToAggregateType":{},"hasNonStreamingOrderBy":1}],"componentWithoutPayloadQueryInfos":[],"componentWeights":[],"take":2147483648,"requiresGlobalStatistics":true}} System.ArgumentOutOfRangeException : Specified argument was out of the range of valid values. (Parameter 'HybridSearchQueryInfo.Take')