Record batch related classes

Record batch related classes

Functions

Properties

gpointer record-batch Write / Construct Only
gpointer iterator Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ├── GArrowRecordBatch
    ╰── GArrowRecordBatchIterator

Includes

#include <arrow-glib/arrow-glib.h>

Description

GArrowRecordBatch is a class for record batch. Record batch is similar to GArrowTable. Record batch also has also zero or more columns and zero or more records.

Record batch is used for shared memory IPC.

GArrowRecordBatchIterator is a class for iterating record batches.

Functions

garrow_record_batch_import ()

GArrowRecordBatch *
garrow_record_batch_import (gpointer c_abi_array,
                            GArrowSchema *schema,
                            GError **error);

Parameters

c_abi_array

A struct ArrowArray *.

[not nullable]

schema

A GArrowSchema of the C ABI array.

 

error

Return location for a GError or NULL.

[nullable]

Returns

An imported GArrowRecordBatch on success, NULL on error.

You don't need to release the passed struct ArrowArray *, even if this function reports an error.

[transfer full][nullable]

Since: 6.0.0


garrow_record_batch_new ()

GArrowRecordBatch *
garrow_record_batch_new (GArrowSchema *schema,
                         guint32 n_rows,
                         GList *columns,
                         GError **error);

Parameters

schema

The schema of the record batch.

 

n_rows

The number of the rows in the record batch.

 

columns

The columns in the record batch.

[element-type GArrowArray]

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowRecordBatch or NULL on error.

[nullable]


garrow_record_batch_export ()

gboolean
garrow_record_batch_export (GArrowRecordBatch *record_batch,
                            gpointer *c_abi_array,
                            gpointer *c_abi_schema,
                            GError **error);

Parameters

record_batch

A GArrowRecordBatch.

 

c_abi_array

Return location for a struct ArrowArray *. It should be freed with the ArrowArray::release callback then g_free() when no longer needed.

[out]

c_abi_schema

Return location for a struct ArrowSchema * or NULL. It should be freed with the ArrowSchema::release callback then g_free() when no longer needed.

[out][nullable]

error

Return location for a GError or NULL.

[nullable]

Returns

TRUE on success, FALSE on error.

Since: 6.0.0


garrow_record_batch_equal ()

gboolean
garrow_record_batch_equal (GArrowRecordBatch *record_batch,
                           GArrowRecordBatch *other_record_batch);

Parameters

record_batch

A GArrowRecordBatch.

 

other_record_batch

A GArrowRecordBatch to be compared.

 

Returns

TRUE if both of them have the same data, FALSE otherwise.

Since: 0.4.0


garrow_record_batch_equal_metadata ()

gboolean
garrow_record_batch_equal_metadata (GArrowRecordBatch *record_batch,
                                    GArrowRecordBatch *other_record_batch,
                                    gboolean check_metadata);

Parameters

record_batch

A GArrowRecordBatch.

 

other_record_batch

A GArrowRecordBatch to be compared.

 

check_metadata

Whether to compare metadata.

 

Returns

TRUE if both of them have the same data, FALSE otherwise.

Since: 0.17.0


garrow_record_batch_get_schema ()

GArrowSchema *
garrow_record_batch_get_schema (GArrowRecordBatch *record_batch);

Parameters

record_batch

A GArrowRecordBatch.

 

Returns

The schema of the record batch.

[transfer full]


garrow_record_batch_get_column_data ()

GArrowArray *
garrow_record_batch_get_column_data (GArrowRecordBatch *record_batch,
                                     gint i);

Parameters

record_batch

A GArrowRecordBatch.

 

i

The index of the target column. If it's negative, index is counted backward from the end of the columns. -1 means the last column.

 

Returns

The i-th column in the record batch on success, NULL on out of index.

[transfer full][nullable]

Since: 0.15.0


garrow_record_batch_get_column_name ()

const gchar *
garrow_record_batch_get_column_name (GArrowRecordBatch *record_batch,
                                     gint i);

Parameters

record_batch

A GArrowRecordBatch.

 

i

The index of the target column. If it's negative, index is counted backward from the end of the columns. -1 means the last column.

 

Returns

The name of the i-th column in the record batch on success, NULL on out of index.

[nullable]


garrow_record_batch_get_n_columns ()

guint
garrow_record_batch_get_n_columns (GArrowRecordBatch *record_batch);

Parameters

record_batch

A GArrowRecordBatch.

 

Returns

The number of columns in the record batch.


garrow_record_batch_get_n_rows ()

gint64
garrow_record_batch_get_n_rows (GArrowRecordBatch *record_batch);

Parameters

record_batch

A GArrowRecordBatch.

 

Returns

The number of rows in the record batch.


garrow_record_batch_slice ()

GArrowRecordBatch *
garrow_record_batch_slice (GArrowRecordBatch *record_batch,
                           gint64 offset,
                           gint64 length);

Parameters

record_batch

A GArrowRecordBatch.

 

offset

The offset of sub GArrowRecordBatch.

 

length

The length of sub GArrowRecordBatch.

 

Returns

The sub GArrowRecordBatch. It covers only from offset to offset + length range. The sub GArrowRecordBatch shares values with the base GArrowRecordBatch.

[transfer full]


garrow_record_batch_to_string ()

gchar *
garrow_record_batch_to_string (GArrowRecordBatch *record_batch,
                               GError **error);

Parameters

record_batch

A GArrowRecordBatch.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The formatted record batch content or NULL on error.

It should be freed with g_free() when no longer needed.

[nullable]

Since: 0.4.0


garrow_record_batch_add_column ()

GArrowRecordBatch *
garrow_record_batch_add_column (GArrowRecordBatch *record_batch,
                                guint i,
                                GArrowField *field,
                                GArrowArray *column,
                                GError **error);

Parameters

record_batch

A GArrowRecordBatch.

 

i

The index of the new column.

 

field

The field to be added.

 

column

The column to be added.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The newly allocated GArrowRecordBatch that has a new column or NULL on error.

[nullable][transfer full]

Since: 0.9.0


garrow_record_batch_remove_column ()

GArrowRecordBatch *
garrow_record_batch_remove_column (GArrowRecordBatch *record_batch,
                                   guint i,
                                   GError **error);

Parameters

record_batch

A GArrowRecordBatch.

 

i

The index of the new column.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The newly allocated GArrowRecordBatch that doesn't have the column or NULL on error.

[nullable][transfer full]

Since: 0.9.0


garrow_record_batch_serialize ()

GArrowBuffer *
garrow_record_batch_serialize (GArrowRecordBatch *record_batch,
                               GArrowWriteOptions *options,
                               GError **error);

Parameters

record_batch

A GArrowRecordBatch.

 

options

A GArrowWriteOptions.

[nullable]

error

Return location for a GError or NULL.

[nullable]

Returns

The newly allocated GArrowBuffer that contains a serialized record batch or NULL on error.

[nullable][transfer full]

Since: 1.0.0


garrow_record_batch_iterator_new ()

GArrowRecordBatchIterator *
garrow_record_batch_iterator_new (GList *record_batches);

Parameters

record_batches

The record batches.

[element-type GArrowRecordBatch]

Returns

A newly created GArrowRecordBatchIterator.

Since: 0.17.0


garrow_record_batch_iterator_next ()

GArrowRecordBatch *
garrow_record_batch_iterator_next (GArrowRecordBatchIterator *iterator,
                                   GError **error);

Parameters

iterator

A GArrowRecordBatchIterator.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The next GArrowRecordBatch, or NULL when the iterator is completed.

[nullable][transfer full]

Since: 0.17.0


garrow_record_batch_iterator_equal ()

gboolean
garrow_record_batch_iterator_equal (GArrowRecordBatchIterator *iterator,
                                    GArrowRecordBatchIterator *other_iterator);

Parameters

iterator

A GArrowRecordBatchIterator.

 

other_iterator

A GArrowRecordBatchIterator to be compared.

 

Returns

TRUE if both iterators are the same, FALSE otherwise.

Since: 0.17.0


garrow_record_batch_iterator_to_list ()

GList *
garrow_record_batch_iterator_to_list (GArrowRecordBatchIterator *iterator,
                                      GError **error);

Parameters

iterator

A GArrowRecordBatchIterator.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A GList contains every moved elements from the iterator.

[element-type GArrowRecordBatch][transfer full]

Since: 0.17.0

Types and Values

GARROW_TYPE_RECORD_BATCH

#define GARROW_TYPE_RECORD_BATCH (garrow_record_batch_get_type())

struct GArrowRecordBatchClass

struct GArrowRecordBatchClass {
  GObjectClass parent_class;
};

GARROW_TYPE_RECORD_BATCH_ITERATOR

#define             GARROW_TYPE_RECORD_BATCH_ITERATOR

struct GArrowRecordBatchIteratorClass

struct GArrowRecordBatchIteratorClass {
  GObjectClass parent_class;
};

GArrowRecordBatch

typedef struct _GArrowRecordBatch GArrowRecordBatch;

GArrowRecordBatchIterator

typedef struct _GArrowRecordBatchIterator GArrowRecordBatchIterator;

Property Details

The “record-batch” property

  “record-batch”             gpointer

The raw std::shared<arrow::RecordBatch> *.

Owner: GArrowRecordBatch

Flags: Write / Construct Only


The “iterator” property

  “iterator”                 gpointer

The raw arrow::RecordBatchIterator.

Owner: GArrowRecordBatchIterator

Flags: Write / Construct Only