Skip to content

Commit db5b848

Browse files
Matthew Topolemkornfield
authored andcommitted
ARROW-13979: [Go] Enable -race for go tests
the change is trivial in just adding the argument in the `go_test.sh` file, and ended up finding an issue in the parquet encoding and a slight change in how the bit set run tests used the testify suite. Closes apache#11140 from zeroshade/test-race Authored-by: Matthew Topol <mtopol@factset.com> Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
1 parent bae7e2b commit db5b848

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

ci/scripts/go_test.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,26 @@ set -ex
2121

2222
source_dir=${1}/go
2323

24+
testargs="-race"
25+
case "$(uname)" in
26+
MINGW*)
27+
# -race doesn't work on windows currently
28+
testargs=""
29+
;;
30+
esac
31+
2432
pushd ${source_dir}/arrow
2533

2634
for d in $(go list ./... | grep -v vendor); do
27-
go test $d
35+
go test $testargs -tags "test" $d
2836
done
2937

3038
popd
3139

3240
pushd ${source_dir}/parquet
3341

3442
for d in $(go list ./... | grep -v vendor); do
35-
go test $d
43+
go test $testargs $d
3644
done
3745

3846
popd

go/parquet/internal/hashing/xxh3_memo_table.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ func (BinaryMemoTable) valAsByteSlice(val interface{}) []byte {
192192
case parquet.FixedLenByteArray:
193193
return *(*[]byte)(unsafe.Pointer(&v))
194194
case string:
195-
return (*(*[]byte)(unsafe.Pointer(&v)))[:len(v):len(v)]
195+
var out []byte
196+
h := (*reflect.StringHeader)(unsafe.Pointer(&v))
197+
s := (*reflect.SliceHeader)(unsafe.Pointer(&out))
198+
s.Data = h.Data
199+
s.Len = h.Len
200+
s.Cap = h.Len
201+
return out
196202
default:
197203
panic("invalid type for binarymemotable")
198204
}

go/parquet/internal/utils/bit_set_run_reader_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ func TestBitSetRunReader(t *testing.T) {
9494

9595
func (br *BitSetRunReaderSuite) SetupSuite() {
9696
br.testOffsets = []int64{0, 1, 6, 7, 8, 33, 63, 64, 65, 71}
97-
}
98-
99-
func (br *BitSetRunReaderSuite) SetupTest() {
10097
br.T().Parallel()
10198
}
10299

0 commit comments

Comments
 (0)