You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/12/22 05:54:08 UTC

[GitHub] [ignite-3] ptupitsyn commented on a diff in pull request #1460: IGNITE-18329 .NET: Add support for nullable value type mapping

ptupitsyn commented on code in PR #1460:
URL: https://github.com/apache/ignite-3/pull/1460#discussion_r1055115481


##########
modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.Aggregate.cs:
##########
@@ -156,4 +158,39 @@ public void TestAny()
         // Additional Where.
         Assert.IsFalse(PocoView.AsQueryable().Where(x => x.Key > 7).Any(x => x.Key < 5));
     }
+
+    [Test]
+    public void TestAggregateNullableDouble()
+    {
+        var query = PocoAllColumnsSqlNullableView.AsQueryable();
+
+        double? sumNotNull = query.Sum(x => x.Double);
+        double? sumNull = query.Where(x => x.Double == null).Sum(x => x.Double);
+
+        Assert.AreEqual(110d, sumNotNull);
+        Assert.IsNull(sumNull);
+    }
+
+    [Test]
+    public void TestAggregateNullableAllTypes()
+    {
+        Test(q => q.Sum(x => x.Int8));
+        Test(q => q.Sum(x => x.Int16));
+        Test(q => q.Sum(x => x.Int32));
+        Test(q => q.Sum(x => x.Int64));
+        Test(q => q.Sum(x => x.Float));
+        Test(q => q.Sum(x => x.Double));
+        Test(q => q.Sum(x => x.Decimal));
+
+        void Test<T>(Func<IQueryable<PocoAllColumnsSqlNullable>, T> sumFunc)
+        {
+            var query = PocoAllColumnsSqlNullableView.AsQueryable();
+
+            var sumNotNull = sumFunc(query);
+            var sumNull = sumFunc(query.Where(x => x.Double == null));

Review Comment:
   Can you please clarify? This is `TestAggregateNullableAllTypes`, which only tests summing nullable values.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org