Skip to content

Commit

Permalink
Adding UserDatasets for remote calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep6189 committed Aug 16, 2023
1 parent 38c682c commit 4f069c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions query/src/main/scala/filodb/query/LogicalPlan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package filodb.query

import filodb.core.query.{ColumnFilter, RangeParams, RvRange}
import filodb.core.query.Filter.Equals
import filodb.query.exec.TsCardExec

//scalastyle:off number.of.types
//scalastyle:off file.size.limit
Expand Down Expand Up @@ -185,7 +184,8 @@ object TsCardinalities {
case class TsCardinalities(shardKeyPrefix: Seq[String],
numGroupByFields: Int,
version: Int = 1,
datasets: Seq[String] = Seq()) extends LogicalPlan {
datasets: Seq[String] = Seq(),
userDatasets: String = "") extends LogicalPlan {
import TsCardinalities._

require(numGroupByFields >= 1 && numGroupByFields <= 3,
Expand All @@ -212,7 +212,7 @@ case class TsCardinalities(shardKeyPrefix: Seq[String],
.mkString(",") + "}"),
"numGroupByFields" -> numGroupByFields.toString,
"verbose" -> "true", // Using this plan to determine if we need to pass additional values in groupKey or not
"datasets" -> datasets.mkString(TsCardExec.PREFIX_DELIM)
"datasets" -> userDatasets
)
}
}
Expand Down
5 changes: 3 additions & 2 deletions query/src/test/scala/filodb/query/LogicalPlanSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,12 @@ class LogicalPlanSpec extends AnyFunSpec with Matchers {
it ("TsCardinalities queryParams should have expected values") {
val datasets = Seq("longtime-prometheus",
"recordingrules-prometheus_rules_longterm")
val plan = TsCardinalities(Seq("a","b","c"), 3, 2, datasets)
val userDatasets = "\"raw\",\"recordingrules\""
val plan = TsCardinalities(Seq("a","b","c"), 3, 2, datasets, userDatasets)
val queryParamsMap = plan.queryParams()

queryParamsMap.get("numGroupByFields").get shouldEqual "3"
queryParamsMap.get("datasets").get shouldEqual datasets.mkString(",")
queryParamsMap.get("datasets").get shouldEqual userDatasets
queryParamsMap.get("verbose").get shouldEqual "true"
queryParamsMap.get("match[]").get shouldEqual "{_ws_=\"a\",_ns_=\"b\",__name__=\"c\"}"
}
Expand Down

0 comments on commit 4f069c7

Please sign in to comment.