Repository navigation
Make JSON complex types nullable over a LEFT JOIN - #39524
Closed
jeremy-morren wants to merge 1 commit into
Closed
jeremy-morren wants to merge 1 commit into
jeremy-morren wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the JSON complex-type nullability fix.
No open issues 🎉
What changed in this PR
Fixes #39523 by propagating nullability to JSON complex-type expressions in EF Core’s relational query pipeline, preserving unmatched LEFT JOIN rows when filtering their scalar properties.
Changes:
- Makes
JsonQueryExpressionnullable alongside table-split complex-type projections. - Adds regression tests for direct properties, nested properties, and left-joined
Takesubqueries. - Adds SQL Server and SQLite baselines verifying
IS NULLcompensation.
| File | Description |
|---|---|
| test/EFCore.SqlServer.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousSqlServerTest.cs | Adds SQL baselines for native JSON and string-backed JSON mappings. |
| test/EFCore.Sqlite.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousSqliteTest.cs | Adds SQLite SQL baselines for all three regression scenarios. |
| test/EFCore.Relational.Specification.Tests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousRelationalTestBase.cs | Adds shared tests checking that unmatched LEFT JOIN rows are retained. |
| src/EFCore.Relational/Query/RelationalStructuralTypeShaperExpression.cs | Propagates complex-type nullability into JSON query expressions. |
Review effort: Balanced
RelationalStructuralTypeShaperExpression.MakeNullable now also marks the JsonQueryExpression of a JSON complex type as nullable, so scalars bound from it over the optional side of a LEFT JOIN get IS NULL compensation and unmatched rows are no longer dropped.
jeremy-morren
force-pushed
the
fix-json-complex-left-join-nullability
branch
from
November 13, 2026 18:50
f95c443 to
5f6dda1
Compare
Contributor
Author
|
Closing this PR because the commit is included in #39522 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make JSON complex types nullable over a LEFT JOIN
Fixes #39523
RelationalStructuralTypeShaperExpression.MakeNullablemade a table-split complex type's projection nullable (#33547) but left a JSON complex type'sJsonQueryExpressionas it was. Scalars bound from it stayed non-nullable, so a filter over the optional side of a LEFT JOIN got noIS NULLcompensation and dropped unmatched rows. The fix also makes theJsonQueryExpressionnullable, in the same way owned JSON navigations already are.Tests: three new
ComplexJsonMiscellaneousRelationalTestBasetests (left join, nested complex property, left-joinedTakesubquery), with SQL Server and SQLite baselines. No existing baselines changed.