Skip to content

Commit

Permalink
Optimize coalesce (#508)
Browse files Browse the repository at this point in the history
If coalesce has a single downstream operator, we can skip it
and directly return the downstream.

Signed-off-by: Filip Petkovski <[email protected]>
  • Loading branch information
fpetkovski authored Jan 13, 2025
1 parent 14f9955 commit 1630e99
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions execution/exchange/coalesce.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ type coalesce struct {
}

func NewCoalesce(pool *model.VectorPool, opts *query.Options, batchSize int64, operators ...model.VectorOperator) model.VectorOperator {
if len(operators) == 1 {
return operators[0]
}
oper := &coalesce{
pool: pool,
sampleOffsets: make([]uint64, len(operators)),
Expand Down

0 comments on commit 1630e99

Please sign in to comment.