Details
Description
- Add support for Sum, Count, Min, Max, Average, Count, Any, All.
- Handle the case with SQL engine returning long instead of int for COUNT and SUM, which causes an exception during materialization:
System.ArgumentException : Object of type 'System.Int64' cannot be converted to type 'System.Int32'. at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) at System.Reflection.MethodBase.CheckArguments(StackAllocedArguments& stackArgs, ReadOnlySpan`1 parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at Apache.Ignite.Internal.Linq.IgniteQueryExecutor.<>c__DisplayClass9_0`1.<GetResultSelector>b__0(IReadOnlyList`1 cols, BinaryTupleReader& reader) in /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs:line 146 at Apache.Ignite.Internal.Sql.ResultSet`1.ReadRow(IReadOnlyList`1 cols, MessagePackReader& reader) in /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs:line 226 at Apache.Ignite.Internal.Sql.ResultSet`1.<>c__DisplayClass29_0.<<EnumerateRows>g__EnumeratePage|0>d.MoveNext() in /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs:line 269 at Apache.Ignite.Internal.Sql.ResultSet`1.EnumerateRows()+MoveNext() in /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Sql/ResultSet.cs:line 236 at Apache.Ignite.Internal.Sql.ResultSet`1.EnumerateRows()+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at Apache.Ignite.Internal.Linq.IgniteQueryExecutor.ExecuteCollection[T](QueryModel queryModel)+MoveNext() in /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs:line 85 at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Apache.Ignite.Tests.Linq.LinqTests.TestGroupByWithCountAndSum() in /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.GroupBy.cs:line 57
Reproducer:
var query = PocoByteView.AsQueryable() .GroupBy(x => x.Val) .Select(x => new { x.Key, Count = (long)x.Count(), Sum = x.Sum(e => e.Key) }) .OrderBy(x => x.Key); var res = query.ToList();
Attachments
Issue Links
- is part of
-
IGNITE-17343 .NET: Thin 3.0: LINQ provider
- Resolved
- links to