Skip to content

Commit

Permalink
apacheGH-41541: [Go][Parquet] Fix writer performance regression
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroshade committed May 13, 2024
1 parent f6127a6 commit da58368
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/parquet/internal/encoding/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (b *PooledBufferWriter) Reserve(nbytes int) {
b.buf = bufferPool.Get().(*memory.Buffer)
}

newCap := utils.Max(b.buf.Cap()+b.offset, 256)
newCap := utils.Max(b.buf.Cap(), 256)
for newCap < b.pos+nbytes {
newCap = bitutil.NextPowerOf2(newCap)
}
Expand Down
2 changes: 1 addition & 1 deletion go/parquet/internal/utils/bit_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ func NewBitWriter(w WriterAtWithLen) *BitWriter {
func (b *BitWriter) SkipBytes(nbytes int) (int, error) {
b.Flush(true)
ret := b.byteoffset
b.wr.Reserve(nbytes)
b.byteoffset += nbytes
b.wr.Reserve(b.byteoffset)
return ret, nil
}

Expand Down

0 comments on commit da58368

Please sign in to comment.