Skip to content

Commit

Permalink
misc: Add scala 2.12 unchecked.
Browse files Browse the repository at this point in the history
  • Loading branch information
aandis committed Aug 7, 2021
1 parent a7ceeca commit 367175b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ case class BinaryExpression(lhs: Expression,
if (hasScalarResult(lhsWithPrecedence) && hasScalarResult(rhsWithPrecedence)) {
val rangeParams = RangeParams(timeParams.start, timeParams.step, timeParams.end)

(lhsWithPrecedence, rhsWithPrecedence) match {
((lhsWithPrecedence, rhsWithPrecedence): @unchecked) match {
// 3 + 4
case (lh: ScalarExpression, rh: ScalarExpression) =>
ScalarBinaryOperation(operator.getPlanOperator, Left(lh.toScalar), Left(rh.toScalar), rangeParams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ trait ExpressionParser extends AggregatesParser with SelectorParser with Numeric

"(" ~ expression ~ ")" ^^ {
case "(" ~ ep ~ ")" => PrecedenceExpression(ep)
case _ => ???
}
}

Expand Down
10 changes: 5 additions & 5 deletions query/src/test/scala/filodb/query/exec/MetadataExecSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MetadataExecSpec extends AnyFunSpec with Matchers with ScalaFutures with B
timeseriesDataset.ref, 0, filters, Seq("job", "unicode_tag"), now-5000, now)

val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) => {
val rv = response(0)
rv.rows.size shouldEqual 1
Expand All @@ -114,7 +114,7 @@ class MetadataExecSpec extends AnyFunSpec with Matchers with ScalaFutures with B
timeseriesDataset.ref, 0, filters, false, now-5000, now)

val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
resp match {
(resp: @unchecked) match {
case QueryResult(_, _, results, _, _) => results.size shouldEqual 1
results(0).rows.size shouldEqual 0
}
Expand All @@ -128,7 +128,7 @@ class MetadataExecSpec extends AnyFunSpec with Matchers with ScalaFutures with B
timeseriesDataset.ref, 0, filters, false, now-5000, now)

val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) =>
response.size shouldEqual 1
response(0).rows.map { row =>
Expand All @@ -149,7 +149,7 @@ class MetadataExecSpec extends AnyFunSpec with Matchers with ScalaFutures with B
timeseriesDataset.ref, 0, filters, false, now-5000, now)

val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) => {
response.size shouldEqual 1
response(0).rows.map { row =>
Expand All @@ -168,7 +168,7 @@ class MetadataExecSpec extends AnyFunSpec with Matchers with ScalaFutures with B
timeseriesDataset.ref, 0, filters, Seq("job", "unicode_tag"), now-5000, now)

val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) => {
val rv = response(0)
rv.rows.size shouldEqual 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class ScalarFunctionSpec extends AnyFunSpec with Matchers with ScalaFutures {
implicit val timeout: FiniteDuration = FiniteDuration(5, TimeUnit.SECONDS)
import monix.execution.Scheduler.Implicits.global
val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) => {
val rv = response(0)
rv.isInstanceOf[TimeScalar] shouldEqual(true)
Expand All @@ -156,7 +156,7 @@ class ScalarFunctionSpec extends AnyFunSpec with Matchers with ScalaFutures {
implicit val timeout: FiniteDuration = FiniteDuration(5, TimeUnit.SECONDS)
import monix.execution.Scheduler.Implicits.global
val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) => {
val rv = response(0)
rv.isInstanceOf[HourScalar] shouldEqual(true)
Expand All @@ -172,7 +172,7 @@ class ScalarFunctionSpec extends AnyFunSpec with Matchers with ScalaFutures {
implicit val timeout: FiniteDuration = FiniteDuration(5, TimeUnit.SECONDS)
import monix.execution.Scheduler.Implicits.global
val resp = execPlan.execute(memStore, querySession).runAsync.futureValue
val result = resp match {
val result = (resp: @unchecked) match {
case QueryResult(id, _, response, _, _) => {
val rv = response(0)
rv.isInstanceOf[DayOfWeekScalar] shouldEqual(true)
Expand Down

0 comments on commit 367175b

Please sign in to comment.