You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ze...@apache.org on 2023/04/17 14:20:12 UTC

[arrow] branch main updated: GH-35133: [Go] fix for `math.MaxUint32 overflows int` error in 32-bit arch (#35159)

This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new becfaf31b3 GH-35133: [Go] fix for `math.MaxUint32 overflows int` error in 32-bit arch (#35159)
becfaf31b3 is described below

commit becfaf31b31146031050d023216807d116b9cbcd
Author: sunpeng <su...@gmail.com>
AuthorDate: Mon Apr 17 22:20:00 2023 +0800

    GH-35133: [Go] fix for `math.MaxUint32 overflows int` error in 32-bit arch (#35159)
    
    
    
    ### Rationale for this change
    
    When compiling on i386 arch, an error like `math.MaxUint32 (untyped int constant 4294967295) overflows int` will appear. The Int type is 32-bit and in 32-bit arch it overflows. In my PR, I cast `int` to `unint` to avoid this error.
    
    * Closes: #35133
    
    Authored-by: sunpeng <su...@gmail.com>
    Signed-off-by: Matt Topol <zo...@gmail.com>
---
 go/arrow/array/dictionary.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/go/arrow/array/dictionary.go b/go/arrow/array/dictionary.go
index b84ac75404..6ecda0b966 100644
--- a/go/arrow/array/dictionary.go
+++ b/go/arrow/array/dictionary.go
@@ -1561,7 +1561,7 @@ func (u *unifier) GetResultWithIndexType(indexType arrow.DataType) (arrow.Array,
 	case arrow.INT16:
 		toobig = dictLen > math.MaxInt16
 	case arrow.UINT32:
-		toobig = dictLen > math.MaxUint32
+		toobig = uint(dictLen) > math.MaxUint32
 	case arrow.INT32:
 		toobig = dictLen > math.MaxInt32
 	case arrow.UINT64: