Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre 2.4.0 housekeeping #98

Merged
merged 9 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
- name: Wait Druid to become available
run: wget localhost:8082/status
- name: Build for Scala 2.11
run: sbt ++2.11.12 compile
run: sbt ++2.11.12 compile test:compile
- name: Build for Scala 2.12
run: sbt ++2.12.10 compile
run: sbt ++2.12.11 compile test:compile
- name: Build for Scala 2.13
run: sbt ++2.13.1 compile
run: sbt ++2.13.2 compile test:compile
- name: Code coverage report (Scala 2.12)
run: sbt coverage test coverageReport
- name: Archive code coverage report (Scala 2.12)
Expand All @@ -51,4 +51,4 @@ jobs:
run: (cd docker; make push)
env:
_JAVA_OPTIONS: "-Xms512m -Xmx4g"
REPOSITORY_OWNER: ${{ github.repository }}
REPOSITORY_OWNER: ${{ github.repository }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Scruid (Scala+Druid) is an open source library that allows you to compose Druid

Currently, the API is under heavy development, so changes might occur.

## Release Notes

Please view the [Releases](https://github.com/ing-bank/scruid/releases) page on GitHub.

## Installation

The binaries are hosted on Bintray. We publish builds for Scala 2.11, 2.12 and 2.13.

```sbt
libraryDependencies += "ing.wbaa.druid" %% "scruid" % "2.4.0"
```

## Example queries:

Scruid provides query constructors for `TopNQuery`, `GroupByQuery`, `TimeSeriesQuery`, `ScanQuery` and `SearchQuery` (see below for details). You can call the `execute` method on a query to send the query to Druid. This will return a `Future[DruidResponse]`. This response contains the [Circe](http://circe.io) JSON data without having it parsed to a specific case class yet. To interpret this JSON data you can run two methods on a `DruidResponse`:
Expand Down
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

val circeForScala211Version = "0.11.1" // Only for Scala v2.11
val circeLatestVersion = "0.12.1" // for Scala v2.12+
val mdedetrichVersion = "0.4.0"
val scalacticVersion = "3.0.8"
val scalatestVersion = "3.0.8"
val typesafeConfigVersion = "1.3.3"
val mdedetrichVersion = "0.5.0"
val scalacticVersion = "3.1.1"
val scalatestVersion = "3.1.1"
val typesafeConfigVersion = "1.4.0"
val typesafeLoggingVersion = "3.9.2"
val akkaHttpVersion = "10.1.9"
val akkaHttpVersion = "10.1.11"
val sealerateVersion = "0.0.6"
val logbackVersion = "1.2.3"
val collectionCompatVersion = "2.1.2"
val collectionCompatVersion = "2.1.6"

def scalaVersionSpecificDependencies(scalaVer: String): Seq[ModuleID] = {

Expand Down Expand Up @@ -86,8 +86,8 @@ lazy val commonSettings: Seq[Setting[_]] = Seq(
s"[email protected]:${bintrayOrganization.value.get}/${name.value}.git"
)
),
crossScalaVersions in ThisBuild := Seq("2.11.12", "2.12.10", "2.13.1"),
scalaVersion in ThisBuild := "2.12.9",
crossScalaVersions in ThisBuild := Seq("2.11.12", "2.12.11", "2.13.2"),
scalaVersion in ThisBuild := "2.12.11",
scalacOptions ++= Seq(Opts.compile.deprecation, "-Xlint", "-feature"),
scalacOptions ++= unusedWarnings(scalaVersion.value),
publishArtifact in Test := false,
Expand All @@ -113,7 +113,7 @@ lazy val root = (project in file("."))
"ca.mrvisser" %% "sealerate" % sealerateVersion,
"org.scala-lang.modules" %% "scala-collection-compat" % collectionCompatVersion,
"ch.qos.logback" % "logback-classic" % logbackVersion % Provided,
"org.scalactic" %% "scalactic" % scalacticVersion,
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
Expand Down
12 changes: 6 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/release

resolvers += "Sbt plugins" at "https://dl.bintray.com/sbt/sbt-plugin-releases"

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "1.3.12")
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "3.0.3")

addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")

addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")

addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.4")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.0")

addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "0.2.4")
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "2.0.0")
15 changes: 15 additions & 0 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

druid = {

host = "localhost"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ing/wbaa/druid/DruidQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package ing.wbaa.druid

import java.time.{ ZoneId, ZonedDateTime }
import java.time.ZonedDateTime

import akka.NotUsed
import akka.stream.scaladsl.Source
Expand Down
17 changes: 17 additions & 0 deletions src/main/scala/ing/wbaa/druid/SQL.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package ing.wbaa.druid

import java.sql.Timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DruidAdvancedHttpClient private (
.recover {
case ex =>
healthLogger.warn(
s"healthcheck of ${queryHost.host} on port ${queryHost.port} failed: $ex"
s"healthcheck of ${queryHost.host} on port ${queryHost.port} failed: ${ex.toString}"
)
queryHost -> false
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ing/wbaa/druid/client/DruidHttpClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DruidHttpClient private (connectionFlow: DruidHttpClient.ConnectionFlowTyp
.recover {
case ex =>
healthLogger.warn(
s"healthcheck of ${queryHost.host} on port ${queryHost.port} failed: $ex"
s"healthcheck of ${queryHost.host} on port ${queryHost.port} failed: ${ex.toString}"
)
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package ing.wbaa.druid.client

import akka.http.scaladsl.model.{ HttpEntity, HttpHeader, HttpProtocol, HttpResponse, StatusCode }
import akka.http.scaladsl.unmarshalling.Unmarshal

import scala.collection.immutable.Seq
import scala.util.Try
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ing/wbaa/druid/dql/QueryBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ final class QueryBuilder private[dql] ()
*
* @return the resulting time-series query
*/
@deprecated(message = "use timeseries.build()")
@deprecated(message = "use timeseries.build()", since = "2.4.0")
def build()(implicit druidConfig: DruidConfig = DruidConfig.DefaultConfig): TimeSeriesQuery =
timeseries.build()

Expand Down
17 changes: 17 additions & 0 deletions src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
Expand Down
5 changes: 3 additions & 2 deletions src/test/scala/ing/wbaa/druid/ConfigOverridesSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
package ing.wbaa.druid

import ing.wbaa.druid.client.DruidAdvancedHttpClient
import org.scalatest.{ Matchers, WordSpec }

import scala.concurrent.duration._
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class ConfigOverridesSpec extends WordSpec with Matchers {
class ConfigOverridesSpec extends AnyWordSpec with Matchers {

def asFiniteDuration(d: java.time.Duration): FiniteDuration =
scala.concurrent.duration.Duration.fromNanos(d.toNanos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ import scala.concurrent.duration._
import scala.concurrent.{ ExecutionContextExecutor, Future }
import scala.language.postfixOps
import scala.util.Random
import org.scalatest.diagrams.Diagrams
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class DruidAdvancedHttpClientSpec
extends WordSpec
extends AnyWordSpec
with Matchers
with ScalaFutures
with Inspectors
with DiagrammedAssertions {
with Diagrams {

override implicit def patienceConfig: PatienceConfig = PatienceConfig(5 minutes, 100 millis)

Expand Down
4 changes: 3 additions & 1 deletion src/test/scala/ing/wbaa/druid/DruidClientSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import org.scalatest.concurrent._

import scala.concurrent.duration._
import scala.language.postfixOps
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class DruidClientSpec extends WordSpec with Matchers with ScalaFutures {
class DruidClientSpec extends AnyWordSpec with Matchers with ScalaFutures {

override implicit def patienceConfig: PatienceConfig = PatienceConfig(10 seconds, 100 millis)

Expand Down
4 changes: 3 additions & 1 deletion src/test/scala/ing/wbaa/druid/DruidQuerySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import org.scalatest.concurrent._
import scala.concurrent.duration._
import scala.concurrent.Future
import scala.language.postfixOps
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class DruidQuerySpec extends WordSpec with Matchers with ScalaFutures {
class DruidQuerySpec extends AnyWordSpec with Matchers with ScalaFutures {

override implicit def patienceConfig: PatienceConfig = PatienceConfig(1 minute, 100 millis)

Expand Down
4 changes: 3 additions & 1 deletion src/test/scala/ing/wbaa/druid/QueryContextSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import io.circe.syntax._
import org.scalatest._
import org.scalatest.concurrent._
import org.scalatest.time._
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class QueryContextSpec extends WordSpec with Matchers with ScalaFutures {
class QueryContextSpec extends AnyWordSpec with Matchers with ScalaFutures {

implicit override val patienceConfig =
PatienceConfig(timeout = Span(20, Seconds), interval = Span(5, Millis))
Expand Down
22 changes: 20 additions & 2 deletions src/test/scala/ing/wbaa/druid/SQLQuerySpec.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package ing.wbaa.druid

import java.time.{ LocalDateTime, ZonedDateTime }

import akka.stream.scaladsl.Sink
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.time.{ Millis, Seconds, Span }
import org.scalatest.{ Matchers, WordSpec }
import ing.wbaa.druid.SQL._
import ing.wbaa.druid.client.CirceDecoders
import io.circe.generic.auto._
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

//noinspection SqlNoDataSourceInspection
class SQLQuerySpec extends WordSpec with Matchers with ScalaFutures with CirceDecoders {
class SQLQuerySpec extends AnyWordSpec with Matchers with ScalaFutures with CirceDecoders {
implicit override val patienceConfig =
PatienceConfig(timeout = Span(20, Seconds), interval = Span(5, Millis))
private val totalNumberOfEntries = 39244
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import org.scalatest.concurrent._

import scala.concurrent.duration._
import scala.language.postfixOps
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class BasicAuthenticationSpec extends WordSpec with Matchers with ScalaFutures {
class BasicAuthenticationSpec extends AnyWordSpec with Matchers with ScalaFutures {

override implicit def patienceConfig: PatienceConfig = PatienceConfig(5 minutes, 100 millis)
private val totalNumberOfEntries = 39244
Expand Down
22 changes: 20 additions & 2 deletions src/test/scala/ing/wbaa/druid/definitions/ExtractionFnSpec.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package ing.wbaa.druid.definitions

import ing.wbaa.druid.GroupByQuery
import ing.wbaa.druid.definitions.FilterOperators._
import io.circe.generic.auto._
import io.circe.syntax._
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{ Matchers, WordSpecLike }

import scala.concurrent.duration._
import scala.language.postfixOps
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpecLike

class ExtractionFnSpec extends Matchers with WordSpecLike with ScalaFutures {
class ExtractionFnSpec extends Matchers with AnyWordSpecLike with ScalaFutures {

override implicit def patienceConfig: PatienceConfig = PatienceConfig(10 seconds, 100 millis)

Expand Down
21 changes: 20 additions & 1 deletion src/test/scala/ing/wbaa/druid/definitions/GranularitySpec.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package ing.wbaa.druid.definitions

import org.scalatest._

import io.circe._
import io.circe.syntax._
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

class GranularitySpec extends WordSpec with Matchers {
class GranularitySpec extends AnyWordSpec with Matchers {
"Granularities" should {
"be able to encode to json" in {
implicit val granularityEncoder: Encoder[Granularity] = GranularityType.encoder
Expand Down
Loading