You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/05/16 14:01:45 UTC
arrow git commit: ARROW-1038: [GLib] Follow writer name change
Repository: arrow
Updated Branches:
refs/heads/master 8a8e7bb0d -> 49c539810
ARROW-1038: [GLib] Follow writer name change
Author: Kouhei Sutou <ko...@clear-code.com>
Closes #696 from kou/glib-follow-writer-name-change and squashes the following commits:
85f7ce8 [Kouhei Sutou] [GLib] Follow writer name change
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/49c53981
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/49c53981
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/49c53981
Branch: refs/heads/master
Commit: 49c5398104d0f1749a411e013cb66fd561511401
Parents: 8a8e7bb
Author: Kouhei Sutou <ko...@clear-code.com>
Authored: Tue May 16 10:01:40 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Tue May 16 10:01:40 2017 -0400
----------------------------------------------------------------------
c_glib/arrow-glib/writer.cpp | 276 ++++++++++++++++++---------------
c_glib/arrow-glib/writer.h | 187 ++++++++++++++--------
c_glib/arrow-glib/writer.hpp | 9 +-
c_glib/test/test-file-writer.rb | 2 +-
c_glib/test/test-stream-writer.rb | 2 +-
5 files changed, 280 insertions(+), 196 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/49c53981/c_glib/arrow-glib/writer.cpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/writer.cpp b/c_glib/arrow-glib/writer.cpp
index 092993b..20dd281 100644
--- a/c_glib/arrow-glib/writer.cpp
+++ b/c_glib/arrow-glib/writer.cpp
@@ -40,56 +40,60 @@ G_BEGIN_DECLS
* @title: Writer classes
* @include: arrow-glib/arrow-glib.h
*
- * #GArrowStreamWriter is a class for writing data in stream mode.
+ * #GArrowRecordBatchWriter is a base class for writing record batches
+ * in stream format into output.
*
- * #GArrowFileWriter is a class for writing data in random access
- * mode.
+ * #GArrowRecordBatchStreamWriter is a base class for writing record
+ * batches in stream format into output synchronously.
+ *
+ * #GArrowRecordBatchFileWriter is a class for writing record
+ * batches in file format into output.
*/
-typedef struct GArrowStreamWriterPrivate_ {
- std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> stream_writer;
-} GArrowStreamWriterPrivate;
+typedef struct GArrowRecordBatchWriterPrivate_ {
+ std::shared_ptr<arrow::ipc::RecordBatchWriter> record_batch_writer;
+} GArrowRecordBatchWriterPrivate;
enum {
PROP_0,
- PROP_STREAM_WRITER
+ PROP_RECORD_BATCH_WRITER
};
-G_DEFINE_TYPE_WITH_PRIVATE(GArrowStreamWriter,
- garrow_stream_writer,
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchWriter,
+ garrow_record_batch_writer,
G_TYPE_OBJECT);
-#define GARROW_STREAM_WRITER_GET_PRIVATE(obj) \
+#define GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), \
- GARROW_TYPE_STREAM_WRITER, \
- GArrowStreamWriterPrivate))
+ GARROW_TYPE_RECORD_BATCH_WRITER, \
+ GArrowRecordBatchWriterPrivate))
static void
-garrow_stream_writer_finalize(GObject *object)
+garrow_record_batch_writer_finalize(GObject *object)
{
- GArrowStreamWriterPrivate *priv;
+ GArrowRecordBatchWriterPrivate *priv;
- priv = GARROW_STREAM_WRITER_GET_PRIVATE(object);
+ priv = GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(object);
- priv->stream_writer = nullptr;
+ priv->record_batch_writer = nullptr;
- G_OBJECT_CLASS(garrow_stream_writer_parent_class)->finalize(object);
+ G_OBJECT_CLASS(garrow_record_batch_writer_parent_class)->finalize(object);
}
static void
-garrow_stream_writer_set_property(GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+garrow_record_batch_writer_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GArrowStreamWriterPrivate *priv;
+ GArrowRecordBatchWriterPrivate *priv;
- priv = GARROW_STREAM_WRITER_GET_PRIVATE(object);
+ priv = GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(object);
switch (prop_id) {
- case PROP_STREAM_WRITER:
- priv->stream_writer =
- *static_cast<std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> *>(g_value_get_pointer(value));
+ case PROP_RECORD_BATCH_WRITER:
+ priv->record_batch_writer =
+ *static_cast<std::shared_ptr<arrow::ipc::RecordBatchWriter> *>(g_value_get_pointer(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@@ -98,10 +102,10 @@ garrow_stream_writer_set_property(GObject *object,
}
static void
-garrow_stream_writer_get_property(GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+garrow_record_batch_writer_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (prop_id) {
default:
@@ -111,132 +115,157 @@ garrow_stream_writer_get_property(GObject *object,
}
static void
-garrow_stream_writer_init(GArrowStreamWriter *object)
+garrow_record_batch_writer_init(GArrowRecordBatchWriter *object)
{
}
static void
-garrow_stream_writer_class_init(GArrowStreamWriterClass *klass)
+garrow_record_batch_writer_class_init(GArrowRecordBatchWriterClass *klass)
{
GObjectClass *gobject_class;
GParamSpec *spec;
gobject_class = G_OBJECT_CLASS(klass);
- gobject_class->finalize = garrow_stream_writer_finalize;
- gobject_class->set_property = garrow_stream_writer_set_property;
- gobject_class->get_property = garrow_stream_writer_get_property;
+ gobject_class->finalize = garrow_record_batch_writer_finalize;
+ gobject_class->set_property = garrow_record_batch_writer_set_property;
+ gobject_class->get_property = garrow_record_batch_writer_get_property;
- spec = g_param_spec_pointer("stream-writer",
- "ipc::RecordBatchStreamWriter",
- "The raw std::shared<arrow::ipc::RecordBatchStreamWriter> *",
+ spec = g_param_spec_pointer("record-batch-writer",
+ "arrow::ipc::RecordBatchWriter",
+ "The raw std::shared<arrow::ipc::RecordBatchWriter> *",
static_cast<GParamFlags>(G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property(gobject_class, PROP_STREAM_WRITER, spec);
-}
-
-/**
- * garrow_stream_writer_new:
- * @sink: The output of the writer.
- * @schema: The schema of the writer.
- * @error: (nullable): Return locatipcn for a #GError or %NULL.
- *
- * Returns: (nullable): A newly created #GArrowStreamWriter or %NULL on
- * error.
- */
-GArrowStreamWriter *
-garrow_stream_writer_new(GArrowOutputStream *sink,
- GArrowSchema *schema,
- GError **error)
-{
- std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> arrow_stream_writer;
- auto status =
- arrow::ipc::RecordBatchStreamWriter::Open(garrow_output_stream_get_raw(sink).get(),
- garrow_schema_get_raw(schema),
- &arrow_stream_writer);
- if (garrow_error_check(error, status, "[ipc][stream-writer][open]")) {
- return garrow_stream_writer_new_raw(&arrow_stream_writer);
- } else {
- return NULL;
- }
+ g_object_class_install_property(gobject_class, PROP_RECORD_BATCH_WRITER, spec);
}
/**
- * garrow_stream_writer_write_record_batch:
- * @stream_writer: A #GArrowStreamWriter.
+ * garrow_record_batch_writer_write_record_batch:
+ * @writer: A #GArrowRecordBatchWriter.
* @record_batch: The record batch to be written.
* @error: (nullable): Return locatipcn for a #GError or %NULL.
*
* Returns: %TRUE on success, %FALSE if there was an error.
+ *
+ * Since: 0.4.0
*/
gboolean
-garrow_stream_writer_write_record_batch(GArrowStreamWriter *stream_writer,
- GArrowRecordBatch *record_batch,
- GError **error)
+garrow_record_batch_writer_write_record_batch(GArrowRecordBatchWriter *writer,
+ GArrowRecordBatch *record_batch,
+ GError **error)
{
- auto arrow_stream_writer = garrow_stream_writer_get_raw(stream_writer);
+ auto arrow_writer = garrow_record_batch_writer_get_raw(writer);
auto arrow_record_batch = garrow_record_batch_get_raw(record_batch);
auto arrow_record_batch_raw = arrow_record_batch.get();
- auto status = arrow_stream_writer->WriteRecordBatch(*arrow_record_batch_raw);
+ auto status = arrow_writer->WriteRecordBatch(*arrow_record_batch_raw);
return garrow_error_check(error,
status,
- "[ipc][stream-writer][write-record-batch]");
+ "[record-batch-writer][write-record-batch]");
}
/**
- * garrow_stream_writer_close:
- * @stream_writer: A #GArrowStreamWriter.
+ * garrow_record_batch_writer_close:
+ * @writer: A #GArrowRecordBatchWriter.
* @error: (nullable): Return locatipcn for a #GError or %NULL.
*
* Returns: %TRUE on success, %FALSE if there was an error.
+ *
+ * Since: 0.4.0
*/
gboolean
-garrow_stream_writer_close(GArrowStreamWriter *stream_writer,
- GError **error)
+garrow_record_batch_writer_close(GArrowRecordBatchWriter *writer,
+ GError **error)
{
- auto arrow_stream_writer = garrow_stream_writer_get_raw(stream_writer);
+ auto arrow_writer = garrow_record_batch_writer_get_raw(writer);
- auto status = arrow_stream_writer->Close();
- return garrow_error_check(error, status, "[ipc][stream-writer][close]");
+ auto status = arrow_writer->Close();
+ return garrow_error_check(error, status, "[record-batch-writer][close]");
}
-G_DEFINE_TYPE(GArrowFileWriter,
- garrow_file_writer,
- GARROW_TYPE_STREAM_WRITER);
+G_DEFINE_TYPE(GArrowRecordBatchStreamWriter,
+ garrow_record_batch_stream_writer,
+ GARROW_TYPE_RECORD_BATCH_WRITER);
static void
-garrow_file_writer_init(GArrowFileWriter *object)
+garrow_record_batch_stream_writer_init(GArrowRecordBatchStreamWriter *object)
{
}
static void
-garrow_file_writer_class_init(GArrowFileWriterClass *klass)
+garrow_record_batch_stream_writer_class_init(GArrowRecordBatchStreamWriterClass *klass)
{
}
/**
- * garrow_file_writer_new:
+ * garrow_record_batch_stream_writer_new:
* @sink: The output of the writer.
* @schema: The schema of the writer.
* @error: (nullable): Return locatipcn for a #GError or %NULL.
*
- * Returns: (nullable): A newly created #GArrowFileWriter or %NULL on
- * error.
+ * Returns: (nullable): A newly created #GArrowRecordBatchStreamWriter
+ * or %NULL on error.
+ *
+ * Since: 0.4.0
+ */
+GArrowRecordBatchStreamWriter *
+garrow_record_batch_stream_writer_new(GArrowOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error)
+{
+ auto arrow_sink = garrow_output_stream_get_raw(sink).get();
+ std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> arrow_writer;
+ auto status =
+ arrow::ipc::RecordBatchStreamWriter::Open(arrow_sink,
+ garrow_schema_get_raw(schema),
+ &arrow_writer);
+ if (garrow_error_check(error, status, "[record-batch-stream-writer][open]")) {
+ return garrow_record_batch_stream_writer_new_raw(&arrow_writer);
+ } else {
+ return NULL;
+ }
+}
+
+
+G_DEFINE_TYPE(GArrowRecordBatchFileWriter,
+ garrow_record_batch_file_writer,
+ GARROW_TYPE_RECORD_BATCH_STREAM_WRITER);
+
+static void
+garrow_record_batch_file_writer_init(GArrowRecordBatchFileWriter *object)
+{
+}
+
+static void
+garrow_record_batch_file_writer_class_init(GArrowRecordBatchFileWriterClass *klass)
+{
+}
+
+/**
+ * garrow_record_batch_file_writer_new:
+ * @sink: The output of the writer.
+ * @schema: The schema of the writer.
+ * @error: (nullable): Return locatipcn for a #GError or %NULL.
+ *
+ * Returns: (nullable): A newly created #GArrowRecordBatchFileWriter
+ * or %NULL on error.
+ *
+ * Since: 0.4.0
*/
-GArrowFileWriter *
-garrow_file_writer_new(GArrowOutputStream *sink,
+GArrowRecordBatchFileWriter *
+garrow_record_batch_file_writer_new(GArrowOutputStream *sink,
GArrowSchema *schema,
GError **error)
{
- std::shared_ptr<arrow::ipc::FileWriter> arrow_file_writer;
+ auto arrow_sink = garrow_output_stream_get_raw(sink);
+ std::shared_ptr<arrow::ipc::RecordBatchFileWriter> arrow_writer;
auto status =
- arrow::ipc::FileWriter::Open(garrow_output_stream_get_raw(sink).get(),
- garrow_schema_get_raw(schema),
- &arrow_file_writer);
- if (garrow_error_check(error, status, "[ipc][file-writer][open]")) {
- return garrow_file_writer_new_raw(&arrow_file_writer);
+ arrow::ipc::RecordBatchFileWriter::Open(arrow_sink.get(),
+ garrow_schema_get_raw(schema),
+ &arrow_writer);
+ if (garrow_error_check(error, status, "[record-batch-file-writer][open]")) {
+ return garrow_record_batch_file_writer_new_raw(&arrow_writer);
} else {
return NULL;
}
@@ -244,41 +273,44 @@ garrow_file_writer_new(GArrowOutputStream *sink,
G_END_DECLS
-GArrowStreamWriter *
-garrow_stream_writer_new_raw(std::shared_ptr<arrow::ipc::StreamWriter> *arrow_stream_writer)
+GArrowRecordBatchWriter *
+garrow_record_batch_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchWriter> *arrow_writer)
{
- auto stream_writer =
- GARROW_STREAM_WRITER(g_object_new(GARROW_TYPE_STREAM_WRITER,
- "stream-writer", arrow_stream_writer,
- NULL));
- return stream_writer;
+ auto writer =
+ GARROW_RECORD_BATCH_WRITER(
+ g_object_new(GARROW_TYPE_RECORD_BATCH_WRITER,
+ "record-batch-writer", arrow_writer,
+ NULL));
+ return writer;
}
-std::shared_ptr<arrow::ipc::StreamWriter>
-garrow_stream_writer_get_raw(GArrowStreamWriter *stream_writer)
+std::shared_ptr<arrow::ipc::RecordBatchWriter>
+garrow_record_batch_writer_get_raw(GArrowRecordBatchWriter *writer)
{
- GArrowStreamWriterPrivate *priv;
+ GArrowRecordBatchWriterPrivate *priv;
- priv = GARROW_STREAM_WRITER_GET_PRIVATE(stream_writer);
- return priv->stream_writer;
+ priv = GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(writer);
+ return priv->record_batch_writer;
}
-GArrowFileWriter *
-garrow_file_writer_new_raw(std::shared_ptr<arrow::ipc::FileWriter> *arrow_file_writer)
+GArrowRecordBatchStreamWriter *
+garrow_record_batch_stream_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> *arrow_writer)
{
- auto file_writer =
- GARROW_FILE_WRITER(g_object_new(GARROW_TYPE_FILE_WRITER,
- "stream-writer", arrow_file_writer,
- NULL));
- return file_writer;
+ auto writer =
+ GARROW_RECORD_BATCH_STREAM_WRITER(
+ g_object_new(GARROW_TYPE_RECORD_BATCH_STREAM_WRITER,
+ "record-batch-writer", arrow_writer,
+ NULL));
+ return writer;
}
-arrow::ipc::FileWriter *
-garrow_file_writer_get_raw(GArrowFileWriter *file_writer)
+GArrowRecordBatchFileWriter *
+garrow_record_batch_file_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchFileWriter> *arrow_writer)
{
- auto arrow_stream_writer =
- garrow_stream_writer_get_raw(GARROW_STREAM_WRITER(file_writer));
- auto arrow_file_writer_raw =
- dynamic_cast<arrow::ipc::FileWriter *>(arrow_stream_writer.get());
- return arrow_file_writer_raw;
+ auto writer =
+ GARROW_RECORD_BATCH_FILE_WRITER(
+ g_object_new(GARROW_TYPE_RECORD_BATCH_FILE_WRITER,
+ "record-batch-writer", arrow_writer,
+ NULL));
+ return writer;
}
http://git-wip-us.apache.org/repos/asf/arrow/blob/49c53981/c_glib/arrow-glib/writer.h
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/writer.h b/c_glib/arrow-glib/writer.h
index 2f8e90c..9a98461 100644
--- a/c_glib/arrow-glib/writer.h
+++ b/c_glib/arrow-glib/writer.h
@@ -27,111 +27,162 @@
G_BEGIN_DECLS
-#define GARROW_TYPE_STREAM_WRITER \
- (garrow_stream_writer_get_type())
-#define GARROW_STREAM_WRITER(obj) \
+#define GARROW_TYPE_RECORD_BATCH_WRITER \
+ (garrow_record_batch_writer_get_type())
+#define GARROW_RECORD_BATCH_WRITER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
- GARROW_TYPE_STREAM_WRITER, \
- GArrowStreamWriter))
-#define GARROW_STREAM_WRITER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), \
- GARROW_TYPE_STREAM_WRITER, \
- GArrowStreamWriterClass))
-#define GARROW_IS_STREAM_WRITER(obj) \
+ GARROW_TYPE_RECORD_BATCH_WRITER, \
+ GArrowRecordBatchWriter))
+#define GARROW_RECORD_BATCH_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_RECORD_BATCH_WRITER, \
+ GArrowRecordBatchWriterClass))
+#define GARROW_IS_RECORD_BATCH_WRITER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- GARROW_TYPE_STREAM_WRITER))
-#define GARROW_IS_STREAM_WRITER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), \
- GARROW_TYPE_STREAM_WRITER))
-#define GARROW_STREAM_WRITER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), \
- GARROW_TYPE_STREAM_WRITER, \
- GArrowStreamWriterClass))
-
-typedef struct _GArrowStreamWriter GArrowStreamWriter;
+ GARROW_TYPE_RECORD_BATCH_WRITER))
+#define GARROW_IS_RECORD_BATCH_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_RECORD_BATCH_WRITER))
+#define GARROW_RECORD_BATCH_WRITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_RECORD_BATCH_WRITER, \
+ GArrowRecordBatchWriterClass))
+
+typedef struct _GArrowRecordBatchWriter GArrowRecordBatchWriter;
#ifndef __GTK_DOC_IGNORE__
-typedef struct _GArrowStreamWriterClass GArrowStreamWriterClass;
+typedef struct _GArrowRecordBatchWriterClass GArrowRecordBatchWriterClass;
#endif
/**
- * GArrowStreamWriter:
+ * GArrowRecordBatchWriter:
*
- * It wraps `arrow::ipc::RecordBatchStreamWriter`.
+ * It wraps `arrow::ipc::RecordBatchWriter`.
*/
-struct _GArrowStreamWriter
+struct _GArrowRecordBatchWriter
{
/*< private >*/
GObject parent_instance;
};
#ifndef __GTK_DOC_IGNORE__
-struct _GArrowStreamWriterClass
+struct _GArrowRecordBatchWriterClass
{
GObjectClass parent_class;
};
#endif
-GType garrow_stream_writer_get_type(void) G_GNUC_CONST;
-
-GArrowStreamWriter *garrow_stream_writer_new(GArrowOutputStream *sink,
- GArrowSchema *schema,
- GError **error);
-
-gboolean garrow_stream_writer_write_record_batch(GArrowStreamWriter *stream_writer,
- GArrowRecordBatch *record_batch,
- GError **error);
-gboolean garrow_stream_writer_close(GArrowStreamWriter *stream_writer,
- GError **error);
-
-
-#define GARROW_TYPE_FILE_WRITER \
- (garrow_file_writer_get_type())
-#define GARROW_FILE_WRITER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- GARROW_TYPE_FILE_WRITER, \
- GArrowFileWriter))
-#define GARROW_FILE_WRITER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), \
- GARROW_TYPE_FILE_WRITER, \
- GArrowFileWriterClass))
-#define GARROW_IS_FILE_WRITER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- GARROW_TYPE_FILE_WRITER))
-#define GARROW_IS_FILE_WRITER_CLASS(klass) \
+GType garrow_record_batch_writer_get_type(void) G_GNUC_CONST;
+
+gboolean garrow_record_batch_writer_write_record_batch(
+ GArrowRecordBatchWriter *writer,
+ GArrowRecordBatch *record_batch,
+ GError **error);
+gboolean garrow_record_batch_writer_close(
+ GArrowRecordBatchWriter *writer,
+ GError **error);
+
+
+#define GARROW_TYPE_RECORD_BATCH_STREAM_WRITER \
+ (garrow_record_batch_stream_writer_get_type())
+#define GARROW_RECORD_BATCH_STREAM_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \
+ GArrowRecordBatchStreamWriter))
+#define GARROW_RECORD_BATCH_STREAM_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \
+ GArrowRecordBatchStreamWriterClass))
+#define GARROW_IS_RECORD_BATCH_STREAM_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_RECORD_BATCH_STREAM_WRITER))
+#define GARROW_IS_RECORD_BATCH_STREAM_WRITER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), \
- GARROW_TYPE_FILE_WRITER))
-#define GARROW_FILE_WRITER_GET_CLASS(obj) \
+ GARROW_TYPE_RECORD_BATCH_STREAM_WRITER))
+#define GARROW_RECORD_BATCH_STREAM_WRITER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
- GARROW_TYPE_FILE_WRITER, \
- GArrowFileWriterClass))
+ GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \
+ GArrowRecordBatchStreamWriterClass))
+
+typedef struct _GArrowRecordBatchStreamWriter GArrowRecordBatchStreamWriter;
+#ifndef __GTK_DOC_IGNORE__
+typedef struct _GArrowRecordBatchStreamWriterClass GArrowRecordBatchStreamWriterClass;
+#endif
+
+/**
+ * GArrowRecordBatchStreamWriter:
+ *
+ * It wraps `arrow::ipc::RecordBatchStreamWriter`.
+ */
+struct _GArrowRecordBatchStreamWriter
+{
+ /*< private >*/
+ GArrowRecordBatchWriter parent_instance;
+};
+
+#ifndef __GTK_DOC_IGNORE__
+struct _GArrowRecordBatchStreamWriterClass
+{
+ GArrowRecordBatchWriterClass parent_class;
+};
+#endif
-typedef struct _GArrowFileWriter GArrowFileWriter;
+GType garrow_record_batch_stream_writer_get_type(void) G_GNUC_CONST;
+
+GArrowRecordBatchStreamWriter *garrow_record_batch_stream_writer_new(
+ GArrowOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error);
+
+
+#define GARROW_TYPE_RECORD_BATCH_FILE_WRITER \
+ (garrow_record_batch_file_writer_get_type())
+#define GARROW_RECORD_BATCH_FILE_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \
+ GArrowRecordBatchFileWriter))
+#define GARROW_RECORD_BATCH_FILE_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), \
+ GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \
+ GArrowRecordBatchFileWriterClass))
+#define GARROW_IS_RECORD_BATCH_FILE_WRITER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ GARROW_TYPE_RECORD_BATCH_FILE_WRITER))
+#define GARROW_IS_RECORD_BATCH_FILE_WRITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), \
+ GARROW_TYPE_RECORD_BATCH_FILE_WRITER))
+#define GARROW_RECORD_BATCH_FILE_WRITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \
+ GArrowRecordBatchFileWriterClass))
+
+typedef struct _GArrowRecordBatchFileWriter GArrowRecordBatchFileWriter;
#ifndef __GTK_DOC_IGNORE__
-typedef struct _GArrowFileWriterClass GArrowFileWriterClass;
+typedef struct _GArrowRecordBatchFileWriterClass GArrowRecordBatchFileWriterClass;
#endif
/**
- * GArrowFileWriter:
+ * GArrowRecordBatchFileWriter:
*
- * It wraps `arrow::ipc::FileWriter`.
+ * It wraps `arrow::ipc::RecordBatchFileWriter`.
*/
-struct _GArrowFileWriter
+struct _GArrowRecordBatchFileWriter
{
/*< private >*/
- GArrowStreamWriter parent_instance;
+ GArrowRecordBatchStreamWriter parent_instance;
};
#ifndef __GTK_DOC_IGNORE__
-struct _GArrowFileWriterClass
+struct _GArrowRecordBatchFileWriterClass
{
- GArrowStreamWriterClass parent_class;
+ GArrowRecordBatchStreamWriterClass parent_class;
};
#endif
-GType garrow_file_writer_get_type(void) G_GNUC_CONST;
+GType garrow_record_batch_file_writer_get_type(void) G_GNUC_CONST;
-GArrowFileWriter *garrow_file_writer_new(GArrowOutputStream *sink,
- GArrowSchema *schema,
- GError **error);
+GArrowRecordBatchFileWriter *garrow_record_batch_file_writer_new(
+ GArrowOutputStream *sink,
+ GArrowSchema *schema,
+ GError **error);
G_END_DECLS
http://git-wip-us.apache.org/repos/asf/arrow/blob/49c53981/c_glib/arrow-glib/writer.hpp
----------------------------------------------------------------------
diff --git a/c_glib/arrow-glib/writer.hpp b/c_glib/arrow-glib/writer.hpp
index 47f5e68..c9ea660 100644
--- a/c_glib/arrow-glib/writer.hpp
+++ b/c_glib/arrow-glib/writer.hpp
@@ -24,8 +24,9 @@
#include <arrow-glib/writer.h>
-GArrowStreamWriter *garrow_stream_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> *arrow_stream_writer);
-std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> garrow_stream_writer_get_raw(GArrowStreamWriter *stream_writer);
+GArrowRecordBatchWriter *garrow_record_batch_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchWriter> *arrow_writer);
+std::shared_ptr<arrow::ipc::RecordBatchWriter> garrow_record_batch_writer_get_raw(GArrowRecordBatchWriter *writer);
-GArrowFileWriter *garrow_file_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchFileWriter> *arrow_file_writer);
-arrow::ipc::RecordBatchFileWriter *garrow_file_writer_get_raw(GArrowFileWriter *file_writer);
+GArrowRecordBatchStreamWriter *garrow_record_batch_stream_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchStreamWriter> *arrow_writer);
+
+GArrowRecordBatchFileWriter *garrow_record_batch_file_writer_new_raw(std::shared_ptr<arrow::ipc::RecordBatchFileWriter> *arrow_writer);
http://git-wip-us.apache.org/repos/asf/arrow/blob/49c53981/c_glib/test/test-file-writer.rb
----------------------------------------------------------------------
diff --git a/c_glib/test/test-file-writer.rb b/c_glib/test/test-file-writer.rb
index 02b8bd5..6ba5c7a 100644
--- a/c_glib/test/test-file-writer.rb
+++ b/c_glib/test/test-file-writer.rb
@@ -22,7 +22,7 @@ class TestFileWriter < Test::Unit::TestCase
begin
field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
schema = Arrow::Schema.new([field])
- file_writer = Arrow::FileWriter.new(output, schema)
+ file_writer = Arrow::RecordBatchFileWriter.new(output, schema)
begin
record_batch = Arrow::RecordBatch.new(schema, 0, [])
file_writer.write_record_batch(record_batch)
http://git-wip-us.apache.org/repos/asf/arrow/blob/49c53981/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 da6c2af..41fd147 100644
--- a/c_glib/test/test-stream-writer.rb
+++ b/c_glib/test/test-stream-writer.rb
@@ -24,7 +24,7 @@ class TestStreamWriter < Test::Unit::TestCase
begin
field = Arrow::Field.new("enabled", Arrow::BooleanDataType.new)
schema = Arrow::Schema.new([field])
- stream_writer = Arrow::StreamWriter.new(output, schema)
+ stream_writer = Arrow::RecordBatchStreamWriter.new(output, schema)
begin
columns = [
build_boolean_array([true]),