Skip to content

Commit 79fb767

Browse files
committed
ARROW-5109: [Go] implement reading binary/string arrays from Arrow file
Author: Sebastien Binet <binet@cern.ch> Closes #4155 from sbinet/issue-5109 and squashes the following commits: f276be7 <Sebastien Binet> ARROW-5109: implement reading binary/string arrays from Arrow file
1 parent 6106ac9 commit 79fb767

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

go/arrow/ipc/file_reader.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ func (ctx *arrayLoaderContext) loadArray(dt arrow.DataType) array.Interface {
361361
*arrow.Float32Type, *arrow.Float64Type:
362362
return ctx.loadPrimitive(dt)
363363

364+
case *arrow.BinaryType, *arrow.StringType:
365+
return ctx.loadBinary(dt)
366+
364367
default:
365368
panic(errors.Errorf("array type %T not handled yet", dt))
366369
}
@@ -409,6 +412,16 @@ func (ctx *arrayLoaderContext) loadPrimitive(dt arrow.DataType) array.Interface
409412
return array.MakeFromData(data)
410413
}
411414

415+
func (ctx *arrayLoaderContext) loadBinary(dt arrow.DataType) array.Interface {
416+
field, buffers := ctx.loadCommon(3)
417+
buffers = append(buffers, ctx.buffer(), ctx.buffer())
418+
419+
data := array.NewData(dt, int(field.Length()), buffers, nil, int(field.NullCount()), 0)
420+
defer data.Release()
421+
422+
return array.MakeFromData(data)
423+
}
424+
412425
func readDictionary(meta *memory.Buffer, types dictTypeMap, r ReadAtSeeker) (int64, array.Interface, error) {
413426
// msg := flatbuf.GetRootAsMessage(meta.Bytes(), 0)
414427
// var dictBatch flatbuf.DictionaryBatch

0 commit comments

Comments
 (0)