mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
recompute shards for cross-index queries
When computing results on another index, recompute list of shards for that index.
This commit is contained in:
parent
6ad39a376e
commit
26326ac74c
1 changed files with 15 additions and 1 deletions
16
executor.go
16
executor.go
|
|
@ -427,7 +427,7 @@ func (e *executor) execute(ctx context.Context, index string, q *pql.Query, shar
|
|||
// already precomputed by handlePreCallChildren, though,
|
||||
// we don't need this logic in executeCall.
|
||||
if newIndex := call.CallIndex(); newIndex != "" {
|
||||
v, err = e.executeCall(ctx, newIndex, call, shards, opt)
|
||||
v, err = e.executeCall(ctx, newIndex, call, nil, opt)
|
||||
} else {
|
||||
v, err = e.executeCall(ctx, index, call, shards, opt)
|
||||
}
|
||||
|
|
@ -458,6 +458,20 @@ func (e *executor) executeCall(ctx context.Context, index string, c *pql.Call, s
|
|||
e.Holder.Logger.Printf("DEPRECATED: Range() is deprecated, please use Row() instead.")
|
||||
}
|
||||
|
||||
// If shards are specified, then use that value for shards. If shards aren't
|
||||
// specified, then include all of them.
|
||||
if shards == nil && needsShards([]*pql.Call{c}) {
|
||||
// Round up the number of shards.
|
||||
idx := e.Holder.Index(index)
|
||||
if idx == nil {
|
||||
return nil, ErrIndexNotFound
|
||||
}
|
||||
shards = idx.AvailableShards().Slice()
|
||||
if len(shards) == 0 {
|
||||
shards = []uint64{0}
|
||||
}
|
||||
}
|
||||
|
||||
// Special handling for mutation and top-n calls.
|
||||
if op, ok := e.additionalCountOps[c.Name]; ok {
|
||||
e.Holder.Stats.CountWithCustomTags(c.Name, 1, 1.0, []string{indexTag})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue