Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-4543

.NET: Support multiple aggregates in LINQ

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • platforms

    Description

      Provide a way to express multiple aggregates in LINQ like we do in SQL:
      SELECT MIN(salary), MAX(salary) from Employee,

      LINQ to SQL and EntityFramework allow constructs like these:

              [Test]
              public void TestAggregatesMultiple()
              {
                  var ints = GetPersonCache().AsCacheQueryable().Select(x => x.Key);
      
                  var res = ints.GroupBy(x => 1).Select(g => new {Sum = g.Sum(), Avg = g.Average()}).Single();
      
                  Assert.AreEqual(ints.Sum(), res.Sum);
                  Assert.AreEqual(ints.Average(), res.Avg);
      
                  var res2 = ints.Select(x => new {Sum = ints.Sum(), Avg = ints.Average()}).First();
                  
                  Assert.AreEqual(ints.Sum(), res2.Sum);
                  Assert.AreEqual(ints.Average(), res2.Avg);
              }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ptupitsyn Pavel Tupitsyn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: