Documentation

Overview

    Package rarrow handles conversion between ROOT and ARROW data models.

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func NewFlatTreeWriter

    func NewFlatTreeWriter(dir riofs.Directory, name string, schema *arrow.Schema, opts ...rtree.WriteOption) (*flatTreeWriter, error)

      NewFlatTreeWriter creates an arrio.Writer that writes ARROW data as a ROOT flat-tree under the provided dir directory.

      func NewTable

      func NewTable(t rtree.Tree, opts ...Option) array.Table

        NewTable creates a new in-memory Arrow Table from the provided ROOT Tree.

        func SchemaFrom

        func SchemaFrom(t rtree.Tree) *arrow.Schema

          SchemaFrom returns an Arrow schema from the provided ROOT tree.

          Types

          type Option

          type Option func(*config)

            Option allows to configure how Records and Tables are constructed from input ROOT Trees.

            func WithAllocator

            func WithAllocator(mem memory.Allocator) Option

              WithAllocator configures an Arrow value to use the specified memory allocator instead of the default Go one.

              func WithChunk

              func WithChunk(nentries int64) Option

                WithChunk specifies the number of entries to populate Records with.

                The default is to populate Records with the whole set of entries the input ROOT Tree contains.

                func WithEnd

                func WithEnd(entry int64) Option

                  WithEnd specifies the last entry (excluded) to read from the input ROOT Tree.

                  The default (-1) is to read all the entries of the input ROOT Tree.

                  func WithStart

                  func WithStart(entry int64) Option

                    WithStart specifies the first entry to read from the input ROOT Tree.

                    type Record

                    type Record struct {
                    	// contains filtered or unexported fields
                    }

                      Record is an in-memory Arrow Record backed by a ROOT Tree.

                      func NewRecord

                      func NewRecord(t rtree.Tree, opts ...Option) *Record

                        NewRecord creates a new in-memory Arrow Record from the provided ROOT Tree.

                        func (*Record) Column

                        func (rec *Record) Column(i int) array.Interface

                        func (*Record) ColumnName

                        func (rec *Record) ColumnName(i int) string

                        func (*Record) Columns

                        func (rec *Record) Columns() []array.Interface

                        func (*Record) NewSlice

                        func (rec *Record) NewSlice(i, j int64) array.Record

                          NewSlice constructs a zero-copy slice of the record with the indicated indices i and j, corresponding to array[i:j]. The returned record must be Release()'d after use.

                          NewSlice panics if the slice is outside the valid range of the record array. NewSlice panics if j < i.

                          func (*Record) NumCols

                          func (rec *Record) NumCols() int64

                          func (*Record) NumRows

                          func (rec *Record) NumRows() int64

                          func (*Record) Release

                          func (rec *Record) Release()

                            Release decreases the reference count by 1. When the reference count goes to zero, the memory is freed. Release may be called simultaneously from multiple goroutines.

                            func (*Record) Retain

                            func (rec *Record) Retain()

                              Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

                              func (*Record) Schema

                              func (rec *Record) Schema() *arrow.Schema

                              type RecordReader

                              type RecordReader struct {
                              	// contains filtered or unexported fields
                              }

                                RecordReader is an ARROW RecordReader for ROOT Trees.

                                RecordReader does not materialize more than one record at a time. The number of rows (or entries, in ROOT speak) that record loads can be configured at creation time with the WithChunk function. The default is one entry per record. One can pass -1 to WithChunk to create a record with all entries of the Tree or Chain.

                                Example
                                Output:
                                
                                rec[0][one]: [1]
                                rec[0][two]: [1.1]
                                rec[0][three]: ["uno"]
                                rec[1][one]: [2]
                                rec[1][two]: [2.2]
                                rec[1][three]: ["dos"]
                                rec[2][one]: [3]
                                rec[2][two]: [3.3]
                                rec[2][three]: ["tres"]
                                rec[3][one]: [4]
                                rec[3][two]: [4.4]
                                rec[3][three]: ["quatro"]
                                
                                Example (AllTree)
                                Output:
                                
                                rec[0][one]: [1 2 3 4]
                                rec[0][two]: [1.1 2.2 3.3 4.4]
                                rec[0][three]: ["uno" "dos" "tres" "quatro"]
                                
                                Example (WithChain)
                                Output:
                                
                                rec[0][evt]: {["beg-010"] [10] [[10 10 10 10 10 10 10 10 10 10]] [0] [[]] ["std-010"] [[]] [[]] ["end-010"]}
                                rec[1][evt]: {["beg-011"] [11] [[11 11 11 11 11 11 11 11 11 11]] [1] [[11]] ["std-011"] [[11]] [["vec-011"]] ["end-011"]}
                                rec[2][evt]: {["beg-012"] [12] [[12 12 12 12 12 12 12 12 12 12]] [2] [[12 12]] ["std-012"] [[12 12]] [["vec-012" "vec-012"]] ["end-012"]}
                                rec[3][evt]: {["beg-013"] [13] [[13 13 13 13 13 13 13 13 13 13]] [3] [[13 13 13]] ["std-013"] [[13 13 13]] [["vec-013" "vec-013" "vec-013"]] ["end-013"]}
                                rec[4][evt]: {["beg-014"] [14] [[14 14 14 14 14 14 14 14 14 14]] [4] [[14 14 14 14]] ["std-014"] [[14 14 14 14]] [["vec-014" "vec-014" "vec-014" "vec-014"]] ["end-014"]}
                                rec[5][evt]: {["beg-015"] [15] [[15 15 15 15 15 15 15 15 15 15]] [5] [[15 15 15 15 15]] ["std-015"] [[15 15 15 15 15]] [["vec-015" "vec-015" "vec-015" "vec-015" "vec-015"]] ["end-015"]}
                                rec[6][evt]: {["beg-016"] [16] [[16 16 16 16 16 16 16 16 16 16]] [6] [[16 16 16 16 16 16]] ["std-016"] [[16 16 16 16 16 16]] [["vec-016" "vec-016" "vec-016" "vec-016" "vec-016" "vec-016"]] ["end-016"]}
                                rec[7][evt]: {["beg-017"] [17] [[17 17 17 17 17 17 17 17 17 17]] [7] [[17 17 17 17 17 17 17]] ["std-017"] [[17 17 17 17 17 17 17]] [["vec-017" "vec-017" "vec-017" "vec-017" "vec-017" "vec-017" "vec-017"]] ["end-017"]}
                                rec[8][evt]: {["beg-018"] [18] [[18 18 18 18 18 18 18 18 18 18]] [8] [[18 18 18 18 18 18 18 18]] ["std-018"] [[18 18 18 18 18 18 18 18]] [["vec-018" "vec-018" "vec-018" "vec-018" "vec-018" "vec-018" "vec-018" "vec-018"]] ["end-018"]}
                                rec[9][evt]: {["beg-019"] [19] [[19 19 19 19 19 19 19 19 19 19]] [9] [[19 19 19 19 19 19 19 19 19]] ["std-019"] [[19 19 19 19 19 19 19 19 19]] [["vec-019" "vec-019" "vec-019" "vec-019" "vec-019" "vec-019" "vec-019" "vec-019" "vec-019"]] ["end-019"]}
                                
                                Example (WithChunk)
                                Output:
                                
                                rec[0][one]: [1 2 3]
                                rec[0][two]: [1.1 2.2 3.3]
                                rec[0][three]: ["uno" "dos" "tres"]
                                rec[1][one]: [4]
                                rec[1][two]: [4.4]
                                rec[1][three]: ["quatro"]
                                
                                Example (WithEnd)
                                Output:
                                
                                rec[0][one]: [1]
                                rec[0][two]: [1.1]
                                rec[0][three]: ["uno"]
                                rec[1][one]: [2]
                                rec[1][two]: [2.2]
                                rec[1][three]: ["dos"]
                                
                                Example (WithStart)
                                Output:
                                
                                rec[0][one]: [2]
                                rec[0][two]: [2.2]
                                rec[0][three]: ["dos"]
                                rec[1][one]: [3]
                                rec[1][two]: [3.3]
                                rec[1][three]: ["tres"]
                                rec[2][one]: [4]
                                rec[2][two]: [4.4]
                                rec[2][three]: ["quatro"]
                                
                                Example (WithStartEnd)
                                Output:
                                
                                rec[0][one]: [2]
                                rec[0][two]: [2.2]
                                rec[0][three]: ["dos"]
                                

                                func NewRecordReader

                                func NewRecordReader(tree rtree.Tree, opts ...Option) *RecordReader

                                  NewRecordReader creates a new ARROW RecordReader from the provided ROOT Tree.

                                  func (*RecordReader) Next

                                  func (r *RecordReader) Next() bool

                                  func (*RecordReader) Record

                                  func (r *RecordReader) Record() array.Record

                                  func (*RecordReader) Release

                                  func (r *RecordReader) Release()

                                    Release decreases the reference count by 1. When the reference count goes to zero, the memory is freed. Release may be called simultaneously from multiple goroutines.

                                    func (*RecordReader) Retain

                                    func (r *RecordReader) Retain()

                                      Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

                                      func (*RecordReader) Schema

                                      func (r *RecordReader) Schema() *arrow.Schema