From 234c2dbb19d66064bf8c834a2c3b369edb7d6227 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Thu, 25 May 2023 12:22:12 -0400 Subject: [PATCH] GH-34784: [Go] Fix 32-bit build --- go/arrow/cdata/cdata.go | 15 +++++++-------- go/arrow/compute/internal/exec/utils.go | 10 +++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/go/arrow/cdata/cdata.go b/go/arrow/cdata/cdata.go index c62940d8599a4..638d39b02e258 100644 --- a/go/arrow/cdata/cdata.go +++ b/go/arrow/cdata/cdata.go @@ -100,12 +100,12 @@ var formatToSimpleType = map[string]arrow.DataType{ // decode metadata from C which is encoded as // -// [int32] -> number of metadata pairs -// for 0..n -// [int32] -> number of bytes in key -// [n bytes] -> key value -// [int32] -> number of bytes in value -// [n bytes] -> value +// [int32] -> number of metadata pairs +// for 0..n +// [int32] -> number of bytes in key +// [n bytes] -> key value +// [int32] -> number of bytes in value +// [n bytes] -> value func decodeCMetadata(md *C.char) arrow.Metadata { if md == nil { return arrow.Metadata{} @@ -413,8 +413,7 @@ func (imp *cimporter) doImport(src *CArrowArray) error { if imp.arr.n_buffers > 0 { // get a view of the buffers, zero-copy. we're just looking at the pointers - const maxlen = 0x7fffffff - imp.cbuffers = (*[maxlen]*C.void)(unsafe.Pointer(imp.arr.buffers))[:imp.arr.n_buffers:imp.arr.n_buffers] + imp.cbuffers = unsafe.Slice((**C.void)(unsafe.Pointer(imp.arr.buffers)), imp.arr.n_buffers) } // handle each of our type cases diff --git a/go/arrow/compute/internal/exec/utils.go b/go/arrow/compute/internal/exec/utils.go index 21a4eaf61d09d..39c4fff90920e 100644 --- a/go/arrow/compute/internal/exec/utils.go +++ b/go/arrow/compute/internal/exec/utils.go @@ -239,21 +239,21 @@ func RechunkArraysConsistently(groups [][]arrow.Array) [][]arrow.Array { } rechunked := make([][]arrow.Array, len(groups)) - offsets := make([]int, len(groups)) + offsets := make([]int64, len(groups)) // scan all array vectors at once, rechunking along the way var start int64 for start < int64(totalLen) { // first compute max possible length for next chunk - chunkLength := math.MaxInt64 + var chunkLength int64 = math.MaxInt64 for i, g := range groups { offset := offsets[i] // skip any done arrays including 0-length - for offset == g[0].Len() { + for offset == int64(g[0].Len()) { g = g[1:] offset = 0 } arr := g[0] - chunkLength = Min(chunkLength, arr.Len()-offset) + chunkLength = Min(chunkLength, int64(arr.Len())-offset) offsets[i] = offset groups[i] = g @@ -263,7 +263,7 @@ func RechunkArraysConsistently(groups [][]arrow.Array) [][]arrow.Array { for i, g := range groups { offset := offsets[i] arr := g[0] - if offset == 0 && arr.Len() == chunkLength { + if offset == 0 && int64(arr.Len()) == chunkLength { // slice spans entire array arr.Retain() rechunked[i] = append(rechunked[i], arr)