filodb / FiloDB

Distributed Prometheus time series database
Apache License 2.0
1.43k stars 225 forks source link

fix(query) extend @modifier to longtime and multi-partition queries. #1837

Open yu-shipit opened 2 months ago

yu-shipit commented 2 months ago

Pull Request checklist

Current behavior : @modidier does not work for multi-partition and longtime planner

New behavior : @modidier supports for multi-partition and longtime planner Consider a query like (foo @end()) unless last_over_time(foo[1h]) The previous plan would be like

-StitchExec
--Unless
---foo@end()  @P1-downsample. // do not have the data
---last_over_time(foo[1h])   @P1-downsample
--Unless
---foo@end()  @P1-raw
---last_over_time(foo[1h])    @P1-raw
--Unless
---foo@end()  @P2-raw

The new plan would be like

-Unless
--RepeatedTransformer
---foo@end()  @P2-raw
-StitchExec
---last_over_time(foo[1h])   @P1-downsample
---last_over_time(foo[1h])    @P1-raw
---last_over_time(foo[1h])    @P2-raw

Caveat! Window that spans multi-clusters may not work. For example, these may not work.

last_over_time(foo[7d])
(foo @end()) unless last_over_time(foo[7d])

BREAKING CHANGES

If this PR contains a breaking change, please describe the impact and migration path for existing applications. If not please remove this section.

Breaking changes may include:

Other information: