Skip to content

Fix bug with inner .Count(predicate) translation#477

Open
SergeiPavlov wants to merge 2 commits intomaster-servicetitanfrom
Count
Open

Fix bug with inner .Count(predicate) translation#477
SergeiPavlov wants to merge 2 commits intomaster-servicetitanfrom
Count

Conversation

@SergeiPavlov
Copy link
Copy Markdown
Collaborator

@SergeiPavlov SergeiPavlov commented Apr 22, 2026

The new DataObjects from Xtensive (starting 7.3.12 in our version numbering)
cannot translate inner .Count(predicate) expressions like following:

session.Query.All<Promotion>().GroupBy(p => p.Id).Select(g =>
      g.Count(x => x.CampainName == null)
    )

See the discussion: https://servicetitan.slack.com/archives/CLM7XAVLK/p1776720202265489?thread_ts=1776709176.616779&cid=CLM7XAVLK

This PR fixes it, translating as an equivalent sequence .Where(predicate).Count()

Also:

  • Add a test

@snaumenko-st
Copy link
Copy Markdown

snaumenko-st commented Apr 22, 2026

@SergeiPavlov I'm going to fix the root cause of this bug in the upcoming PR. And it's not something new.
upd: #478 is a replacement

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.

3 participants