tree: 907d9d43bde1e5551520dd2ab992dec40fd69da6 [path history] [tgz]
  1. arrow-1.0/
  2. Makefile
  3. read-batch.go
  4. read-stream.go
  5. README.md
  6. write-batch.go
  7. write-stream.go
c_glib/example/go/README.md

Arrow Go example

There are Go example codes in this directory.

How to run

All example codes use go-gir-generator to use Arrow GLib based bindings.

See ../../README.md how to install Arrow GLib. You can use packages to install Arrow GLib. The following instructions assumes that you've installed Arrow GLib by package. Package name is libarrow-glib-dev on Debian GNU/Linux and Ubuntu, arrow-glib-devel on CentOS.

Here are command lines to install go-gir-generator on Debian GNU/Linux and Ubuntu:

% sudo apt install -V -y libarrow-glib-dev golang git libgirepository1.0-dev libgudev-1.0-dev
% export GOPATH=$HOME
% go get github.com/linuxdeepin/go-gir-generator
% cd $GOPATH/src/github.com/linuxdeepin/go-gir-generator
% make build copyfile
% mkdir -p $GOPATH/bin/
% cp -a out/gir-generator $GOPATH/bin/
% cp -a out/src/gir/ $GOPATH/src/

Now, you can generate Arrow bindings for Go:

% git clone https://github.com/apache/arrow.git ~/arrow
% cd ~/arrow/c_glib/example/go
% make generate

Then you can build all example codes:

% cd ~/arrow/c_glib/example/go
% make
% ./write-batch  # Write data in batch mode
% ./read-batch   # Read the written batch mode data
% ./write-stream # Write data in stream mode
% ./read-stream  # Read the written stream mode data

Go example codes

Here are example codes in this directory:

  • write-batch.go: It shows how to write Arrow array to file in batch mode.

  • read-batch.go: It shows how to read Arrow array from file in batch mode.

  • write-stream.go: It shows how to write Arrow array to file in stream mode.

  • read-stream.go: It shows how to read Arrow array from file in stream mode.