This repository was archived by the owner on Apr 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ We use the following categories for changes:
19
19
20
20
### Fixed
21
21
- Fix spans with end < start. Start and end are swapped in this case. [ #1096 ]
22
+ - Disable push downs which use ` offset ` , as they are broken [ #1129 ]
22
23
23
24
## [ 0.9.0] - 2022-02-02
24
25
Original file line number Diff line number Diff line change @@ -242,7 +242,25 @@ func canAttemptPushdown(metadata *promqlMetadata) bool {
242
242
path := metadata .path // PromQL AST.
243
243
queryHints := metadata .queryHints
244
244
selectHints := metadata .selectHints
245
- return extension .ExtensionIsInstalled && queryHints != nil && ! hasSubquery (path ) && selectHints != nil
245
+
246
+ switch {
247
+ // We can't push down without hints.
248
+ case queryHints == nil || selectHints == nil :
249
+ return false
250
+ // We can't do pushdowns without the extension.
251
+ case hasSubquery (path ):
252
+ return false
253
+ // We can't handle subqueries in pushdowns.
254
+ case ! extension .ExtensionIsInstalled :
255
+ return false
256
+ default :
257
+ // We can't handle offsets in pushdowns.
258
+ vs , isVectorSelector := queryHints .CurrentNode .(* parser.VectorSelector )
259
+ if isVectorSelector && vs .Offset != 0 {
260
+ return false
261
+ }
262
+ }
263
+ return true
246
264
}
247
265
248
266
// tryPushDown inspects the AST above the current node to determine if it's
Original file line number Diff line number Diff line change @@ -2506,6 +2506,10 @@ func TestPromQLQueryEndpoint(t *testing.T) {
2506
2506
name : "two pushdowns, same metric different matchers" ,
2507
2507
query : `sum(rate(metric_2{foo = "bar"}[5m]))/sum(rate(metric_2[5m]))` ,
2508
2508
},
2509
+ {
2510
+ name : "delta function over range selector with offset" ,
2511
+ query : `delta(metric_2[1m] offset 3m)` ,
2512
+ },
2509
2513
}
2510
2514
start := time .Unix (startTime / 1000 , 0 )
2511
2515
end := time .Unix (endTime / 1000 , 0 )
You can’t perform that action at this time.
0 commit comments