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

sbinet 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 828d18e  ARROW-5388: [Go] use arrow.TypeEquals in array.NewChunked
828d18e is described below

commit 828d18ec37873a29fc028a309dd9bb51d56175ef
Author: Sebastien Binet <bi...@cern.ch>
AuthorDate: Tue May 21 17:56:14 2019 +0200

    ARROW-5388: [Go] use arrow.TypeEquals in array.NewChunked
    
    Author: Sebastien Binet <bi...@cern.ch>
    
    Closes #4362 from sbinet/issue-5388 and squashes the following commits:
    
    cb50f872 <Sebastien Binet> ARROW-5388:  use arrow.TypeEquals in 
array.NewChunked
---
 go/arrow/array/table.go      |  2 +-
 go/arrow/array/table_test.go | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/go/arrow/array/table.go b/go/arrow/array/table.go
index 98ef364..ff2c8ba 100644
--- a/go/arrow/array/table.go
+++ b/go/arrow/array/table.go
@@ -117,7 +117,7 @@ func NewChunked(dtype arrow.DataType, chunks []Interface) 
*Chunked {
                dtype:    dtype,
        }
        for i, chunk := range chunks {
-               if chunk.DataType() != dtype {
+               if !arrow.TypeEquals(chunk.DataType(), dtype) {
                        panic("arrow/array: mismatch data type")
                }
                chunk.Retain()
diff --git a/go/arrow/array/table_test.go b/go/arrow/array/table_test.go
index 48f402a..408be8b 100644
--- a/go/arrow/array/table_test.go
+++ b/go/arrow/array/table_test.go
@@ -112,6 +112,28 @@ func TestChunked(t *testing.T) {
        }
 }
 
+func TestChunkedEqualDataType(t *testing.T) {
+       mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
+       defer mem.AssertSize(t, 0)
+
+       lb1 := array.NewListBuilder(mem, arrow.PrimitiveTypes.Int32)
+       defer lb1.Release()
+
+       v1 := lb1.NewArray()
+       defer v1.Release()
+
+       lb2 := array.NewListBuilder(mem, arrow.PrimitiveTypes.Int32)
+       defer lb2.Release()
+
+       v2 := lb2.NewArray()
+       defer v2.Release()
+
+       c1 := array.NewChunked(arrow.ListOf(arrow.PrimitiveTypes.Int32), 
[]array.Interface{
+               v1, v2,
+       })
+       defer c1.Release()
+}
+
 func TestChunkedInvalid(t *testing.T) {
        mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
        defer mem.AssertSize(t, 0)

Reply via email to