-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sharding optimizations I: AST mapping #1846
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e4fe8a1
[wip] sharding evaluator/ast
owen-d 1471d0a
[wip] continues experimenting with ast mapping
owen-d 8260bc3
refactoring in preparation for binops
owen-d b71472b
evaluators can pass state to other evaluators
owen-d 5425630
compiler alignment
owen-d 632aecf
Evaluator method renamed to StepEvaluator
owen-d ec6ff83
chained evaluator impl
owen-d e15ed28
tidying up sharding code
owen-d 2565ca6
handling for ConcatSampleExpr
owen-d 52e1cfa
downstream iterator
owen-d ff55f63
structure for downstreaming asts
owen-d df5a69a
outlines sharding optimizations
owen-d ec050ac
work on sharding mapper
owen-d ff1ca2b
ast sharding optimizations
owen-d 6a3e860
test for different logrange positions
owen-d 2657ab0
shard mapper tests
owen-d 84d64b9
stronger ast sharding & tests
owen-d 0f234cf
shardmapper tests for string->string
owen-d 3743f37
removes sharding evaluator code
owen-d 5356361
removes unused ctx arg
owen-d eee8798
Update pkg/logql/evaluator.go
owen-d File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package logql | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
// ASTMapper is the exported interface for mapping between multiple AST representations | ||
type ASTMapper interface { | ||
Map(Expr) (Expr, error) | ||
} | ||
|
||
// CloneExpr is a helper function to clone a node. | ||
func CloneExpr(expr Expr) (Expr, error) { | ||
return ParseExpr(expr.String()) | ||
} | ||
|
||
func badASTMapping(expected string, got Expr) error { | ||
return fmt.Errorf("Bad AST mapping: expected one type (%s), but got (%T)", expected, got) | ||
} | ||
|
||
// MapperUnsuportedType is a helper for signaling that an evaluator does not support an Expr type | ||
func MapperUnsupportedType(expr Expr, m ASTMapper) error { | ||
return errors.Errorf("unexpected expr type (%T) for ASTMapper type (%T) ", expr, m) | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love those changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if evaluator is big enough to become a package. Just a thought, not action required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it's a good idea, let's see where everything settles and then do some refactoring