Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Jan 31, 2026

Fixes #37583

@roji roji requested a review from a team as a code owner January 31, 2026 23:54
Copilot AI review requested due to automatic review settings January 31, 2026 23:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Addresses #37583 by detecting Cosmos set operations over root (uncorrelated) entity queries early, so EF Core fails translation with the expected InvalidOperationException details instead of letting an invalid query reach Cosmos and throwing a CosmosException.

Changes:

  • Added a guard in Cosmos set operation translation (e.g. Concat) to detect root entity queries and surface CosmosStrings.NonCorrelatedSubqueriesNotSupported.
  • Fixed SourceExpression.Update to preserve the WithIn flag when cloning/rewriting sources.
  • Added a Cosmos functional test asserting Concat over two entity query roots fails translation with details.

Reviewed changes

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

File Description
test/EFCore.Cosmos.FunctionalTests/Query/NorthwindMiscellaneousQueryCosmosTest.cs Adds coverage for Concat over entity roots throwing translation failure with the expected Cosmos-specific details.
src/EFCore.Cosmos/Query/Internal/Expressions/SourceExpression.cs Ensures WithIn is preserved when updating a SourceExpression, supporting correct query-shape detection.
src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs Detects and rejects set operations over root queries to avoid generating invalid uncorrelated subqueries for Cosmos.

@roji roji enabled auto-merge (squash) February 1, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cosmos: Subquery not detected

1 participant