Skip to content

Commit

Permalink
Handle out of bounds exception in binary operator (#78)
Browse files Browse the repository at this point in the history
The vector-to-vector binary operator can throw a panic when the
right-hand-side vector is smaller than the left-hand-side vector.

This commit fixes that issue by adding an explicit check for the
length of the right-hand-side vector.
  • Loading branch information
fpetkovski authored Oct 12, 2022
1 parent 453ee72 commit 700c5ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions physicalplan/binary/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ func (o *vectorOperator) Next(ctx context.Context) ([]model.StepVector, error) {

batch := o.pool.GetVectorBatch()
for i, vector := range lhs {
step := o.table.execBinaryOperation(lhs[i], rhs[i])
batch = append(batch, step)
o.lhs.GetPool().PutStepVector(vector)
if i < len(rhs) {
step := o.table.execBinaryOperation(lhs[i], rhs[i])
batch = append(batch, step)
o.rhs.GetPool().PutStepVector(rhs[i])
}
o.lhs.GetPool().PutStepVector(vector)
}
o.lhs.GetPool().PutVectors(lhs)
o.rhs.GetPool().PutVectors(rhs)
Expand Down

0 comments on commit 700c5ba

Please sign in to comment.