Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5E35F200CC9 for ; Mon, 17 Jul 2017 18:18:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5C75D1651CA; Mon, 17 Jul 2017 16:18:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 545271651C8 for ; Mon, 17 Jul 2017 18:18:19 +0200 (CEST) Received: (qmail 40330 invoked by uid 500); 17 Jul 2017 16:18:17 -0000 Mailing-List: contact commits-help@arrow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@arrow.apache.org Delivered-To: mailing list commits@arrow.apache.org Received: (qmail 40321 invoked by uid 99); 17 Jul 2017 16:18:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Jul 2017 16:18:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 95CD0DFAB2; Mon, 17 Jul 2017 16:18:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: uwe@apache.org To: commits@arrow.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: arrow git commit: ARROW-1229: [GLib] Use "read" instead of "get" for reading record batch Date: Mon, 17 Jul 2017 16:18:17 +0000 (UTC) archived-at: Mon, 17 Jul 2017 16:18:20 -0000 Repository: arrow Updated Branches: refs/heads/master b474cacf7 -> ea9bc8378 ARROW-1229: [GLib] Use "read" instead of "get" for reading record batch It follows C++ API change. Author: Kouhei Sutou Closes #858 from kou/glib-use-read and squashes the following commits: 6fc499e [Kouhei Sutou] [GLib] Use "read" instead of "get" for reading record batch Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/ea9bc837 Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/ea9bc837 Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/ea9bc837 Branch: refs/heads/master Commit: ea9bc8378abfbe6e15a4e338bd7024841dc2a37c Parents: b474cac Author: Kouhei Sutou Authored: Mon Jul 17 18:17:45 2017 +0200 Committer: Uwe L. Korn Committed: Mon Jul 17 18:17:45 2017 +0200 ---------------------------------------------------------------------- c_glib/arrow-glib/reader.cpp | 46 +++++++++++++++++++++- c_glib/arrow-glib/reader.h | 13 ++++++ c_glib/example/Makefile.am | 3 +- c_glib/example/go/read-batch.go | 4 +- c_glib/example/go/read-stream.go | 4 +- 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/read-batch.c | 2 +- c_glib/example/read-stream.c | 2 +- c_glib/test/test-stream-writer.rb | 4 +- 11 files changed, 70 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/c_glib/arrow-glib/reader.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/reader.cpp b/c_glib/arrow-glib/reader.cpp index 523bdee..25c8d67 100644 --- a/c_glib/arrow-glib/reader.cpp +++ b/c_glib/arrow-glib/reader.cpp @@ -166,18 +166,38 @@ garrow_record_batch_reader_get_schema(GArrowRecordBatchReader *reader) * The next record batch in the stream or %NULL on end of stream. * * Since: 0.4.0 + * + * Deprecated: 0.5.0: + * Use garrow_record_batch_reader_read_next_record_batch() instead. */ GArrowRecordBatch * garrow_record_batch_reader_get_next_record_batch(GArrowRecordBatchReader *reader, GError **error) { + return garrow_record_batch_reader_read_next_record_batch(reader, error); +} + +/** + * garrow_record_batch_reader_read_next_record_batch: + * @reader: A #GArrowRecordBatchReader. + * @error: (nullable): Return locatipcn for a #GError or %NULL. + * + * Returns: (nullable) (transfer full): + * The next record batch in the stream or %NULL on end of stream. + * + * Since: 0.5.0 + */ +GArrowRecordBatch * +garrow_record_batch_reader_read_next_record_batch(GArrowRecordBatchReader *reader, + GError **error) +{ auto arrow_reader = garrow_record_batch_reader_get_raw(reader); std::shared_ptr arrow_record_batch; auto status = arrow_reader->ReadNextRecordBatch(&arrow_record_batch); if (garrow_error_check(error, status, - "[record-batch-reader][get-next-record-batch]")) { + "[record-batch-reader][read-next-record-batch]")) { if (arrow_record_batch == nullptr) { return NULL; } else { @@ -402,19 +422,41 @@ garrow_record_batch_file_reader_get_version(GArrowRecordBatchFileReader *reader) * The i-th record batch in the file or %NULL on error. * * Since: 0.4.0 + * + * Deprecated: 0.5.0: + * Use garrow_record_batch_file_reader_read_record_batch() instead. */ GArrowRecordBatch * garrow_record_batch_file_reader_get_record_batch(GArrowRecordBatchFileReader *reader, guint i, GError **error) { + return garrow_record_batch_file_reader_read_record_batch(reader, i, error); +} + +/** + * garrow_record_batch_file_reader_read_record_batch: + * @reader: A #GArrowRecordBatchFileReader. + * @i: The index of the target record batch. + * @error: (nullable): Return locatipcn for a #GError or %NULL. + * + * Returns: (nullable) (transfer full): + * The i-th record batch in the file or %NULL on error. + * + * Since: 0.5.0 + */ +GArrowRecordBatch * +garrow_record_batch_file_reader_read_record_batch(GArrowRecordBatchFileReader *reader, + guint i, + GError **error) +{ auto arrow_reader = garrow_record_batch_file_reader_get_raw(reader); std::shared_ptr arrow_record_batch; auto status = arrow_reader->ReadRecordBatch(i, &arrow_record_batch); if (garrow_error_check(error, status, - "[record-batch-file-reader][get-record-batch]")) { + "[record-batch-file-reader][read-record-batch]")) { return garrow_record_batch_new_raw(&arrow_record_batch); } else { return NULL; http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/c_glib/arrow-glib/reader.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/reader.h b/c_glib/arrow-glib/reader.h index b8bdbe2..f5195e4 100644 --- a/c_glib/arrow-glib/reader.h +++ b/c_glib/arrow-glib/reader.h @@ -76,9 +76,15 @@ GType garrow_record_batch_reader_get_type(void) G_GNUC_CONST; GArrowSchema *garrow_record_batch_reader_get_schema( GArrowRecordBatchReader *reader); +#ifndef GARROW_DISABLE_DEPRECATED +G_GNUC_DEPRECATED_FOR(garrow_record_batch_reader_read_next_record_batch) GArrowRecordBatch *garrow_record_batch_reader_get_next_record_batch( GArrowRecordBatchReader *reader, GError **error); +#endif +GArrowRecordBatch *garrow_record_batch_reader_read_next_record_batch( + GArrowRecordBatchReader *reader, + GError **error); #define GARROW_TYPE_RECORD_BATCH_STREAM_READER \ @@ -188,10 +194,17 @@ guint garrow_record_batch_file_reader_get_n_record_batches( GArrowRecordBatchFileReader *reader); GArrowMetadataVersion garrow_record_batch_file_reader_get_version( GArrowRecordBatchFileReader *reader); +#ifndef GARROW_DISABLE_DEPRECATED +G_GNUC_DEPRECATED_FOR(garrow_record_batch_file_reader_read_record_batch) GArrowRecordBatch *garrow_record_batch_file_reader_get_record_batch( GArrowRecordBatchFileReader *reader, guint i, GError **error); +#endif +GArrowRecordBatch *garrow_record_batch_file_reader_read_record_batch( + GArrowRecordBatchFileReader *reader, + guint i, + GError **error); #define GARROW_TYPE_FEATHER_FILE_READER \ http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/c_glib/example/Makefile.am ---------------------------------------------------------------------- diff --git a/c_glib/example/Makefile.am b/c_glib/example/Makefile.am index 66d2cdd..6c17795 100644 --- a/c_glib/example/Makefile.am +++ b/c_glib/example/Makefile.am @@ -20,7 +20,8 @@ SUBDIRS = \ AM_CPPFLAGS = \ -I$(top_builddir) \ - -I$(top_srcdir) + -I$(top_srcdir) \ + -DGARROW_DISABLE_DEPRECATED AM_CFLAGS = \ $(GLIB_CFLAGS) \ http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/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 f47d3e2..ef1a7fb 100644 --- a/c_glib/example/go/read-batch.go +++ b/c_glib/example/go/read-batch.go @@ -89,9 +89,9 @@ func main() { var i uint32 nRecordBatches := reader.GetNRecordBatches() for i = 0; i < nRecordBatches; i++ { - recordBatch, err := reader.GetRecordBatch(i) + recordBatch, err := reader.ReadRecordBatch(i) if err != nil { - log.Fatalf("Failed to get record batch[%d]: %v", i, err) + log.Fatalf("Failed to read record batch[%d]: %v", i, err) } fmt.Println(strings.Repeat("=", 40)) fmt.Printf("record-batch[%d]:\n", i) http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/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 789b87b..fdb7ba1 100644 --- a/c_glib/example/go/read-stream.go +++ b/c_glib/example/go/read-stream.go @@ -87,9 +87,9 @@ func main() { log.Fatalf("Failed to parse data: %v", err) } for i := 0; true; i++ { - recordBatch, err := reader.GetNextRecordBatch() + recordBatch, err := reader.ReadNextRecordBatch() if err != nil { - log.Fatalf("Failed to get next record batch: %v", err) + log.Fatalf("Failed to read next record batch: %v", err) } if recordBatch == nil { break http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/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 5e28d7e..8dc2fd8 100644 --- a/c_glib/example/lua/read-batch.lua +++ b/c_glib/example/lua/read-batch.lua @@ -24,7 +24,7 @@ local input = Arrow.MemoryMappedInputStream.new(input_path) local reader = Arrow.RecordBatchFileReader.new(input) for i = 0, reader:get_n_record_batches() - 1 do - local record_batch = reader:get_record_batch(i) + local record_batch = reader:read_record_batch(i) print(string.rep("=", 40)) print("record-batch["..i.."]:") for j = 0, record_batch:get_n_columns() - 1 do http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/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 95cf2e7..7dc9617 100644 --- a/c_glib/example/lua/read-stream.lua +++ b/c_glib/example/lua/read-stream.lua @@ -25,7 +25,7 @@ local reader = Arrow.RecordBatchStreamReader.new(input) local i = 0 while true do - local record_batch = reader:get_next_record_batch() + local record_batch = reader:read_next_record_batch() if not record_batch then break end http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/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 9825f10..fc765e3 100644 --- a/c_glib/example/lua/stream-to-torch-tensor.lua +++ b/c_glib/example/lua/stream-to-torch-tensor.lua @@ -81,7 +81,7 @@ local reader = Arrow.RecordBatchStreamReader.new(input) local i = 0 while true do - local record_batch = reader:get_next_record_batch() + local record_batch = reader:read_next_record_batch() if not record_batch then break end http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/c_glib/example/read-batch.c ---------------------------------------------------------------------- diff --git a/c_glib/example/read-batch.c b/c_glib/example/read-batch.c index 4461c43..4382816 100644 --- a/c_glib/example/read-batch.c +++ b/c_glib/example/read-batch.c @@ -121,7 +121,7 @@ main(int argc, char **argv) GArrowRecordBatch *record_batch; record_batch = - garrow_record_batch_file_reader_get_record_batch(reader, i, &error); + garrow_record_batch_file_reader_read_record_batch(reader, i, &error); if (!record_batch) { g_print("failed to open file reader: %s\n", error->message); g_error_free(error); http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/c_glib/example/read-stream.c ---------------------------------------------------------------------- diff --git a/c_glib/example/read-stream.c b/c_glib/example/read-stream.c index 412be35..a624f72 100644 --- a/c_glib/example/read-stream.c +++ b/c_glib/example/read-stream.c @@ -118,7 +118,7 @@ main(int argc, char **argv) GArrowRecordBatch *record_batch; record_batch = - garrow_record_batch_reader_get_next_record_batch(reader, &error); + garrow_record_batch_reader_read_next_record_batch(reader, &error); if (error) { g_print("failed to get record batch: %s\n", error->message); g_error_free(error); http://git-wip-us.apache.org/repos/asf/arrow/blob/ea9bc837/c_glib/test/test-stream-writer.rb ---------------------------------------------------------------------- diff --git a/c_glib/test/test-stream-writer.rb b/c_glib/test/test-stream-writer.rb index 41fd147..833e08b 100644 --- a/c_glib/test/test-stream-writer.rb +++ b/c_glib/test/test-stream-writer.rb @@ -44,8 +44,8 @@ class TestStreamWriter < Test::Unit::TestCase assert_equal(["enabled"], stream_reader.schema.fields.collect(&:name)) assert_equal(true, - stream_reader.next_record_batch.get_column(0).get_value(0)) - assert_nil(stream_reader.next_record_batch) + stream_reader.read_next_record_batch.get_column(0).get_value(0)) + assert_nil(stream_reader.read_next_record_batch) ensure input.close end