Skip to content

Commit

Permalink
eval: preserve step for event URIs (#1728)
Browse files Browse the repository at this point in the history
It will be used with sampling operators.
  • Loading branch information
brharrington authored Nov 20, 2024
1 parent abcc280 commit 80ed3f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private[stream] abstract class EvaluatorImpl(
dss.sources.asScala.flatMap { dataSource =>
val (exprType, exprs) = interpreter.parseQuery(Uri(dataSource.uri))
exprs.map { expr =>
val step = if (exprType.isTimeSeriesType) dataSource.step.toMillis else 0L
val step = dataSource.step.toMillis
LwcExpression(expr.toString, exprType, step)
}
}.toSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ case class ExpressionMetadata(
object ExpressionMetadata {

def apply(expression: String, exprType: ExprType, step: Long): ExpressionMetadata = {
val dfltStep = if (exprType.isTimeSeriesType) ApiSettings.defaultStep else 0L
val f = if (step > 0) step else dfltStep
val f = if (step > 0) step else ApiSettings.defaultStep
new ExpressionMetadata(expression, exprType, f, computeId(expression, exprType, f))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class SubscribeApiSuite extends MUnitRouteSuite {
parseBatch(client.expectMessage()).foreach {
case _: DiagnosticMessage =>
case sub: LwcSubscriptionV2 => subscriptions = sub :: subscriptions
case h: LwcHeartbeat => assertEquals(h.step, 5000L)
case h: LwcHeartbeat => assertEquals(h.step, 60000L)
case v => throw new MatchError(v)
}
}
Expand Down

0 comments on commit 80ed3f4

Please sign in to comment.