Skip to content

Commit

Permalink
coldata: fix BenchmarkAppend so that it could be run with multiple count
Browse files Browse the repository at this point in the history
Previously, we could get an index out of bounds because we'd allocate
larger `Bytes.data` slice than `int32` offset can support.

Release note: None
  • Loading branch information
yuzefovich committed Oct 29, 2021
1 parent f279cc9 commit 6670eb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/col/coldata/vec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ func BenchmarkAppend(b *testing.B) {
for _, bc := range benchCases {
bc.args.Src = src
bc.args.SrcEndIdx = coldata.BatchSize()
dest := coldata.NewMemColumn(typ, coldata.BatchSize(), coldata.StandardColumnFactory)
b.Run(fmt.Sprintf("%s/%s/NullProbability=%.1f", typ, bc.name, nullProbability), func(b *testing.B) {
b.SetBytes(8 * int64(coldata.BatchSize()))
bc.args.DestIdx = 0
dest := coldata.NewMemColumn(typ, coldata.BatchSize(), coldata.StandardColumnFactory)
for i := 0; i < b.N; i++ {
dest.Append(bc.args)
bc.args.DestIdx += coldata.BatchSize()
Expand Down

0 comments on commit 6670eb6

Please sign in to comment.