Skip to content

Commit

Permalink
Merge branch 'release/8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Jun 11, 2024
2 parents 31a8239 + 67fd137 commit b2e6a11
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ protected override ShapedQueryExpression TransformJsonQueryToTable(JsonQueryExpr
Offset: null,
Orderings: [],
Projection: [{ Expression: ColumnExpression { Name: "value", TableAlias: var projectionTableAlias } }]
}
} subquery
}
&& projectionTableAlias == openJsonExpression.Alias)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ protected override QueryableMethodTranslatingExpressionVisitor CreateSubqueryVis
IsDistinct: false,
Limit: null,
Offset: null
})
} subquery
&& (UseOldBehavior33932 || subquery.Predicate is null))
{
var translation =
_sqlExpressionFactory.GreaterThan(
Expand Down Expand Up @@ -203,7 +204,8 @@ protected override QueryableMethodTranslatingExpressionVisitor CreateSubqueryVis
IsDistinct: false,
Limit: null,
Offset: null
})
} subquery
&& (UseOldBehavior33932 || subquery.Predicate is null))
{
var translation = _sqlExpressionFactory.Function(
"json_array_length",
Expand Down Expand Up @@ -476,7 +478,8 @@ protected override ShapedQueryExpression TransformJsonQueryToTable(JsonQueryExpr
Offset: null
} selectExpression
&& orderingColumn.TableAlias == jsonEachExpression.Alias
&& TranslateExpression(index) is { } translatedIndex)
&& TranslateExpression(index) is { } translatedIndex
&& (UseOldBehavior33932 || selectExpression.Predicate is null))
{
// Index on JSON array

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,36 @@ FROM OPENJSON([p].[Ints]) WITH ([value] int '$') AS [i]
""");
}

public override async Task Column_collection_Count_with_predicate(bool async)
{
await base.Column_collection_Count_with_predicate(async);

AssertSql(
"""
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
FROM [PrimitiveCollectionsEntity] AS [p]
WHERE (
SELECT COUNT(*)
FROM OPENJSON([p].[Ints]) WITH ([value] int '$') AS [i]
WHERE [i].[value] > 1) = 2
""");
}

public override async Task Column_collection_Where_Count(bool async)
{
await base.Column_collection_Where_Count(async);

AssertSql(
"""
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
FROM [PrimitiveCollectionsEntity] AS [p]
WHERE (
SELECT COUNT(*)
FROM OPENJSON([p].[Ints]) WITH ([value] int '$') AS [i]
WHERE [i].[value] > 1) = 2
""");
}

public override async Task Column_collection_index_int(bool async)
{
await base.Column_collection_index_int(async);
Expand Down

0 comments on commit b2e6a11

Please sign in to comment.