Skip to content

Commit 1af4ee9

Browse files
committed
[Go][Parquet] unpack32Avx2 returns 0 if n is equal to 0
1 parent 8e034c7 commit 1af4ee9

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

go/parquet/internal/utils/bit_packing_avx2_amd64.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func unpack32Avx2(in io.Reader, out []uint32, nbits int) int {
3939

4040
n := batch * nbits / 8
4141

42+
if n == 0 {
43+
return 0
44+
}
45+
4246
buffer := bufferPool.Get().(*bytes.Buffer)
4347
defer bufferPool.Put(buffer)
4448
buffer.Reset()

go/parquet/pqarrow/file_reader_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,28 @@ func TestReadParquetFile(t *testing.T) {
401401
}()
402402

403403
arrowRdr, err := pqarrow.NewFileReader(rdr, pqarrow.ArrowReadProperties{
404-
Parallel: false,
404+
Parallel: true,
405405
BatchSize: 0,
406406
}, mem)
407407
if err != nil {
408408
t.Errorf("unexpected error: %v", err)
409409
}
410410

411-
_, err = arrowRdr.ReadTable(ctx)
411+
table, err := arrowRdr.ReadTable(ctx)
412+
defer table.Release()
412413

413-
if err == nil {
414-
t.Errorf("expected error: %v", err)
414+
if err != nil {
415+
t.Errorf("unexpected error: %v", err)
416+
}
417+
418+
assert.Equal(t, table.NumCols(), int64(1))
419+
assert.Equal(t, table.NumRows(), int64(21186))
420+
421+
for i := 0; i < int(table.NumCols()); i++ {
422+
col := table.Column(i)
423+
assert.Equal(t, col.Len(), int(table.NumRows()))
424+
for j := 0; j < col.Len(); j++ {
425+
assert.Equal(t, col.Data().Chunk(0).(*array.Uint16).Value(j), uint16(0))
426+
}
415427
}
416428
}

0 commit comments

Comments
 (0)