-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logical planer and select caching (#79)
* Add logical planer and select caching This commit adds the first version of a logical planner with the capability to unify matchers between different selectors. The MergeSelectsOptimizer traverses the AST and identifies the most selective matcher for each individual metric. It then replaces less selective matchers with the most selective one, and adds an additional filters to ensure correctness. The physical plan can then cache results for identical selectors which leads to fewer network calls and faster series retrieval operations. Co-authored-by: Bartlomiej Plotka <[email protected]>
- Loading branch information
1 parent
8ba4fe1
commit 67a4593
Showing
17 changed files
with
885 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) The Thanos Community Authors. | ||
// Licensed under the Apache License 2.0. | ||
|
||
package logicalplan | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/prometheus/prometheus/model/labels" | ||
"github.com/prometheus/prometheus/promql/parser" | ||
) | ||
|
||
type FilteredSelector struct { | ||
*parser.VectorSelector | ||
Filters []*labels.Matcher | ||
} | ||
|
||
func (f FilteredSelector) String() string { | ||
return fmt.Sprintf("filter(%s, %s)", f.Filters, f.VectorSelector.String()) | ||
} | ||
|
||
func (f FilteredSelector) Pretty(level int) string { return f.String() } | ||
|
||
func (f FilteredSelector) PositionRange() parser.PositionRange { return parser.PositionRange{} } | ||
|
||
func (f FilteredSelector) Type() parser.ValueType { return parser.ValueTypeVector } | ||
|
||
func (f FilteredSelector) PromQLExpr() {} |
Oops, something went wrong.