diff --git a/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs b/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs
index f1894064ad1..f238646821c 100644
--- a/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs
+++ b/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs
@@ -205,6 +205,12 @@ public static string NoReadItemQueryString(object? resourceId, object? partition
GetString("NoReadItemQueryString", nameof(resourceId), nameof(partitionKey)),
resourceId, partitionKey);
+ ///
+ /// Azure Cosmos DB does not have an appropriate subquery for this translation.
+ ///
+ public static string NoSubqueryPushdown
+ => GetString("NoSubqueryPushdown");
+
///
/// The expression '{sqlExpression}' in the SQL tree does not have a type mapping assigned.
///
diff --git a/src/EFCore.Cosmos/Properties/CosmosStrings.resx b/src/EFCore.Cosmos/Properties/CosmosStrings.resx
index 5e7d04b82a2..4f55bd92c71 100644
--- a/src/EFCore.Cosmos/Properties/CosmosStrings.resx
+++ b/src/EFCore.Cosmos/Properties/CosmosStrings.resx
@@ -1,17 +1,17 @@
-
@@ -217,6 +217,9 @@
There is no string-based representation of this query as it's executed using 'ReadItemQueryAsync({resourceId}, {partitionKey})'.
+
+ Azure Cosmos DB does not have an appropriate subquery for this translation.
+
The expression '{sqlExpression}' in the SQL tree does not have a type mapping assigned.
diff --git a/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs b/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
index d0ac294d83c..44e308fc959 100644
--- a/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
+++ b/src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
@@ -331,7 +331,10 @@ public virtual void ApplyLimit(SqlExpression sqlExpression)
{
if (Limit != null)
{
- throw new InvalidOperationException("See issue#16156");
+ throw new InvalidOperationException(
+ CoreStrings.TranslationFailedWithDetails(
+ sqlExpression.Print(),
+ CosmosStrings.NoSubqueryPushdown));
}
Limit = sqlExpression;
@@ -348,7 +351,10 @@ public virtual void ApplyOffset(SqlExpression sqlExpression)
if (Limit != null
|| Offset != null)
{
- throw new InvalidOperationException("See issue#16156");
+ throw new InvalidOperationException(
+ CoreStrings.TranslationFailedWithDetails(
+ sqlExpression.Print(),
+ CosmosStrings.NoSubqueryPushdown));
}
Offset = sqlExpression;
@@ -366,7 +372,10 @@ public virtual void ApplyOrdering(OrderingExpression orderingExpression)
|| Limit != null
|| Offset != null)
{
- throw new InvalidOperationException("See issue#16156");
+ throw new InvalidOperationException(
+ CoreStrings.TranslationFailedWithDetails(
+ orderingExpression.Print(),
+ CosmosStrings.NoSubqueryPushdown));
}
_orderings.Clear();
diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs
index c63a9ddd897..d0a06c59c3b 100644
--- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs
+++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindAggregateOperatorsQueryCosmosTest.cs
@@ -1056,22 +1056,22 @@ ORDER BY c["CustomerID"]
public override async Task Distinct_OrderBy(bool async)
// Subquery pushdown. Issue #16156.
- => Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(async () => await base.Distinct_OrderBy(async))).Message);
+ => await AssertTranslationFailedWithDetails(
+ () => base.Distinct_OrderBy(async),
+ CosmosStrings.NoSubqueryPushdown);
public override async Task Distinct_OrderBy2(bool async)
// Subquery pushdown. Issue #16156.
- => Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(async () => await base.Distinct_OrderBy2(async))).Message);
+ => await AssertTranslationFailedWithDetails(
+ () => base.Distinct_OrderBy2(async),
+ CosmosStrings.NoSubqueryPushdown);
public override async Task Distinct_OrderBy3(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(async () => await base.Distinct_OrderBy3(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Distinct_OrderBy(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs
index f46b3cf8fec..e3e9587112b 100644
--- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs
+++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs
@@ -588,9 +588,9 @@ public override async Task Join_Customers_Orders_Orders_Skip_Take_Same_Propertie
public override async Task Take_Skip(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Take_Skip(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Take_Skip(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -598,9 +598,9 @@ public override async Task Take_Skip(bool async)
public override async Task Take_Skip_Distinct(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Take_Skip_Distinct(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Take_Skip_Distinct(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -608,9 +608,9 @@ public override async Task Take_Skip_Distinct(bool async)
public override async Task Take_Skip_Distinct_Caching(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Take_Skip_Distinct_Caching(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Take_Skip_Distinct_Caching(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -772,9 +772,9 @@ public override async Task OrderBy_Take_Count(bool async)
public override async Task Take_OrderBy_Count(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Take_OrderBy_Count(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Take_OrderBy_Count(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1168,9 +1168,9 @@ public override async Task SelectMany_Joined_Take(bool async)
public override async Task Take_with_single(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Take_with_single(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Take_with_single(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1186,9 +1186,9 @@ public override async Task Take_with_single_select_many(bool async)
public override async Task Distinct_Skip(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Distinct_Skip(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Distinct_Skip(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1196,9 +1196,9 @@ public override async Task Distinct_Skip(bool async)
public override async Task Distinct_Skip_Take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Distinct_Skip_Take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Distinct_Skip_Take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1389,9 +1389,9 @@ OFFSET 0 LIMIT @__p_0
public override async Task Distinct_Take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Distinct_Take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Distinct_Take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1723,9 +1723,9 @@ FROM root c
public override async Task Take_skip_null_coalesce_operator(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Take_skip_null_coalesce_operator(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Take_skip_null_coalesce_operator(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1751,9 +1751,9 @@ OFFSET 0 LIMIT @__p_0
public override async Task Select_take_skip_null_coalesce_operator(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Select_take_skip_null_coalesce_operator(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Select_take_skip_null_coalesce_operator(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1761,9 +1761,9 @@ public override async Task Select_take_skip_null_coalesce_operator(bool async)
public override async Task Select_take_skip_null_coalesce_operator2(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Select_take_skip_null_coalesce_operator2(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Select_take_skip_null_coalesce_operator2(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -1771,9 +1771,9 @@ public override async Task Select_take_skip_null_coalesce_operator2(bool async)
public override async Task Select_take_skip_null_coalesce_operator3(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Select_take_skip_null_coalesce_operator3(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Select_take_skip_null_coalesce_operator3(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2391,9 +2391,9 @@ OFFSET @__p_0 LIMIT @__p_1
public override async Task OrderBy_skip_skip_take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.OrderBy_skip_skip_take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.OrderBy_skip_skip_take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2401,9 +2401,9 @@ public override async Task OrderBy_skip_skip_take(bool async)
public override async Task OrderBy_skip_take_take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.OrderBy_skip_take_take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.OrderBy_skip_take_take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2411,9 +2411,9 @@ public override async Task OrderBy_skip_take_take(bool async)
public override async Task OrderBy_skip_take_take_take_take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.OrderBy_skip_take_take_take_take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.OrderBy_skip_take_take_take_take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2421,9 +2421,9 @@ public override async Task OrderBy_skip_take_take_take_take(bool async)
public override async Task OrderBy_skip_take_skip_take_skip(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.OrderBy_skip_take_skip_take_skip(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.OrderBy_skip_take_skip_take_skip(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2487,9 +2487,9 @@ OFFSET @__p_0 LIMIT @__p_1
public override async Task OrderBy_coalesce_skip_take_distinct_take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.OrderBy_coalesce_skip_take_distinct_take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.OrderBy_coalesce_skip_take_distinct_take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2497,9 +2497,9 @@ public override async Task OrderBy_coalesce_skip_take_distinct_take(bool async)
public override async Task OrderBy_skip_take_distinct_orderby_take(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.OrderBy_skip_take_distinct_orderby_take(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.OrderBy_skip_take_distinct_orderby_take(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2589,9 +2589,9 @@ FROM root c
public override async Task Anonymous_member_distinct_orderby(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Anonymous_member_distinct_orderby(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Anonymous_member_distinct_orderby(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2619,9 +2619,9 @@ FROM root c
public override async Task Anonymous_complex_distinct_orderby(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Anonymous_complex_distinct_orderby(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Anonymous_complex_distinct_orderby(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2671,9 +2671,9 @@ FROM root c
public override async Task DTO_member_distinct_orderby(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.DTO_member_distinct_orderby(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.DTO_member_distinct_orderby(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -2701,9 +2701,9 @@ FROM root c
public override async Task DTO_complex_distinct_orderby(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.DTO_complex_distinct_orderby(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.DTO_complex_distinct_orderby(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}
@@ -3803,9 +3803,9 @@ public override async Task Max_on_empty_sequence_throws(bool async)
public override async Task Distinct_followed_by_ordering_on_condition(bool async)
{
// Subquery pushdown. Issue #16156.
- Assert.Equal(
- "See issue#16156",
- (await Assert.ThrowsAsync(() => base.Distinct_followed_by_ordering_on_condition(async))).Message);
+ await AssertTranslationFailedWithDetails(
+ () => base.Distinct_followed_by_ordering_on_condition(async),
+ CosmosStrings.NoSubqueryPushdown);
AssertSql();
}