[ 
https://issues.apache.org/jira/browse/IGNITE-5266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17284143#comment-17284143
 ] 

Pavel Tupitsyn commented on IGNITE-5266:
----------------------------------------

[~nathanchan2020] Ignite.NET has a LINQ provider that converts C# expressions 
to Ignite SQL (similar to how Entity Framework does the same for SQL Server / 
MySQL / Postgres).

In Ignite, I can write the following query:

{code}
var query = cache.AsCacheQueryable().Where(entry => entry.Value.Age > 20);
int count = query.Count();
{code}

As a result, the following SQL query will be executed:
{code}
select count (_T0.*) from Person as _T0
{code}

But what if the result of the query exceeds {{int.MaxValue}}? We'll get an 
invalid result or an error.
That's why we need to add {{LongCount()}} support.

The first step is to add the following line to {{TestScalarQuery}} in 
[CacheLinqTest.Misc|https://github.com/apache/ignite/blob/master/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Misc.cs#L129-L128]
{code}
Assert.AreEqual(PersonCount, cache.LongCount());
{code}

Run this test and you'll get an error "Operator is not supported: LongCount()". 
Try to fix this error by modifying 
{{CacheQueryModelVisitor.ProcessResultOperatorsBegin}}.

Let me know if you have any questions.

> .NET: Support LongCount in LINQ
> -------------------------------
>
>                 Key: IGNITE-5266
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5266
>             Project: Ignite
>          Issue Type: Improvement
>          Components: platforms
>            Reporter: Pavel Tupitsyn
>            Assignee: Kin Chan
>            Priority: Major
>              Labels: .NET, LINQ, newbie
>
> H2 SQL {{COUNT}} function returns a {{long}}, but LINQ {{Count}} returns an 
> int. We should simply add {{LongCount}} support the same way as {{Count}}.
> The tricky thing would be to test it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to