Roman,

Can you try rephrasing the LINQ query as the SQL goes?

var q1 = queryable.GroupBy(o => o.Value.ContractId).Select(g => new
{ContractId = g.Key, MaxVer = g.Select(x=>x.Value.Version).Max()});
var q2 = q1.Select( ...)

At least this first part works for me. I did not try further.

Ideally please provide a full working project with the LINQ expression that
does not work for you.
I'm trying to understand if there is a limitation or a bug of some kind.

Thanks,
Pavel

On Thu, Jun 21, 2018 at 1:09 PM, Roman Guseinov <ro...@gromtech.ru> wrote:

> Hi Pavel,
>
> Thank you for the response. Regarding support every LINQ expression, I
> agree
> with you. It's not possible.
>
> Let me show an example. The following LINQ query:
>
> /var result = queryable.GroupBy(e => e.Value.ContractId).Select(group =>
> new
> {
>     ContractId = group.Key,
>     Id = group.OrderByDescending(entry => entry.Value.Version).First().Key
> }).OrderBy(g => g.Count).ToList();/
>
> we can replace by SQL query:
>
> /SELECT cid as ContractId,
>        min(id) as Id
> FROM
>   (SELECT t2.cid,
>           t3.id
>    FROM
>      (SELECT t1.ContractId AS cid, max(t1.Version) AS ver
>       FROM table AS t1
>       GROUP BY t1.ContractId) AS t2
>    JOIN table AS t3 ON t3.Version = t2.ver
>    AND t3.ContractId = t2.cid)
> GROUP BY cid/
>
> I know this is not a trivial task and it can not be implemented easily. I
> just curious if there any plans to support that in the near future.
>
> Thanks again.
>
> Best Regards,
> Roman
>
>
>
> --
> Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
>

Reply via email to