Skip to content

Commit

Permalink
handle scalar offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian-Yu committed Dec 16, 2024
1 parent 30cb934 commit df8d283
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ class MultiPartitionPlanner(val partitionLocationProvider: PartitionLocationProv
}}
}

private def computeOffsetMs(plan: LogicalPlan): Seq[Long] = plan match {
case op: ScalarVectorBinaryOperation => Seq(getOffsetMillis(op).max)
case _ => getOffsetMillis(plan)
}

/**
* Materializes a LogicalPlan with leaves that individually span multiple partitions.
* All "split-leaf" plans will fail to materialize (throw a BadQueryException) if they
Expand All @@ -578,7 +583,7 @@ class MultiPartitionPlanner(val partitionLocationProvider: PartitionLocationProv
val qParams = qContext.origQueryParams.asInstanceOf[PromQlQueryParams]
// get a mapping of assignments to time-ranges to query
val lookbackMs = getLookBackMillis(logicalPlan).max
val offsetMs = getOffsetMillis(logicalPlan)
val offsetMs = computeOffsetMs(logicalPlan)
val timeRange = TimeRange(1000 * qParams.startSecs, 1000 * qParams.endSecs)
val stepMsOpt = if (qParams.startSecs == qParams.endSecs) None else Some(1000 * qParams.stepSecs)
val partitions = getPartitions(logicalPlan, qParams).distinct.sortBy(_.timeRange.startMs)
Expand Down

0 comments on commit df8d283

Please sign in to comment.