ARROW-1062: [GLib] Follow API changes in examples Author: Kouhei Sutou <k...@clear-code.com>
Closes #709 from kou/glib-fix-examples and squashes the following commits: ed5c465d [Kouhei Sutou] [GLib] Follow API changes in examples Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/d2cc199c Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/d2cc199c Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/d2cc199c Branch: refs/heads/master Commit: d2cc199cc480f206110b34dc6abb0e3eb51eacac Parents: b06602d Author: Kouhei Sutou <k...@clear-code.com> Authored: Tue May 23 14:05:27 2017 -0400 Committer: Wes McKinney <wes.mckin...@twosigma.com> Committed: Wed May 31 13:45:48 2017 -0400 ---------------------------------------------------------------------- .travis.yml | 1 + c_glib/arrow-glib/table.h | 2 -- c_glib/example/go/read-batch.go | 2 +- c_glib/example/go/read-stream.go | 2 +- c_glib/example/go/write-batch.go | 2 +- c_glib/example/go/write-stream.go | 2 +- c_glib/example/lua/read-batch.lua | 2 +- c_glib/example/lua/read-stream.lua | 2 +- c_glib/example/lua/stream-to-torch-tensor.lua | 2 +- c_glib/example/lua/write-batch.lua | 2 +- c_glib/example/lua/write-stream.lua | 2 +- ci/travis_before_script_c_glib.sh | 24 ++++++++++++++++++--- ci/travis_env_common.sh | 1 + ci/travis_script_c_glib.sh | 25 +++++++++++++++++++++- 14 files changed, 56 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/.travis.yml ---------------------------------------------------------------------- diff --git a/.travis.yml b/.travis.yml index 022ffb3..b212fcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ addons: - gtk-doc-tools - autoconf-archive - libgirepository1.0-dev + - gir1.2-gudev-1.0 services: - docker http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/arrow-glib/table.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/table.h b/c_glib/arrow-glib/table.h index 7f83872..9e21669 100644 --- a/c_glib/arrow-glib/table.h +++ b/c_glib/arrow-glib/table.h @@ -86,6 +86,4 @@ GArrowTable *garrow_table_remove_column (GArrowTable *table, guint i, GError **error); -gchar *garrow_table_to_string (GArrowTable *table); - G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/go/read-batch.go ---------------------------------------------------------------------- diff --git a/c_glib/example/go/read-batch.go b/c_glib/example/go/read-batch.go index 3ad8423..f47d3e2 100644 --- a/c_glib/example/go/read-batch.go +++ b/c_glib/example/go/read-batch.go @@ -82,7 +82,7 @@ func main() { if err != nil { log.Fatalf("Failed to open path: <%s>: %v", path, err) } - reader, err := arrow.NewFileReader(input) + reader, err := arrow.NewRecordBatchFileReader(input) if err != nil { log.Fatalf("Failed to parse data: %v", err) } http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/go/read-stream.go ---------------------------------------------------------------------- diff --git a/c_glib/example/go/read-stream.go b/c_glib/example/go/read-stream.go index f336798..789b87b 100644 --- a/c_glib/example/go/read-stream.go +++ b/c_glib/example/go/read-stream.go @@ -82,7 +82,7 @@ func main() { if err != nil { log.Fatalf("Failed to open path: <%s>: %v", path, err) } - reader, err := arrow.NewStreamReader(input) + reader, err := arrow.NewRecordBatchStreamReader(input) if err != nil { log.Fatalf("Failed to parse data: %v", err) } http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/go/write-batch.go ---------------------------------------------------------------------- diff --git a/c_glib/example/go/write-batch.go b/c_glib/example/go/write-batch.go index 78ef1be..cda09a9 100644 --- a/c_glib/example/go/write-batch.go +++ b/c_glib/example/go/write-batch.go @@ -130,7 +130,7 @@ func main() { if err != nil { log.Fatalf("Failed to open path: <%s>: %v", output_path, err) } - writer, err := arrow.NewFileWriter(output, schema) + writer, err := arrow.NewRecordBatchFileWriter(output, schema) if err != nil { log.Fatalf("Failed to create writer: %v", err) } http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/go/write-stream.go ---------------------------------------------------------------------- diff --git a/c_glib/example/go/write-stream.go b/c_glib/example/go/write-stream.go index 3f08270..20cb03e 100644 --- a/c_glib/example/go/write-stream.go +++ b/c_glib/example/go/write-stream.go @@ -130,7 +130,7 @@ func main() { if err != nil { log.Fatalf("Failed to open path: <%s>: %v", output_path, err) } - writer, err := arrow.NewStreamWriter(output, schema) + writer, err := arrow.NewRecordBatchStreamWriter(output, schema) if err != nil { log.Fatalf("Failed to create writer: %v", err) } http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/lua/read-batch.lua ---------------------------------------------------------------------- diff --git a/c_glib/example/lua/read-batch.lua b/c_glib/example/lua/read-batch.lua index 090a857..5e28d7e 100644 --- a/c_glib/example/lua/read-batch.lua +++ b/c_glib/example/lua/read-batch.lua @@ -21,7 +21,7 @@ local Arrow = lgi.Arrow local input_path = arg[1] or "/tmp/batch.arrow"; local input = Arrow.MemoryMappedInputStream.new(input_path) -local reader = Arrow.FileReader.new(input) +local reader = Arrow.RecordBatchFileReader.new(input) for i = 0, reader:get_n_record_batches() - 1 do local record_batch = reader:get_record_batch(i) http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/lua/read-stream.lua ---------------------------------------------------------------------- diff --git a/c_glib/example/lua/read-stream.lua b/c_glib/example/lua/read-stream.lua index d7ac5eb..95cf2e7 100644 --- a/c_glib/example/lua/read-stream.lua +++ b/c_glib/example/lua/read-stream.lua @@ -21,7 +21,7 @@ local Arrow = lgi.Arrow local input_path = arg[1] or "/tmp/stream.arrow"; local input = Arrow.MemoryMappedInputStream.new(input_path) -local reader = Arrow.StreamReader.new(input) +local reader = Arrow.RecordBatchStreamReader.new(input) local i = 0 while true do http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/lua/stream-to-torch-tensor.lua ---------------------------------------------------------------------- diff --git a/c_glib/example/lua/stream-to-torch-tensor.lua b/c_glib/example/lua/stream-to-torch-tensor.lua index 237d759..9825f10 100644 --- a/c_glib/example/lua/stream-to-torch-tensor.lua +++ b/c_glib/example/lua/stream-to-torch-tensor.lua @@ -77,7 +77,7 @@ end local input_path = arg[1] or "/tmp/stream.arrow"; local input = Arrow.MemoryMappedInputStream.new(input_path) -local reader = Arrow.StreamReader.open(input) +local reader = Arrow.RecordBatchStreamReader.new(input) local i = 0 while true do http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/lua/write-batch.lua ---------------------------------------------------------------------- diff --git a/c_glib/example/lua/write-batch.lua b/c_glib/example/lua/write-batch.lua index 663f8ef..26acc1d 100644 --- a/c_glib/example/lua/write-batch.lua +++ b/c_glib/example/lua/write-batch.lua @@ -35,7 +35,7 @@ local fields = { local schema = Arrow.Schema.new(fields) local output = Arrow.FileOutputStream.new(output_path, false) -local writer = Arrow.FileWriter.new(output, schema) +local writer = Arrow.RecordBatchFileWriter.new(output, schema) function build_array(builder, values) for _, value in pairs(values) do http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/c_glib/example/lua/write-stream.lua ---------------------------------------------------------------------- diff --git a/c_glib/example/lua/write-stream.lua b/c_glib/example/lua/write-stream.lua index fb6cc55..07bbd79 100644 --- a/c_glib/example/lua/write-stream.lua +++ b/c_glib/example/lua/write-stream.lua @@ -35,7 +35,7 @@ local fields = { local schema = Arrow.Schema.new(fields) local output = Arrow.FileOutputStream.new(output_path, false) -local writer = Arrow.StreamWriter.new(output, schema) +local writer = Arrow.RecordBatchStreamWriter.new(output, schema) function build_array(builder, values) for _, value in pairs(values) do http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/ci/travis_before_script_c_glib.sh ---------------------------------------------------------------------- diff --git a/ci/travis_before_script_c_glib.sh b/ci/travis_before_script_c_glib.sh index 74bdd94..e397b0e 100755 --- a/ci/travis_before_script_c_glib.sh +++ b/ci/travis_before_script_c_glib.sh @@ -18,14 +18,32 @@ set -ex source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh if [ $TRAVIS_OS_NAME == "osx" ]; then - brew install gtk-doc autoconf-archive gobject-introspection + brew install gtk-doc autoconf-archive gobject-introspection fi gem install gobject-introspection -pushd $ARROW_C_GLIB_DIR +git clone \ + --quiet \ + --depth 1 \ + --recursive \ + https://github.com/torch/distro.git ~/torch +pushd ~/torch +./install-deps > /dev/null +echo "yes" | ./install.sh > /dev/null +. ~/torch/install/bin/torch-activate +popd +luarocks install lgi + +go get github.com/linuxdeepin/go-gir-generator || : +pushd $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/ +popd -: ${ARROW_C_GLIB_INSTALL=$TRAVIS_BUILD_DIR/c-glib-install} +pushd $ARROW_C_GLIB_DIR ./autogen.sh http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/ci/travis_env_common.sh ---------------------------------------------------------------------- diff --git a/ci/travis_env_common.sh b/ci/travis_env_common.sh index 3515314..b19fafa 100755 --- a/ci/travis_env_common.sh +++ b/ci/travis_env_common.sh @@ -30,3 +30,4 @@ export ARROW_INTEGRATION_DIR=$TRAVIS_BUILD_DIR/integration export ARROW_CPP_INSTALL=$TRAVIS_BUILD_DIR/cpp-install export ARROW_CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/cpp-build +export ARROW_C_GLIB_INSTALL=$TRAVIS_BUILD_DIR/c-glib-install http://git-wip-us.apache.org/repos/asf/arrow/blob/d2cc199c/ci/travis_script_c_glib.sh ---------------------------------------------------------------------- diff --git a/ci/travis_script_c_glib.sh b/ci/travis_script_c_glib.sh index 1492354..c4df713 100755 --- a/ci/travis_script_c_glib.sh +++ b/ci/travis_script_c_glib.sh @@ -14,11 +14,34 @@ set -e -ARROW_C_GLIB_DIR=$TRAVIS_BUILD_DIR/c_glib +source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh pushd $ARROW_C_GLIB_DIR export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ARROW_CPP_INSTALL/lib NO_MAKE=yes test/run-test.sh +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ARROW_C_GLIB_INSTALL/lib +export GI_TYPELIB_PATH=$ARROW_C_GLIB_INSTALL/lib/girepository-1.0 +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ARROW_CPP_INSTALL/lib/pkgconfig +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ARROW_C_GLIB_INSTALL/lib/pkgconfig + +pushd example/lua +. ~/torch/install/bin/torch-activate +luajit write-batch.lua +luajit read-batch.lua +luajit write-stream.lua +luajit read-stream.lua +luajit stream-to-torch-tensor.lua +popd + +pushd example/go +make generate +make +./write-batch +./read-batch +./write-stream +./read-stream +popd + popd