EntityFrameworkCore.ClickHouse icon indicating copy to clipboard operation
EntityFrameworkCore.ClickHouse copied to clipboard

Count is not working

Open georgeemr opened this issue 1 year ago • 2 comments

When you call Count, the next exception is thrown.

image

The table have more than 5 million records.

Tested on 0.0.13.

Appreciate your help.

georgeemr avatar Apr 23 '24 23:04 georgeemr

Hi, @georgeemr !

Please, provide full example, with entities and db schema.

denis-ivanov avatar Apr 29 '24 13:04 denis-ivanov

You can use typecast (Int64) or (long) to fix it like here

var query =
  from MyModel mm in _context.MyModels
  group mm by mm.Name into g
  select new { g.Key, Likes = (Int64)g.Sum(o => o.Likes) };

Eflarus avatar May 13 '24 21:05 Eflarus