Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmos: Implement EF.Functions.CoalesceUndefined #33904

Closed
roji opened this issue Jun 4, 2024 · 1 comment
Closed

Cosmos: Implement EF.Functions.CoalesceUndefined #33904

roji opened this issue Jun 4, 2024 · 1 comment
Assignees
Labels
area-cosmos area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Jun 4, 2024

Cosmos has a coalescing operator (??); this coalesces Cosmos undefined (e.g. missing properties), but not null:

SELECT null ?? 'foo' -- returns null
SELECT undefined ?? 'foo' -- returns foo

As a result, this operator is unsuitable for translation of regular .NET coalescing operations; we already use the conditional operator for that (x != null ? x : 'foo'). However, the user should be able to express the coalescing operator via e.g. an EF.Functions.CoalesceUndefined() function.

This can probably be done together with #17722 (add IS_DEFINED() translation), as part of a better story around Cosmos undefined.

/cc @ajcvickers

@roji
Copy link
Member Author

roji commented Jun 8, 2024

The coalescing operator is needed for certain translations, e.g. Where(b => b.Ints.FirstOrDefault() == 8, so I'll just go ahead and implement this.

@roji roji modified the milestones: 9.0.0, Backlog Jun 8, 2024
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 8, 2024
roji added a commit to roji/efcore that referenced this issue Jun 8, 2024
roji added a commit to roji/efcore that referenced this issue Jun 8, 2024
roji added a commit to roji/efcore that referenced this issue Jun 11, 2024
@roji roji closed this as completed in 22aec2c Jun 11, 2024
@roji roji changed the title Cosmos: implement EF.Functions.CoalesceUndefined Cosmos: Implement EF.Functions.CoalesceUndefined Jun 14, 2024
@ajcvickers ajcvickers modified the milestones: 9.0.0, 9.0.0-preview6 Jun 21, 2024
@roji roji modified the milestones: 9.0.0-preview6, 9.0.0 Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-cosmos area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

2 participants