kou commented on PR #14:
URL: https://github.com/apache/arrow-experiments/pull/14#issuecomment-1987269860
OK. I've changed to use `GArrowTable` that is a wrapper of `arrow::Table`.
It's not an array of pointers to the record batches (it's a container of
chunked arrays) but they are logically same data.
If an array of pointers to the record batches is preferred, we can do it:
```diff
--- a/http/get_simple/c_glib/client/client.c
+++ b/http/get_simple/c_glib/client/client.c
@@ -53,6 +53,7 @@ main(int argc, char **argv)
}
gsize n_received_record_batches = 0;
+ GList *record_batches = NULL;
while (TRUE) {
GArrowRecordBatch *record_batch =
garrow_record_batch_reader_read_next(GARROW_RECORD_BATCH_READER(reader),
@@ -60,6 +61,7 @@ main(int argc, char **argv)
if (error) {
g_printerr("Failed to read record batch: %s\n", error->message);
g_error_free(error);
+ g_list_free_full(record_batches, g_object_unref);
g_object_unref(reader);
g_object_unref(arrow_input);
goto exit;
@@ -67,9 +69,11 @@ main(int argc, char **argv)
if (!record_batch) {
break;
}
- g_object_unref(record_batch);
+ record_batches = g_list_prepend(record_batches, record_batch);
n_received_record_batches++;
}
+ record_batches = g_list_reverse(record_batches);
+ g_list_free_full(record_batches, g_object_unref);
g_object_unref(reader);
g_object_unref(arrow_input);
```
Which is preferred?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]