Skip to content

Commit 1630e99

Browse files
authored
Optimize coalesce (#508)
If coalesce has a single downstream operator, we can skip it and directly return the downstream. Signed-off-by: Filip Petkovski <[email protected]>
1 parent 14f9955 commit 1630e99

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

execution/exchange/coalesce.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ type coalesce struct {
5353
}
5454

5555
func NewCoalesce(pool *model.VectorPool, opts *query.Options, batchSize int64, operators ...model.VectorOperator) model.VectorOperator {
56+
if len(operators) == 1 {
57+
return operators[0]
58+
}
5659
oper := &coalesce{
5760
pool: pool,
5861
sampleOffsets: make([]uint64, len(operators)),

0 commit comments

Comments
 (0)