[DQE-1] Core Planning#7688
Open
eeldaly wants to merge 1 commit into
Open
Conversation
46be59b to
b38e49a
Compare
…hard-count flag Add the core building blocks for distributed query execution (fragment_metadata, deduplicate_node/ShardedRemoteExecutions, distributed_optimizer, codec) and the QFE-level -querier.distributed-exec-shard-count flag that drives how many shards the optimizer fans a shardable aggregation into (0 disables it). Signed-off-by: Essam Eldaly <eeldaly@amazon.com>
b38e49a to
236eb67
Compare
harry671003
reviewed
Jul 14, 2026
| // port notes): the node has no JSON (un)marshaling for codec round-tripping, | ||
| // and the shard matcher injected by the optimizer does not match the merged | ||
| // metric-name-hash storage sharding mechanism. | ||
| type ShardedRemoteExecutions struct { |
Contributor
There was a problem hiding this comment.
Do we need a separate node for this?
I'd expect sum(metric) etc to be optimized into:
sum(
coalesce(
sum(metric{shard0}),
sum(metric{shard1}),
)
)
| subqueries := newRemoteAggregation(aggr, shardCount) | ||
| *current = &logicalplan.Aggregation{ | ||
| Op: parser.SUM, | ||
| Expr: &ShardedRemoteExecutions{Expressions: subqueries}, |
Contributor
There was a problem hiding this comment.
Seems the Thanos PromQL engine already is doing things a bit differently
| logicalplan.TraverseBottomUp(nil, &root, func(parent, current *logicalplan.Node) bool { | ||
| if (*current).Type() == logicalplan.VectorSelectorNode { | ||
| cur := (*current).(*logicalplan.VectorSelector) | ||
| cur.LabelMatchers = append(cur.LabelMatchers, labels.MustNewMatcher(labels.MatchEqual, "__cortex_ingester_shard__", fmt.Sprintf("%d_%d", shardCount, shardIdx))) |
Contributor
There was a problem hiding this comment.
nit; cortex_ingester_shard should be named to be more generic. This applies to both ingester/store-gateway paths
| // fragment into the context. This metadata is propagated from the query-scheduler to | ||
| // the querier so that the querier knows which fragment it is executing, where to pull | ||
| // its child fragments' results from, and whether it is the root (coordinator) fragment. | ||
| func InjectFragmentMetaData(ctx context.Context, fragmentID uint64, queryID uint64, isRoot bool, childIDToAddr map[uint64]string) context.Context { |
Contributor
There was a problem hiding this comment.
Is context the right place to put this? I'd like to understand the usecase better.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is part 1 of 6 to get the changes made here by Ruby (https://github.com/rubywtl/cortex/commits?author=rubywtl) upstreamed and working for the distributed query engine path.
Add the core building blocks for distributed query execution (fragment_metadata, deduplicate_node/ShardedRemoteExecutions, distributed_optimizer, codec) and the QFE-level -querier.distributed-exec-shard-count flag that drives how many shards the optimizer fans a shardable aggregation into (0 disables it).
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]docs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flags