diff --git a/build.sbt b/build.sbt index 03538389..ba4c8fff 100644 --- a/build.sbt +++ b/build.sbt @@ -15,7 +15,7 @@ val developerURL: String = "https://matthicks.com" name := projectName ThisBuild / organization := org -ThisBuild / version := "0.11.0-SNAPSHOT" +ThisBuild / version := "0.11.0-SNAPSHOT1" ThisBuild / scalaVersion := scala213 ThisBuild / crossScalaVersions := allScalaVersions ThisBuild / scalacOptions ++= Seq("-unchecked", "-deprecation") diff --git a/core/src/main/scala/lightdb/aggregate/AggregateType.scala b/core/src/main/scala/lightdb/aggregate/AggregateType.scala index 6eae31dc..2bc4afcd 100644 --- a/core/src/main/scala/lightdb/aggregate/AggregateType.scala +++ b/core/src/main/scala/lightdb/aggregate/AggregateType.scala @@ -11,4 +11,5 @@ object AggregateType { case object CountDistinct extends AggregateType case object Group extends AggregateType case object Concat extends AggregateType + case object ConcatDistinct extends AggregateType } \ No newline at end of file diff --git a/core/src/main/scala/lightdb/index/Index.scala b/core/src/main/scala/lightdb/index/Index.scala index 4123f3ef..7c5ef2ed 100644 --- a/core/src/main/scala/lightdb/index/Index.scala +++ b/core/src/main/scala/lightdb/index/Index.scala @@ -23,6 +23,7 @@ trait Index[F, D <: Document[D]] extends FilterSupport[F, D, Filter[D]] { lazy val countDistinct: AggregateFunction[Int, F, D] = AggregateFunction(s"${fieldName}CountDistinct", this, AggregateType.CountDistinct) lazy val group: AggregateFunction[F, F, D] = AggregateFunction(s"${fieldName}Group", this, AggregateType.Group) lazy val concat: AggregateFunction[List[F], F, D] = AggregateFunction(s"${fieldName}Concat", this, AggregateType.Concat)(Index.ConcatRW) + lazy val concatDistinct: AggregateFunction[List[F], F, D] = AggregateFunction(s"${fieldName}ConcatDistinct", this, AggregateType.ConcatDistinct)(Index.ConcatRW) def aggregateFilterSupport(name: String): FilterSupport[F, D, AggregateFilter[D]] } diff --git a/sql/src/main/scala/lightdb/sql/SQLSupport.scala b/sql/src/main/scala/lightdb/sql/SQLSupport.scala index ca1a93d3..d3bce5b9 100644 --- a/sql/src/main/scala/lightdb/sql/SQLSupport.scala +++ b/sql/src/main/scala/lightdb/sql/SQLSupport.scala @@ -244,13 +244,13 @@ trait SQLSupport[D <: Document[D]] extends IndexSupport[D] { case AggregateType.Avg => Some("AVG") case AggregateType.Sum => Some("SUM") case AggregateType.Count | AggregateType.CountDistinct => Some("COUNT") - case AggregateType.Concat => Some("GROUP_CONCAT") + case AggregateType.Concat | AggregateType.ConcatDistinct => Some("GROUP_CONCAT") case AggregateType.Group => None } val fieldName = af match { case Some(s) => val pre = f.`type` match { - case AggregateType.CountDistinct => "DISTINCT " + case AggregateType.CountDistinct | AggregateType.ConcatDistinct => "DISTINCT " case _ => "" } val post = f.`type` match {