Skip to content

Commit

Permalink
Fix inferred mapping application on Sqlite JsonEachExpression (#33209)
Browse files Browse the repository at this point in the history
  • Loading branch information
roji authored Mar 1, 2024
1 parent 3347f5a commit 5d3dfe1
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ protected override Expression VisitExtension(Expression expression)
{
switch (expression)
{
case TableValuedFunctionExpression { Name: "json_each", Schema: null, IsBuiltIn: true } jsonEachExpression
case JsonEachExpression jsonEachExpression
when TryGetInferredTypeMapping(jsonEachExpression.Alias, "value", out var typeMapping):
return ApplyTypeMappingsOnJsonEachExpression(jsonEachExpression, typeMapping);

Expand Down Expand Up @@ -638,8 +638,8 @@ when TryGetInferredTypeMapping(jsonEachExpression.Alias, "value", out var typeMa
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
protected virtual TableValuedFunctionExpression ApplyTypeMappingsOnJsonEachExpression(
TableValuedFunctionExpression jsonEachExpression,
protected virtual JsonEachExpression ApplyTypeMappingsOnJsonEachExpression(
JsonEachExpression jsonEachExpression,
RelationalTypeMapping inferredTypeMapping)
{
// Constant queryables are translated to VALUES, no need for JSON.
Expand All @@ -657,7 +657,9 @@ protected virtual TableValuedFunctionExpression ApplyTypeMappingsOnJsonEachExpre

Check.DebugAssert(parameterTypeMapping.ElementTypeMapping != null, "Collection type mapping missing element mapping.");

return jsonEachExpression.Update(new[] { parameterExpression.ApplyTypeMapping(parameterTypeMapping) });
return jsonEachExpression.Update(
parameterExpression.ApplyTypeMapping(parameterTypeMapping),
jsonEachExpression.Path);
}
}

Expand Down

0 comments on commit 5d3dfe1

Please sign in to comment.