You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by sb...@apache.org on 2019/04/29 08:11:56 UTC

[arrow] branch master updated: ARROW-5109: [Go] implement reading binary/string arrays from Arrow file

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 79fb767  ARROW-5109: [Go] implement reading binary/string arrays from Arrow file
79fb767 is described below

commit 79fb767d456195b30d18bde92439e1fad0f65d7a
Author: Sebastien Binet <bi...@cern.ch>
AuthorDate: Mon Apr 29 10:11:43 2019 +0200

    ARROW-5109: [Go] implement reading binary/string arrays from Arrow file
    
    Author: Sebastien Binet <bi...@cern.ch>
    
    Closes #4155 from sbinet/issue-5109 and squashes the following commits:
    
    f276be79 <Sebastien Binet> ARROW-5109:  implement reading binary/string arrays from Arrow file
---
 go/arrow/ipc/file_reader.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/go/arrow/ipc/file_reader.go b/go/arrow/ipc/file_reader.go
index 4f8646e..fef552d 100644
--- a/go/arrow/ipc/file_reader.go
+++ b/go/arrow/ipc/file_reader.go
@@ -361,6 +361,9 @@ func (ctx *arrayLoaderContext) loadArray(dt arrow.DataType) array.Interface {
 		*arrow.Float32Type, *arrow.Float64Type:
 		return ctx.loadPrimitive(dt)
 
+	case *arrow.BinaryType, *arrow.StringType:
+		return ctx.loadBinary(dt)
+
 	default:
 		panic(errors.Errorf("array type %T not handled yet", dt))
 	}
@@ -409,6 +412,16 @@ func (ctx *arrayLoaderContext) loadPrimitive(dt arrow.DataType) array.Interface
 	return array.MakeFromData(data)
 }
 
+func (ctx *arrayLoaderContext) loadBinary(dt arrow.DataType) array.Interface {
+	field, buffers := ctx.loadCommon(3)
+	buffers = append(buffers, ctx.buffer(), ctx.buffer())
+
+	data := array.NewData(dt, int(field.Length()), buffers, nil, int(field.NullCount()), 0)
+	defer data.Release()
+
+	return array.MakeFromData(data)
+}
+
 func readDictionary(meta *memory.Buffer, types dictTypeMap, r ReadAtSeeker) (int64, array.Interface, error) {
 	//	msg := flatbuf.GetRootAsMessage(meta.Bytes(), 0)
 	//	var dictBatch flatbuf.DictionaryBatch