Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vishramachandran committed Nov 14, 2024
1 parent 45db4e8 commit b67b88c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ final case class PeriodicSamplesMapper(startMs: Long,
val rdrv = rv.asInstanceOf[RawDataRangeVector]
val chunkedHRangeFunc = rangeFuncGen().asChunkedH
val minResolutionMs = rdrv.minResolutionMs
if (chunkedHRangeFunc.isInstanceOf[CounterChunkedRangeFunction[_]] && windowLength < minResolutionMs * 2)
val extendedWindow = extendLookback(rdrv, windowLength)
if (chunkedHRangeFunc.isInstanceOf[CounterChunkedRangeFunction[_]] && extendedWindow < minResolutionMs * 2)
throw new IllegalArgumentException(s"Minimum resolution of data for this time range is " +
s"${minResolutionMs}ms. However, a lookback of ${windowLength}ms was chosen. This will not " +
s"yield intended results for rate/increase functions since each lookback window can contain " +
s"lesser than 2 samples. Increase lookback to more than ${minResolutionMs * 2}ms")
val windowPlusPubInt = extendLookback(rv, windowLength)
IteratorBackedRangeVector(rv.key,
new ChunkedWindowIteratorH(rdrv, startWithOffset, adjustedStep, endWithOffset,
windowPlusPubInt, chunkedHRangeFunc, querySession, histRow), outputRvRange)
extendedWindow, chunkedHRangeFunc, querySession, histRow), outputRvRange)
}
case c: ChunkedRangeFunction[_] =>
source.map { rv =>
Expand All @@ -104,15 +104,16 @@ final case class PeriodicSamplesMapper(startMs: Long,
val rdrv = rv.asInstanceOf[RawDataRangeVector]
val minResolutionMs = rdrv.minResolutionMs * 2
val chunkedDRangeFunc = rangeFuncGen().asChunkedD
if (chunkedDRangeFunc.isInstanceOf[CounterChunkedRangeFunction[_]] && windowLength < rdrv.minResolutionMs * 2)
val extendedWindow = extendLookback(rdrv, windowLength)
if (chunkedDRangeFunc.isInstanceOf[CounterChunkedRangeFunction[_]] &&
extendedWindow < rdrv.minResolutionMs * 2)
throw new IllegalArgumentException(s"Minimum resolution of data for this time range is " +
s"${minResolutionMs}ms. However, a lookback of ${windowLength}ms was chosen. This will not " +
s"yield intended results for rate/increase functions since each lookback window can contain " +
s"lesser than 2 samples. Increase lookback to more than ${minResolutionMs * 2}ms")
val windowPlusPubInt = extendLookback(rv, windowLength)
IteratorBackedRangeVector(rv.key,
new ChunkedWindowIteratorD(rdrv, startWithOffset, adjustedStep, endWithOffset,
windowPlusPubInt, chunkedDRangeFunc, querySession), outputRvRange)
extendedWindow, chunkedDRangeFunc, querySession), outputRvRange)
}
// Iterator-based: Wrap long columns to yield a double value
case f: RangeFunction if valColType == ColumnType.LongColumn =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1834,6 +1834,7 @@ class DownsamplerMainSpec extends AnyFunSpec with Matchers with BeforeAndAfterAl
val exec = MultiSchemaPartitionsExec(qc,
InProcessPlanDispatcher(QueryConfig.unitTestingQueryConfig), batchDownsampler.rawDatasetRef, 0, queryFilters,
AllChunkScan, "_metric_")
// window should be auto-extended to 10m
exec.addRangeVectorTransformer(PeriodicSamplesMapper(74373042000L, 10, 74373042000L,Some(310000),
Some(InternalRangeFunction.Rate), qc))

Expand All @@ -1848,7 +1849,7 @@ class DownsamplerMainSpec extends AnyFunSpec with Matchers with BeforeAndAfterAl
downsampleTSStore.shutdown()
}

it("should encounter error when doing rate on DownsampledTimeSeriesShard when lookback < 5m resolution ") {
it("should encounter error when doing increase on DownsampledTimeSeriesShard when lookback < 10m resolution ") {

val downsampleTSStore = new DownsampledTimeSeriesStore(downsampleColStore, rawColStore,
settings.filodbConfig)
Expand All @@ -1866,7 +1867,7 @@ class DownsamplerMainSpec extends AnyFunSpec with Matchers with BeforeAndAfterAl
InProcessPlanDispatcher(QueryConfig.unitTestingQueryConfig), batchDownsampler.rawDatasetRef, 0, queryFilters,
AllChunkScan, "_metric_")
exec.addRangeVectorTransformer(PeriodicSamplesMapper(74373042000L, 10, 74373042000L,Some(290000),
Some(InternalRangeFunction.Rate), qc))
Some(InternalRangeFunction.Increase), qc))

val querySession = QuerySession(QueryContext(), queryConfig)
val queryScheduler = Scheduler.fixedPool(s"$QuerySchedName", 3)
Expand Down

0 comments on commit b67b88c

Please sign in to comment.