Skip to content

Conversation

@vishramachandran
Copy link
Member

Pull Request checklist

  • The commit(s) message(s) follows the contribution guidelines ?
  • Tests for the changes have been added (for bug fixes / features) ?
  • Docs have been added / updated (for bug fixes / features) ?

Current behavior :
PromQL with subquery that span both raw and downsample clusters, is entirely sent to the downsample cluster.

New behavior :
We delegate the planning of subquery back to the root planner which enables us to properly plan the subquery over long range, and then we apply the windowing function over the results.

old plan

```
T~PeriodicSamplesMapper(start=1633913330000, step=300000, end=1634755730000, window=Some(900000), functionId=Some(LastOverTimeIsMadOutlier), rawSource=false, offsetMs=None)
-FA1~StaticFuncArgs(3.0,RangeParams(1633913330,300,1634777330))

-FA2~StaticFuncArgs(1.0,RangeParams(1633913330,300,1634777330))
-T~AggregatePresenter(aggrOp=Sum, aggrParams=List(), rangeParams=RangeParams(1633912500,300,1634755500))
--E~LocalPartitionReduceAggregateExec(aggrOp=Sum, aggrParams=List()) on ActorPlanDispatcher(Actor[akka://default/system/testProbe-1#5785863],downsample)
---T~AggregateMapReduce(aggrOp=Sum, aggrParams=List(), without=List(), by=List())
----T~PeriodicSamplesMapper(start=1633912500000, step=300000, end=1634755500000, window=Some(300000), functionId=Some(Rate), rawSource=true, offsetMs=None)
-----E~MultiSchemaPartitionsExec(dataset=timeseries, shard=0, chunkMethod=TimeRangeChunkScan(1633912200000,1634755500000), filters=List(ColumnFilter(_ws_,Equals(demo)), ColumnFilter(_ns_,Equals(localNs)), ColumnFilter(instance,Equals(Inst-1)), ColumnFilter(_metric_,Equals(foo))), colName=None, schema=None) on ActorPlanDispatcher(Actor[akka://default/system/testProbe-1#5785863],downsample)
---T~AggregateMapReduce(aggrOp=Sum, aggrParams=List(), without=List(), by=List())
----T~PeriodicSamplesMapper(start=1633912500000, step=300000, end=1634755500000, window=Some(300000), functionId=Some(Rate), rawSource=true, offsetMs=None)
-----E~MultiSchemaPartitionsExec(dataset=timeseries, shard=1, chunkMethod=TimeRangeChunkScan(1633912200000,1634755500000), filters=List(ColumnFilter(_ws_,Equals(demo)), ColumnFilter(_ns_,Equals(localNs)), ColumnFilter(instance,Equals(Inst-1)), ColumnFilter(_metric_,Equals(foo))), colName=None, schema=None) on ActorPlanDispatcher(Actor[akka://default/system/testProbe-1#5785863],downsample)
```
@vishramachandran vishramachandran force-pushed the subquery-raw-downsample branch from f037e23 to d42f00d Compare March 25, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant