Skip to content

Commit

Permalink
fix(query-stats): return namespace regex value as given instead of us…
Browse files Browse the repository at this point in the history
…ing multiple (#1771)
  • Loading branch information
sandeep6189 committed May 15, 2024
1 parent 9930e66 commit 522ab33
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,7 @@ class TimeSeriesShard(val ref: DatasetRef,
shardKeyColumns.map { col =>
filters.collectFirst {
case ColumnFilter(c, Filter.Equals(filtVal: String)) if c == col => filtVal
case ColumnFilter(c, Filter.EqualsRegex(filtVal: String)) if c == col => filtVal
}.getOrElse("multiple")
}.toList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class TimeSeriesMemStoreSpec extends AnyFunSpec with Matchers with BeforeAndAfte
}

val schemas1 = Schemas(schema1)
val schemas2 = Schemas(schema2)

it("should detect duplicate setup") {
memStore.setup(dataset1.ref, schemas1, 0, TestData.storeConf, 1)
Expand Down Expand Up @@ -572,6 +573,24 @@ class TimeSeriesMemStoreSpec extends AnyFunSpec with Matchers with BeforeAndAfte

}

it("should return the expected regex ns format for query stats group") {
memStore.setup(dataset1.ref, schemas2, 0, TestData.storeConf, 1)
val split = memStore.getScanSplits(dataset1.ref, 1).head
val session = QuerySession.makeForTestingOnly()
val filters = Seq(
ColumnFilter("_ws_", Filter.Equals("test_ws")),
ColumnFilter("_ns_", Filter.EqualsRegex("App-0|App-1")),
ColumnFilter("_metric_", Filter.Equals("http_latency")))
val value = memStore.scanPartitions(dataset1.ref, Seq(0, 1), FilteredPartitionScan(split, filters),
querySession = session)
.toListL.runToFuture.futureValue
session.queryStats.stat.size shouldEqual 1
session.queryStats.stat.head._1.size shouldEqual 5
session.queryStats.stat.head._1(2) shouldEqual "test_ws"
session.queryStats.stat.head._1(3) shouldEqual "App-0|App-1"
session.queryStats.stat.head._1(4) shouldEqual "http_latency"
}

it("should assign same previously assigned partId using bloom filter when evicted series starts re-ingesting") {

memStore.setup(dataset1.ref, schemas1, 0, TestData.storeConf, 1)
Expand Down

0 comments on commit 522ab33

Please sign in to comment.