Skip to content

Commit

Permalink
Merge pull request #5 from ing-bank/correct-count-aggregation
Browse files Browse the repository at this point in the history
Correct count aggregation
  • Loading branch information
Fokko authored Nov 23, 2017
2 parents 5a0ffaf + 12c91e2 commit e8ec285
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ lazy val root = (project in file("."))
.settings(commonSettings)
.settings(
name := "scruid",
version := "0.1.0.0",
version := "0.1.0.1",
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.1",

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/ing/wbaa/druid/definitions/Aggregation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ object AggregationType {

trait Aggregation {
val `type`: AggregationType
val name: String
}

trait SingleFieldAggregation extends Aggregation {
val name: String
val fieldName: String
}

case class CountAggregation(name: String, fieldName: String) extends SingleFieldAggregation{ val `type` = AggregationType.Count }
case class CountAggregation(name: String) extends Aggregation{ val `type` = AggregationType.Count }
case class LongSumAggregation(name: String, fieldName: String) extends SingleFieldAggregation{ val `type` = AggregationType.LongSum }
case class DoubleSumAggregation(name: String, fieldName: String) extends SingleFieldAggregation{ val `type` = AggregationType.DoubleSum }
case class DoubleMaxAggregation(name: String, fieldName: String) extends SingleFieldAggregation{ val `type` = AggregationType.DoubleMax }
Expand Down
20 changes: 4 additions & 16 deletions src/test/scala/ing/wbaa/druid/DruidTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ class DruidTest extends FunSuiteLike with Inside with OptionValues {

val resultFuture = TimeSeriesQuery[TimeseriesCount](
aggregations = List(
CountAggregation(
name = "count",
fieldName = "count"
)
CountAggregation(name = "count")
),
granularity = "hour",
intervals = List("2011-06-01/2017-06-01")
Expand Down Expand Up @@ -94,10 +91,7 @@ class DruidTest extends FunSuiteLike with Inside with OptionValues {

val resultFuture = GroupByQuery[GroupByIsAnonymous](
aggregations = List(
CountAggregation(
name = "count",
fieldName = "count"
)
CountAggregation(name = "count")
),
dimensions = List(Dimension(dimension = "isAnonymous")),
intervals = List("2011-06-01/2017-06-01")
Expand Down Expand Up @@ -158,10 +152,7 @@ class DruidTest extends FunSuiteLike with Inside with OptionValues {
threshold = threshold,
metric = "count",
aggregations = List(
CountAggregation(
name = "count",
fieldName = "count"
)
CountAggregation(name = "count")
),
intervals = List("2011-06-01/2017-06-01")
).execute
Expand Down Expand Up @@ -249,10 +240,7 @@ class DruidTest extends FunSuiteLike with Inside with OptionValues {
threshold = 5,
metric = "count",
aggregations = List(
CountAggregation(
name = "count",
fieldName = "count"
)
CountAggregation(name = "count")
),
intervals = List("2011-06-01/2017-06-01")
).execute
Expand Down

0 comments on commit e8ec285

Please sign in to comment.