@@ -364,6 +364,9 @@ func (ctx *arrayLoaderContext) loadArray(dt arrow.DataType) array.Interface {
364364 case * arrow.BinaryType , * arrow.StringType :
365365 return ctx .loadBinary (dt )
366366
367+ case * arrow.ListType :
368+ return ctx .loadList (dt )
369+
367370 default :
368371 panic (errors .Errorf ("array type %T not handled yet" , dt ))
369372 }
@@ -385,6 +388,16 @@ func (ctx *arrayLoaderContext) loadCommon(nbufs int) (*flatbuf.FieldNode, []*mem
385388 return field , buffers
386389}
387390
391+ func (ctx * arrayLoaderContext ) loadChild (dt arrow.DataType ) array.Interface {
392+ if ctx .max == 0 {
393+ panic ("arrow/ipc: nested type limit reached" )
394+ }
395+ ctx .max --
396+ sub := ctx .loadArray (dt )
397+ ctx .max ++
398+ return sub
399+ }
400+
388401func (ctx * arrayLoaderContext ) loadNull () array.Interface {
389402 field , buffers := ctx .loadCommon (1 )
390403 buffers = append (buffers , ctx .buffer ())
@@ -422,6 +435,19 @@ func (ctx *arrayLoaderContext) loadBinary(dt arrow.DataType) array.Interface {
422435 return array .MakeFromData (data )
423436}
424437
438+ func (ctx * arrayLoaderContext ) loadList (dt * arrow.ListType ) array.Interface {
439+ field , buffers := ctx .loadCommon (2 )
440+ buffers = append (buffers , ctx .buffer ())
441+
442+ sub := ctx .loadChild (dt .Elem ())
443+ defer sub .Release ()
444+
445+ data := array .NewData (dt , int (field .Length ()), buffers , []* array.Data {sub .Data ()}, int (field .NullCount ()), 0 )
446+ defer data .Release ()
447+
448+ return array .NewListData (data )
449+ }
450+
425451func readDictionary (meta * memory.Buffer , types dictTypeMap , r ReadAtSeeker ) (int64 , array.Interface , error ) {
426452 // msg := flatbuf.GetRootAsMessage(meta.Bytes(), 0)
427453 // var dictBatch flatbuf.DictionaryBatch
0 commit comments