This is an automated email from the ASF dual-hosted git repository.
yibocai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 09e4a5e ARROW-15467: [Go][Parquet] Fix pqarrow decimal tests on s390x
09e4a5e is described below
commit 09e4a5e04c9e39169b5264e0aa98a5cf0945ecba
Author: Matthew Topol <[email protected]>
AuthorDate: Thu Jan 27 13:10:13 2022 +0000
ARROW-15467: [Go][Parquet] Fix pqarrow decimal tests on s390x
Closes #12272 from zeroshade/arrow-15467-s390x-tests
Authored-by: Matthew Topol <[email protected]>
Signed-off-by: Yibo Cai <[email protected]>
---
go/parquet/internal/testutils/random.go | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/go/parquet/internal/testutils/random.go
b/go/parquet/internal/testutils/random.go
index 9d41863..1c6cf6e 100644
--- a/go/parquet/internal/testutils/random.go
+++ b/go/parquet/internal/testutils/random.go
@@ -19,6 +19,7 @@
package testutils
import (
+ "encoding/binary"
"math"
"time"
"unsafe"
@@ -26,6 +27,7 @@ import (
"github.com/apache/arrow/go/v7/arrow"
"github.com/apache/arrow/go/v7/arrow/array"
"github.com/apache/arrow/go/v7/arrow/bitutil"
+ "github.com/apache/arrow/go/v7/arrow/endian"
"github.com/apache/arrow/go/v7/arrow/memory"
"github.com/apache/arrow/go/v7/parquet"
"github.com/apache/arrow/go/v7/parquet/pqarrow"
@@ -448,6 +450,14 @@ func RandomDecimals(n int64, seed uint64, precision int32)
[]byte {
if out[start+int(nreqBytes)-1]&byte(0x80) != 0 {
memory.Set(out[start+int(nreqBytes):start+byteWidth],
0xFF)
}
+
+ // byte swap for big endian
+ if endian.IsBigEndian {
+ for j := 0; j+8 <= byteWidth; j += 8 {
+ v := binary.LittleEndian.Uint64(out[start+j :
start+j+8])
+
binary.BigEndian.PutUint64(out[start+j:start+j+8], v)
+ }
+ }
}
return out
}