Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
0ff5c2d
Changed Starts/EndsWith to starts/ends_with.
Jonahkel Dec 19, 2025
e8ec20f
Passes unit and style checks
Jonahkel Dec 21, 2025
08ea769
Removed unnecessary StartsWith, EndsWith utility functions
Jonahkel Dec 21, 2025
b1cbecd
GH-48555: [C++] Use FetchContent for bundled opentelemetry (#48556)
raulcd Dec 19, 2025
e4a3fb5
GH-48579: [Ruby] Add support for reading duration array (#48580)
kou Dec 19, 2025
6b5dc9e
GH-47797: [CI][Python] Update Python installs for free-threaded wheel…
AlenkaF Dec 19, 2025
4bf59c9
MINOR: [C++] Fix typos in telemetry and compute comments (#48562)
tennisleng Dec 19, 2025
b796fd2
MINOR: [C++] Fix C++17-related comments (#48598)
pitrou Dec 19, 2025
58da4ed
MINOR: Fix Typos in Documentation for Grouped Aggregations and Cache …
kilavvy Dec 19, 2025
d16e42e
GH-48463: [Python] Improve error message in CheckTypeExact arrow_to_p…
HyukjinKwon Dec 19, 2025
4a286eb
GH-48570: [C++] Add Missing Fuzz Sources to Meson configuration (#48571)
WillAyd Dec 19, 2025
4d2cd87
GH-48486: [GLib][Ruby] Add GArrowListFlattenOptions (#48487)
stenlarsson Dec 19, 2025
e1e4c0e
GH-48602: [Ruby] Add support for reading interval arrays (#48603)
kou Dec 20, 2025
bcaaf82
GH-48478: [Ruby] Fix Ruby list inference for nested non-negative inte…
hypsakata Dec 20, 2025
81b03ca
GH-48610: [Ruby] Add FixedSizeListArray glue (#48609)
stenlarsson Dec 21, 2025
d12020e
GH-48492: [GLib][Ruby] Add MapLookupOptions (#48513)
stenlarsson Dec 22, 2025
d3ba769
GH-48612: [Ruby] Add support for reading streaming format (#48613)
kou Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
316 changes: 316 additions & 0 deletions c_glib/arrow-glib/compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ G_BEGIN_DECLS
* #GArrowJoinOptions is a class to customize the `binary_join_element_wise`
* function.
*
* #GArrowListFlattenOptions is a class to customize the `list_flatten`
* function.
*
* #GArrowMapLookupOptions is a class to customize the `map_lookup`
* function.
*
* There are many functions to compute data on an array.
*/

Expand Down Expand Up @@ -7400,6 +7406,264 @@ garrow_join_options_new(void)
return GARROW_JOIN_OPTIONS(options);
}

enum {
PROP_LIST_FLATTEN_OPTIONS_RECURSIVE = 1,
};

G_DEFINE_TYPE(GArrowListFlattenOptions,
garrow_list_flatten_options,
GARROW_TYPE_FUNCTION_OPTIONS)

static void
garrow_list_flatten_options_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
auto options = garrow_list_flatten_options_get_raw(GARROW_LIST_FLATTEN_OPTIONS(object));

switch (prop_id) {
case PROP_LIST_FLATTEN_OPTIONS_RECURSIVE:
options->recursive = g_value_get_boolean(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}

static void
garrow_list_flatten_options_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
auto options = garrow_list_flatten_options_get_raw(GARROW_LIST_FLATTEN_OPTIONS(object));

switch (prop_id) {
case PROP_LIST_FLATTEN_OPTIONS_RECURSIVE:
g_value_set_boolean(value, options->recursive);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}

static void
garrow_list_flatten_options_init(GArrowListFlattenOptions *object)
{
auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object);
priv->options = static_cast<arrow::compute::FunctionOptions *>(
new arrow::compute::ListFlattenOptions());
}

static void
garrow_list_flatten_options_class_init(GArrowListFlattenOptionsClass *klass)
{
auto gobject_class = G_OBJECT_CLASS(klass);

gobject_class->set_property = garrow_list_flatten_options_set_property;
gobject_class->get_property = garrow_list_flatten_options_get_property;

arrow::compute::ListFlattenOptions options;

GParamSpec *spec;
/**
* GArrowListFlattenOptions:recursive:
*
* If true, the list is flattened recursively until a non-list array is formed.
*
* Since: 23.0.0
*/
spec = g_param_spec_boolean(
"recursive",
"Recursive",
"If true, the list is flattened recursively until a non-list array is formed",
options.recursive,
static_cast<GParamFlags>(G_PARAM_READWRITE));
g_object_class_install_property(gobject_class,
PROP_LIST_FLATTEN_OPTIONS_RECURSIVE,
spec);
}

/**
* garrow_list_flatten_options_new:
*
* Returns: A newly created #GArrowListFlattenOptions.
*
* Since: 23.0.0
*/
GArrowListFlattenOptions *
garrow_list_flatten_options_new(void)
{
auto options = g_object_new(GARROW_TYPE_LIST_FLATTEN_OPTIONS, NULL);
return GARROW_LIST_FLATTEN_OPTIONS(options);
}

typedef struct GArrowMapLookupOptionsPrivate_
{
GArrowScalar *query_key;
} GArrowMapLookupOptionsPrivate;

enum {
PROP_MAP_LOOKUP_OPTIONS_QUERY_KEY = 1,
PROP_MAP_LOOKUP_OPTIONS_OCCURRENCE,
};

G_DEFINE_TYPE_WITH_PRIVATE(GArrowMapLookupOptions,
garrow_map_lookup_options,
GARROW_TYPE_FUNCTION_OPTIONS)

#define GARROW_MAP_LOOKUP_OPTIONS_GET_PRIVATE(object) \
static_cast<GArrowMapLookupOptionsPrivate *>( \
garrow_map_lookup_options_get_instance_private(GARROW_MAP_LOOKUP_OPTIONS(object)))

static void
garrow_map_lookup_options_dispose(GObject *object)
{
auto priv = GARROW_MAP_LOOKUP_OPTIONS_GET_PRIVATE(object);

if (priv->query_key) {
g_object_unref(priv->query_key);
priv->query_key = NULL;
}

G_OBJECT_CLASS(garrow_map_lookup_options_parent_class)->dispose(object);
}

static void
garrow_map_lookup_options_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
auto priv = GARROW_MAP_LOOKUP_OPTIONS_GET_PRIVATE(object);
auto options = garrow_map_lookup_options_get_raw(GARROW_MAP_LOOKUP_OPTIONS(object));

switch (prop_id) {
case PROP_MAP_LOOKUP_OPTIONS_QUERY_KEY:
{
auto query_key = g_value_get_object(value);
if (priv->query_key != query_key) {
if (priv->query_key) {
g_object_unref(priv->query_key);
}
priv->query_key = GARROW_SCALAR(query_key);
if (priv->query_key) {
g_object_ref(priv->query_key);
options->query_key = garrow_scalar_get_raw(priv->query_key);
} else {
options->query_key = nullptr;
}
}
}
break;
case PROP_MAP_LOOKUP_OPTIONS_OCCURRENCE:
options->occurrence =
static_cast<arrow::compute::MapLookupOptions::Occurrence>(g_value_get_enum(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}

static void
garrow_map_lookup_options_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
auto priv = GARROW_MAP_LOOKUP_OPTIONS_GET_PRIVATE(object);
auto options = garrow_map_lookup_options_get_raw(GARROW_MAP_LOOKUP_OPTIONS(object));

switch (prop_id) {
case PROP_MAP_LOOKUP_OPTIONS_QUERY_KEY:
g_value_set_object(value, priv->query_key);
break;
case PROP_MAP_LOOKUP_OPTIONS_OCCURRENCE:
g_value_set_enum(value, static_cast<GArrowMapLookupOccurrence>(options->occurrence));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}

static void
garrow_map_lookup_options_init(GArrowMapLookupOptions *object)
{
auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object);
priv->options = static_cast<arrow::compute::FunctionOptions *>(
new arrow::compute::MapLookupOptions());
}

static void
garrow_map_lookup_options_class_init(GArrowMapLookupOptionsClass *klass)
{
auto gobject_class = G_OBJECT_CLASS(klass);

gobject_class->dispose = garrow_map_lookup_options_dispose;
gobject_class->set_property = garrow_map_lookup_options_set_property;
gobject_class->get_property = garrow_map_lookup_options_get_property;

arrow::compute::MapLookupOptions options;

GParamSpec *spec;
/**
* GArrowMapLookupOptions:query-key:
*
* The key to lookup in the map.
*
* Since: 23.0.0
*/
spec = g_param_spec_object("query-key",
"Query key",
"The key to lookup in the map",
GARROW_TYPE_SCALAR,
static_cast<GParamFlags>(G_PARAM_READWRITE));
g_object_class_install_property(gobject_class, PROP_MAP_LOOKUP_OPTIONS_QUERY_KEY, spec);

/**
* GArrowMapLookupOptions:occurrence:
*
* Whether to return the first, last, or all matching values.
*
* Since: 23.0.0
*/
spec = g_param_spec_enum("occurrence",
"Occurrence",
"Whether to return the first, last, or all matching values",
GARROW_TYPE_MAP_LOOKUP_OCCURRENCE,
static_cast<GArrowMapLookupOccurrence>(options.occurrence),
static_cast<GParamFlags>(G_PARAM_READWRITE));
g_object_class_install_property(gobject_class,
PROP_MAP_LOOKUP_OPTIONS_OCCURRENCE,
spec);
}

/**
* garrow_map_lookup_options_new:
* @query_key: (nullable): A #GArrowScalar to be looked up.
* @occurrence: A #GArrowMapLookupOccurrence.
*
* Returns: A newly created #GArrowMapLookupOptions.
*
* Since: 23.0.0
*/
GArrowMapLookupOptions *
garrow_map_lookup_options_new(GArrowScalar *query_key,
GArrowMapLookupOccurrence occurrence)
{
return GARROW_MAP_LOOKUP_OPTIONS(g_object_new(GARROW_TYPE_MAP_LOOKUP_OPTIONS,
"query-key",
query_key,
"occurrence",
occurrence,
NULL));
}

G_END_DECLS

arrow::Result<arrow::FieldRef>
Expand Down Expand Up @@ -7574,6 +7838,16 @@ garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_opt
static_cast<const arrow::compute::JoinOptions *>(arrow_options);
auto options = garrow_join_options_new_raw(arrow_join_options);
return GARROW_FUNCTION_OPTIONS(options);
} else if (arrow_type_name == "ListFlattenOptions") {
const auto arrow_list_flatten_options =
static_cast<const arrow::compute::ListFlattenOptions *>(arrow_options);
auto options = garrow_list_flatten_options_new_raw(arrow_list_flatten_options);
return GARROW_FUNCTION_OPTIONS(options);
} else if (arrow_type_name == "MapLookupOptions") {
const auto arrow_map_lookup_options =
static_cast<const arrow::compute::MapLookupOptions *>(arrow_options);
auto options = garrow_map_lookup_options_new_raw(arrow_map_lookup_options);
return GARROW_FUNCTION_OPTIONS(options);
} else {
auto options = g_object_new(GARROW_TYPE_FUNCTION_OPTIONS, NULL);
return GARROW_FUNCTION_OPTIONS(options);
Expand Down Expand Up @@ -8250,3 +8524,45 @@ garrow_join_options_get_raw(GArrowJoinOptions *options)
return static_cast<arrow::compute::JoinOptions *>(
garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options)));
}

GArrowListFlattenOptions *
garrow_list_flatten_options_new_raw(
const arrow::compute::ListFlattenOptions *arrow_options)
{
return GARROW_LIST_FLATTEN_OPTIONS(g_object_new(GARROW_TYPE_LIST_FLATTEN_OPTIONS,
"recursive",
arrow_options->recursive,
NULL));
}

arrow::compute::ListFlattenOptions *
garrow_list_flatten_options_get_raw(GArrowListFlattenOptions *options)
{
return static_cast<arrow::compute::ListFlattenOptions *>(
garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options)));
}

GArrowMapLookupOptions *
garrow_map_lookup_options_new_raw(const arrow::compute::MapLookupOptions *arrow_options)
{
GArrowScalar *query_key = nullptr;
if (arrow_options->query_key) {
auto arrow_query_key = arrow_options->query_key;
query_key = garrow_scalar_new_raw(&arrow_query_key);
}
GArrowMapLookupOccurrence occurrence =
static_cast<GArrowMapLookupOccurrence>(arrow_options->occurrence);
return GARROW_MAP_LOOKUP_OPTIONS(g_object_new(GARROW_TYPE_MAP_LOOKUP_OPTIONS,
"query-key",
query_key,
"occurrence",
occurrence,
NULL));
}

arrow::compute::MapLookupOptions *
garrow_map_lookup_options_get_raw(GArrowMapLookupOptions *options)
{
return static_cast<arrow::compute::MapLookupOptions *>(
garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options)));
}
50 changes: 50 additions & 0 deletions c_glib/arrow-glib/compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -1322,4 +1322,54 @@ GARROW_AVAILABLE_IN_23_0
GArrowJoinOptions *
garrow_join_options_new(void);

#define GARROW_TYPE_LIST_FLATTEN_OPTIONS (garrow_list_flatten_options_get_type())
GARROW_AVAILABLE_IN_23_0
G_DECLARE_DERIVABLE_TYPE(GArrowListFlattenOptions,
garrow_list_flatten_options,
GARROW,
LIST_FLATTEN_OPTIONS,
GArrowFunctionOptions)
struct _GArrowListFlattenOptionsClass
{
GArrowFunctionOptionsClass parent_class;
};

GARROW_AVAILABLE_IN_23_0
GArrowListFlattenOptions *
garrow_list_flatten_options_new(void);

/**
* GArrowMapLookupOccurrence:
* @GARROW_MAP_LOOKUP_OCCURRENCE_FIRST: Return the first matching value.
* @GARROW_MAP_LOOKUP_OCCURRENCE_LAST: Return the last matching value.
* @GARROW_MAP_LOOKUP_OCCURRENCE_ALL: Return all matching values.
*
* They correspond to the values of
* `arrow::compute::MapLookupOptions::Occurrence`.
*
* Since: 23.0.0
*/
typedef enum {
GARROW_MAP_LOOKUP_OCCURRENCE_FIRST,
GARROW_MAP_LOOKUP_OCCURRENCE_LAST,
GARROW_MAP_LOOKUP_OCCURRENCE_ALL,
} GArrowMapLookupOccurrence;

#define GARROW_TYPE_MAP_LOOKUP_OPTIONS (garrow_map_lookup_options_get_type())
GARROW_AVAILABLE_IN_23_0
G_DECLARE_DERIVABLE_TYPE(GArrowMapLookupOptions,
garrow_map_lookup_options,
GARROW,
MAP_LOOKUP_OPTIONS,
GArrowFunctionOptions)
struct _GArrowMapLookupOptionsClass
{
GArrowFunctionOptionsClass parent_class;
};

GARROW_AVAILABLE_IN_23_0
GArrowMapLookupOptions *
garrow_map_lookup_options_new(GArrowScalar *query_key,
GArrowMapLookupOccurrence occurrence);

G_END_DECLS
Loading