GArrowTable

GArrowTable — Table class

Functions

Properties

GArrowCompressionType compression Read / Write
gpointer table Write / Construct Only
gboolean promote-nullability Read / Write
gboolean unify-schemas Read / Write

Types and Values

Object Hierarchy

    GObject
    ├── GArrowFeatherWriteProperties
    ├── GArrowTable
    ╰── GArrowTableConcatenateOptions

Includes

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

Description

GArrowTableConcatenateOptions is a class for customizing garrow_table_concatenate() behavior.

GArrowTable is a class for table. Table has zero or more GArrowChunkedArrays and zero or more records.

GArrowFeatherWriteProperties is a class to customize how to write Feather data.

Functions

garrow_table_concatenate_options_new ()

GArrowTableConcatenateOptions *
garrow_table_concatenate_options_new (void);

Returns

A newly created GArrowTableConcatenateOptions.

Since: 6.0.0


garrow_table_new_values ()

GArrowTable *
garrow_table_new_values (GArrowSchema *schema,
                         GList *values,
                         GError **error);

[skip]

Parameters

schema

The schema of the table.

 

values

The values of the table. All values must be instance of the same class. Available classes are GArrowChunkedArray, GArrowArray and GArrowRecordBatch.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowTable or NULL on error.

[nullable]

Since: 0.12.0


garrow_table_new_chunked_arrays ()

GArrowTable *
garrow_table_new_chunked_arrays (GArrowSchema *schema,
                                 GArrowChunkedArray **chunked_arrays,
                                 gsize n_chunked_arrays,
                                 GError **error);

Parameters

schema

The schema of the table.

 

chunked_arrays

The chunked arrays of the table.

[array length=n_chunked_arrays]

n_chunked_arrays

The number of chunked arrays.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowTable or NULL on error.

[nullable]

Since: 0.15.0


garrow_table_new_arrays ()

GArrowTable *
garrow_table_new_arrays (GArrowSchema *schema,
                         GArrowArray **arrays,
                         gsize n_arrays,
                         GError **error);

Parameters

schema

The schema of the table.

 

arrays

The arrays of the table.

[array length=n_arrays]

n_arrays

The number of arrays.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowTable or NULL on error.

[nullable]

Since: 0.12.0


garrow_table_new_record_batches ()

GArrowTable *
garrow_table_new_record_batches (GArrowSchema *schema,
                                 GArrowRecordBatch **record_batches,
                                 gsize n_record_batches,
                                 GError **error);

Parameters

schema

The schema of the table.

 

record_batches

The record batches that have data for the table.

[array length=n_record_batches]

n_record_batches

The number of record batches.

 

error

Return location for a GError or NULL.

[nullable]

Returns

A newly created GArrowTable or NULL on error.

[nullable]

Since: 0.12.0


garrow_table_equal ()

gboolean
garrow_table_equal (GArrowTable *table,
                    GArrowTable *other_table);

Parameters

table

A GArrowTable.

 

other_table

A GArrowTable to be compared.

 

Returns

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

Since: 0.4.0


garrow_table_equal_metadata ()

gboolean
garrow_table_equal_metadata (GArrowTable *table,
                             GArrowTable *other_table,
                             gboolean check_metadata);

Parameters

table

A GArrowTable.

 

other_table

A GArrowTable 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_table_get_schema ()

GArrowSchema *
garrow_table_get_schema (GArrowTable *table);

Parameters

table

A GArrowTable.

 

Returns

The schema of the table.

[transfer full]


garrow_table_get_column_data ()

GArrowChunkedArray *
garrow_table_get_column_data (GArrowTable *table,
                              gint i);

Parameters

table

A GArrowTable.

 

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's data in the table.

[nullable][transfer full]

Since: 0.15.0


garrow_table_get_n_columns ()

guint
garrow_table_get_n_columns (GArrowTable *table);

Parameters

table

A GArrowTable.

 

Returns

The number of columns in the table.


garrow_table_get_n_rows ()

guint64
garrow_table_get_n_rows (GArrowTable *table);

Parameters

table

A GArrowTable.

 

Returns

The number of rows in the table.


garrow_table_add_column ()

GArrowTable *
garrow_table_add_column (GArrowTable *table,
                         guint i,
                         GArrowField *field,
                         GArrowChunkedArray *chunked_array,
                         GError **error);

Parameters

table

A GArrowTable.

 

i

The index of the new column.

 

field

The field for the column to be added.

 

chunked_array

The column data to be added.

 

error

Return location for a GError or NULL.

[nullable]

Returns

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

[nullable][transfer full]

Since: 0.15.0


garrow_table_remove_column ()

GArrowTable *
garrow_table_remove_column (GArrowTable *table,
                            guint i,
                            GError **error);

Parameters

table

A GArrowTable.

 

i

The index of the column to be removed.

 

error

Return location for a GError or NULL.

[nullable]

Returns

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

[nullable][transfer full]

Since: 0.3.0


garrow_table_replace_column ()

GArrowTable *
garrow_table_replace_column (GArrowTable *table,
                             guint i,
                             GArrowField *field,
                             GArrowChunkedArray *chunked_array,
                             GError **error);

Parameters

table

A GArrowTable.

 

i

The index of the column to be replaced.

 

field

The field for the new column.

 

chunked_array

The newly added column data.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The newly allocated GArrowTable that has column as the i -th column or NULL on error.

[nullable][transfer full]

Since: 0.15.0


garrow_table_to_string ()

gchar *
garrow_table_to_string (GArrowTable *table,
                        GError **error);

Parameters

table

A GArrowTable.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The formatted table content or NULL on error.

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

[nullable]

Since: 0.12.0


garrow_table_concatenate ()

GArrowTable *
garrow_table_concatenate (GArrowTable *table,
                          GList *other_tables,
                          GArrowTableConcatenateOptions *options,
                          GError **error);

Parameters

table

A GArrowTable.

 

other_tables

The tables to be concatenated.

[element-type GArrowTable]

options

The options to customize concatenation.

[nullable]

error

Return location for a GError or NULL.

[nullable]

Returns

The table concatenated vertically.

[nullable][transfer full]

Since: 0.14.0


garrow_table_slice ()

GArrowTable *
garrow_table_slice (GArrowTable *table,
                    gint64 offset,
                    gint64 length);

Parameters

table

A GArrowTable.

 

offset

The offset of sub GArrowTable. If the offset is negative, the offset is counted from the last.

 

length

The length of sub GArrowTable.

 

Returns

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

[transfer full]

Since: 0.14.0


garrow_table_combine_chunks ()

GArrowTable *
garrow_table_combine_chunks (GArrowTable *table,
                             GError **error);

Parameters

table

A GArrowTable.

 

error

Return location for a GError or NULL.

[nullable]

Returns

The GArrowTable with chunks combined, or NULL on error.

[nullable][transfer full]

Since: 0.16.0


garrow_feather_write_properties_new ()

GArrowFeatherWriteProperties *
garrow_feather_write_properties_new (void);

Returns

A newly created GArrowFeatherWriteProperties.

Since: 0.17.0


garrow_table_write_as_feather ()

gboolean
garrow_table_write_as_feather (GArrowTable *table,
                               GArrowOutputStream *sink,
                               GArrowFeatherWriteProperties *properties,
                               GError **error);

Writes the table as Feather format data to the sink .

Parameters

table

A GArrowTable.

 

sink

The output.

 

properties

The properties for this write.

[nullable]

error

Return location for a GError or NULL.

[nullable]

Returns

TRUE on success, FALSE if there was an error.

Since: 0.17.0

Types and Values

GARROW_TYPE_TABLE_CONCATENATE_OPTIONS

#define             GARROW_TYPE_TABLE_CONCATENATE_OPTIONS

struct GArrowTableConcatenateOptionsClass

struct GArrowTableConcatenateOptionsClass {
  GObjectClass parent_class;
};

GARROW_TYPE_TABLE

#define GARROW_TYPE_TABLE (garrow_table_get_type())

struct GArrowTableClass

struct GArrowTableClass {
  GObjectClass parent_class;
};

GARROW_TYPE_FEATHER_WRITE_PROPERTIES

#define             GARROW_TYPE_FEATHER_WRITE_PROPERTIES

struct GArrowFeatherWritePropertiesClass

struct GArrowFeatherWritePropertiesClass {
  GObjectClass parent_class;
};

GArrowFeatherWriteProperties

typedef struct _GArrowFeatherWriteProperties GArrowFeatherWriteProperties;

GArrowTable

typedef struct _GArrowTable GArrowTable;

GArrowTableConcatenateOptions

typedef struct _GArrowTableConcatenateOptions GArrowTableConcatenateOptions;

Property Details

The “compression” property

  “compression”              GArrowCompressionType

Compression type to use. Only GARROW_COMPRESSION_TYPE_UNCOMPRESSED, GARROW_COMPRESSION_TYPE_LZ4 and GARROW_COMPRESSION_TYPE_ZSTD are supported. The default compression is GARROW_COMPRESSION_TYPE_LZ4 if Apache Arrow C++ is built with support for it, otherwise GARROW_COMPRESSION_TYPE_UNCOMPRESSED. GARROW_COMPRESSION_TYPE_UNCOMPRESSED is set as the object default here.

Owner: GArrowFeatherWriteProperties

Flags: Read / Write

Default value: GARROW_COMPRESSION_TYPE_LZO

Since: 0.17.0


The “table” property

  “table”                    gpointer

The raw std::shared_ptr<arrow::Table> *.

Owner: GArrowTable

Flags: Write / Construct Only


The “promote-nullability” property

  “promote-nullability”      gboolean

If true, a GArrowField of GArrowNullDataType can be unified with a GArrowField of another type. The unified field will be of the other type and become nullable. Nullability will be promoted to the looser option (nullable if one is not nullable).

Owner: GArrowTableConcatenateOptions

Flags: Read / Write

Default value: TRUE

Since: 6.0.0


The “unify-schemas” property

  “unify-schemas”            gboolean

If true, the schemas of the tables will be first unified with fields of the same name being merged, according to “promote-nullability”, then each table will be promoted to the unified schema before being concatenated.

Otherwise, all tables should have the same schema. Each column in the output table is the result of concatenating the corresponding columns in all input tables.

Owner: GArrowTableConcatenateOptions

Flags: Read / Write

Default value: FALSE

Since: 6.0.0