From 8edfb46a866f645e74a119185886c0d1c4759aba Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Thu, 12 Sep 2024 12:38:57 -0400 Subject: [PATCH] fix inconsistency when using noasm tag --- go/parquet/internal/utils/bit_packing_avx2_amd64.go | 5 ++--- go/parquet/internal/utils/bit_packing_neon_arm64.go | 5 ++--- go/parquet/pqarrow/file_reader_test.go | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go/parquet/internal/utils/bit_packing_avx2_amd64.go b/go/parquet/internal/utils/bit_packing_avx2_amd64.go index 0455ccc505bfe..5f1923fac2f9f 100644 --- a/go/parquet/internal/utils/bit_packing_avx2_amd64.go +++ b/go/parquet/internal/utils/bit_packing_avx2_amd64.go @@ -33,12 +33,11 @@ func _unpack32_avx2(in, out unsafe.Pointer, batchSize, nbits int) (num int) func unpack32Avx2(in io.Reader, out []uint32, nbits int) int { batch := len(out) / 32 * 32 - if batch <= 0 { + n := batch * nbits / 8 + if n <= 0 { return 0 } - n := batch * nbits / 8 - buffer := bufferPool.Get().(*bytes.Buffer) defer bufferPool.Put(buffer) buffer.Reset() diff --git a/go/parquet/internal/utils/bit_packing_neon_arm64.go b/go/parquet/internal/utils/bit_packing_neon_arm64.go index 09154e3e4b7dd..580f9a1f27e4c 100755 --- a/go/parquet/internal/utils/bit_packing_neon_arm64.go +++ b/go/parquet/internal/utils/bit_packing_neon_arm64.go @@ -33,12 +33,11 @@ func _unpack32_neon(in, out unsafe.Pointer, batchSize, nbits int) (num int) func unpack32NEON(in io.Reader, out []uint32, nbits int) int { batch := len(out) / 32 * 32 - if batch <= 0 { + n := batch * nbits / 8 + if n <= 0 { return 0 } - n := batch * nbits / 8 - buffer := bufferPool.Get().(*bytes.Buffer) defer bufferPool.Put(buffer) buffer.Reset() diff --git a/go/parquet/pqarrow/file_reader_test.go b/go/parquet/pqarrow/file_reader_test.go index 0e60758911623..f2ad14859c7a3 100644 --- a/go/parquet/pqarrow/file_reader_test.go +++ b/go/parquet/pqarrow/file_reader_test.go @@ -405,6 +405,5 @@ func TestReadParquetFile(t *testing.T) { require.NoError(t, err) _, err = arrowRdr.ReadTable(ctx) - - assert.Error(t, err) + assert.NoError(t, err) }