arrow-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xander Dunn" <xan...@xander.ai>
Subject Re: [GLib] Call Plasma from GLib?
Date Tue, 13 Apr 2021 16:59:30 GMT
Fantastic, thanks! And I see here ( https://arrow.apache.org/install/ ) the installation of
the library on Ubuntu: sudo apt install -y -V libplasma-glib-dev

On Tue, Apr 13, 2021 at 12:26 AM, Sutou Kouhei < kou@clear-code.com > wrote:

> 
> 
> 
> Hi,
> 
> 
> 
> Plasma support is provided by separated library: plasma-glib
> 
> 
> 
> https:/ / arrow. apache. org/ docs/ c_glib/ plasma-glib/ api-index-full. html
> ( https://arrow.apache.org/docs/c_glib/plasma-glib/api-index-full.html )
> 
> 
> 
> ----
> const gchar *socket_name = "/tmp/plasma-store.sock"; GPlasmaClientOptions
> *options = NULL;
> GError *error = NULL;
> GPlasmaClient client = gplasma_client_new(socket_name, options, &NULL);
> // Check error
> 
> 
> 
> GPlasmaObjectID *id = gplasma_object_id_new("ID", 2, &error);
> // Check error
> gint64 timeout_ms = 1000;
> GPLasmaReferredObject *object =
> gplasma_client_refer_object(client,
> id,
> timeout_ms,
> &error);
> // Check error
> 
> 
> 
> GArrowBuffer *data;
> g_object_get(object,
> "data", &data,
> NULL);
> GArrowBufferInputStream *input = garrow_buffer_input_stream_new(data);
> // Or StreamReader
> GArrowRecordBatchFileReader *reader =
> garrow_record_batch_file_reader_new(input, &error);
> // Check error
> 
> 
> 
> guint n_record_batches =
> garrow_record_batch_file_reader_get_n_record_batches(reader); guint i;
> for (i = 0; i < n_record_batches; i++) {
> GArrowRecordBatch *record_batch =
> garrow_record_batch_file_reader_read_record_batch(reader, i, &error);
> // Check error
> // Process record_batch
> g_object_unref(record_batch);
> }
> g_object_unref(reader);
> g_object_unref(input);
> g_object_unref(data);
> g_object_unref(object);
> g_object_unref(client);
> ----
> 
> 
> 
> Thanks,
> --
> kou
> 
> 
> 
> In < knflod8d. c8b1c455-d174-4fb8-b410-0cbbaa5b50ec@ we. are. superhuman. com
> ( knflod8d.c8b1c455-d174-4fb8-b410-0cbbaa5b50ec@we.are.superhuman.com ) >
> "[GLib] Call Plasma from GLib?" on Tue , 13 Apr 2021 05:48:18 +0000,
> "Xander Dunn" < xander@ xander. ai ( xander@xander.ai ) > wrote:
> 
> 
>> 
>> 
>> I've been using Arrow's GLib library to write an Arrow library for the
>> Swift programming language. In Python I am using pyarrow.plasma to store
>> RecordBatch buffers, and I would like to retrieve those in Swift. However,
>> I just noticed that there is no mention of plasma in the GLib interface: https:/
>> / arrow. apache. org/ docs/ c_glib/ arrow-glib/ api-index-full. html (
>> https://arrow.apache.org/docs/c_glib/arrow-glib/api-index-full.html ). Is
>> Plasma not a part of GLib by design or is it planned to add it? In the
>> meantime, it looks like my option is to call the arrow C++ library from my
>> Swift layer? I see instructions here for using Plasma in C++: https:/ / github.
>> com/ apache/ arrow/ blob/ master/ cpp/ apidoc/ tutorials/ plasma. md (
>> https://github.com/apache/arrow/blob/master/cpp/apidoc/tutorials/plasma.md
>> )
>> 
>> 
>> 
>> And an unrelated, less important question:
>> 
>> 
>> 
>> Should I be able to call Plasma from the C++ library in Cython rather than
>> using the pyarrow Plasma interface in Cython? I think I will just need to
>> `cdef extern` declare all of the C++ interfaces I need to call.
>> 
>> 
>> 
>> Thanks,
>> 
>> 
>> 
>> Xander
>> 
>> 
> 
> 
>
Mime
View raw message