compute(sum(x) aggregation returns Measures[Nothing]

39 views
Skip to first unread message

Fredl Zucker

unread,
Jan 18, 2017, 11:13:21 AM1/18/17
to Squeryl
Hello Guys,

that`s my first post in this Group.

scalaVersion: 2.11.8
squerylVersion: 0.9.7

I decide to use squeryl as datalayer in my project and i`m trying to aggregate some columns with sum function as written in example below(simplified example). I`m wondering that i got only on avg function some Mesures as return value. How is the correct way to aggregate with sum, min or max? I even tried with groupBy or join on other table before compute but with same result.


class BaseEntity extends KeyedEntity[Long] {
 
var id: Long = 0
  var lastModified = new Timestamp(System.currentTimeMillis)
}
case class MyEntity(metal: Long) extends BaseEntity

val tableOfentity = table[MyEntity]
on
(tableOfentity)(t => declare(
  t
.id is (autoIncremented)
))

class DAO {
 def aggregate() = {
   inTransaction {
      val x1: Query[Measures[Nothing]] = from(tableOfEntity)(t=> compute(min(t.metal)))
      val x2: Query[Measures[Nothing]] = from(tableOfEntity)(t=> compute(max(t.metal)))    
      val x3: Query[Measures[Nothing]] = from(tableOfEntity)(t=> compute(sum(t.metal)))
      val x4: Query[Measures[Option[Float]]] = from(tableOfEntity)(t=> compute(avg(t.metal)))
    }
  }
}



Thank You,
Frederik




Fredl Zucker

unread,
Jan 19, 2017, 3:28:38 AM1/19/17
to Squeryl
Found some answer by a colleauge. This is only an bug inside idea ide. Idea cannot detect the correct datatype of types with upper and lower bound. The code will compile on console without problems. So we can close this thread ,i have opened a bugticket within ideas bugtracker.

Hopefully someday this Project will be more active :)

Best regards from germany

Reply all
Reply to author
Forward
0 new messages