Home | News | Documentation | Download

Root2arrow: converting ROOT TTrees to Arrow Records

hi there,

just a quick announcement that as of v0.19.0, GoHEP can now convert ROOT TTrees to Arrow Records (and store them into an Arrow File or an Arrow Stream) via the root2arrow command:

$> go doc go-hep.org/x/hep/cmd/root2arrow
root2arrow converts the content of a ROOT TTree to an ARROW file.

    Usage of root2arrow:
      -o string
        	path to output ARROW file name (default "output.data")
      -stream
        	enable ARROW stream (default is to create an ARROW file)
      -t string
        	name of the tree to convert (default "tree")

    $> root2arrow -o foo.data -t tree ../../groot/testdata/simple.root
    $> arrow-ls ./foo.data
    version: V4
    schema:
      fields: 3
        - one: type=int32
        - two: type=float32
        - three: type=utf8
    records: 1
    $> arrow-cat ./foo.data
    version: V4
    record 1/1...
      col[0] "one": [1 2 3 4]
      col[1] "two": [1.1 2.2 3.3 4.4]
      col[2] "three": ["uno" "dos" "tres" "quatro"]

(the arrow-ls and arrow-cat commands come with the go-arrow package from Apache Arrow.)

This opens another bridge between ROOT and other communities :slight_smile:

hth,
-s