Skip to content

Cosmos: Modernize materializer & subdocument projectionbinding#38550

Open
JoasE wants to merge 283 commits into
dotnet:mainfrom
JoasE:feature/#34567-Materialization
Open

Cosmos: Modernize materializer & subdocument projectionbinding#38550
JoasE wants to merge 283 commits into
dotnet:mainfrom
JoasE:feature/#34567-Materialization

Conversation

@JoasE

@JoasE JoasE commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Part of: #34567
Implements: #34067
Fixes: #38138 , #31696

Copilot AI review requested due to automatic review settings July 8, 2026 10:05
@JoasE

JoasE commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Tests are failing for linux emulator because the projection order is not preserved there, and the materializer currently depends on this order. This is specifically usefull in NoTrackingWithIdentityResolution cases, where we materialize the id of the root document first before materializing sub documents. Production cosmos does preserve the projection order, but I'm wondering whether this is something we should depend and whether it's a guarantee in cosmos or might be subject to change. Regardless, I've created: Azure/azure-cosmos-db-emulator-docker#335
@AndriySvyryd Thoughts on this?
PS: PR still WIP, needs some cleanup but is close to final form

This appears to have been be planned by the linux emulator team

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs Outdated
Comment thread src/EFCore.Cosmos/Properties/CosmosStrings.resx
Comment thread src/EFCore.Cosmos/Storage/Internal/CosmosNumberProjectionTypeMapping.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 11:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread test/EFCore.Tests/Storage/Json/JsonReaderDataTest.cs
Copilot AI review requested due to automatic review settings July 8, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread test/EFCore.Cosmos.FunctionalTests/Query/AdHocJsonQueryCosmosTest.cs Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread src/EFCore.Cosmos/Extensions/Internal/CosmosResponseStreamHelper.cs
Comment thread src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs Outdated
@JoasE JoasE requested a review from AndriySvyryd July 8, 2026 13:25
@AndriySvyryd

Copy link
Copy Markdown
Member

@AndriySvyryd Thoughts on this?

You can skip these for the Linux emulator for now. But if they say that this is by design we'll have to rethink our approach.

Copilot AI review requested due to automatic review settings July 8, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file

Comment thread src/EFCore.Cosmos/Query/Internal/Expressions/CollectionShaperExpression.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 100 out of 104 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Generated file
Comments suppressed due to low confidence (1)

src/EFCore/Storage/Json/JsonReaderData.cs:89

  • In stream mode, the leftover-buffer logic uses buffer.Length rather than _bytesAvailable to determine how much valid data remains after totalConsumed. If a stream read returns fewer bytes than the buffer length (common near EOF and possible with non-buffered streams), this will copy uninitialized/stale bytes and overstate _bytesAvailable, corrupting subsequent JSON parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cosmos: Materializer rounds when deserializing floating point numbers as fixed point numbers

3 participants