@@ -165,6 +165,9 @@ G_BEGIN_DECLS
165165 * #GArrowSortOptions is a class to customize the `sort_indices`
166166 * function.
167167 *
168+ * #GArrowSetLookupOptions is a class to customize the `is_in` function
169+ * and `index_in` function.
170+ *
168171 * There are many functions to compute data on an array.
169172 */
170173
@@ -2417,6 +2420,157 @@ garrow_sort_options_set_sort_keys(GArrowSortOptions *options,
24172420}
24182421
24192422
2423+ typedef struct GArrowSetLookupOptionsPrivate_ {
2424+ GArrowDatum *value_set;
2425+ } GArrowSetLookupOptionsPrivate;
2426+
2427+ enum {
2428+ PROP_SET_LOOKUP_OPTIONS_VALUE_SET = 1 ,
2429+ PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS,
2430+ };
2431+
2432+ G_DEFINE_TYPE_WITH_PRIVATE (GArrowSetLookupOptions,
2433+ garrow_set_lookup_options,
2434+ GARROW_TYPE_FUNCTION_OPTIONS)
2435+
2436+ #define GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE (object ) \
2437+ static_cast <GArrowSetLookupOptionsPrivate *>( \
2438+ garrow_set_lookup_options_get_instance_private ( \
2439+ GARROW_SET_LOOKUP_OPTIONS (object)))
2440+
2441+ static void
2442+ garrow_set_lookup_options_dispose(GObject *object)
2443+ {
2444+ auto priv = GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE (object);
2445+
2446+ if (priv->value_set ) {
2447+ g_object_unref (priv->value_set );
2448+ priv->value_set = NULL ;
2449+ }
2450+
2451+ G_OBJECT_CLASS (garrow_set_lookup_options_parent_class)->dispose (object);
2452+ }
2453+
2454+ static void
2455+ garrow_set_lookup_options_set_property (GObject *object,
2456+ guint prop_id,
2457+ const GValue *value,
2458+ GParamSpec *pspec)
2459+ {
2460+ auto priv = GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE (object);
2461+ auto options =
2462+ garrow_set_lookup_options_get_raw (GARROW_SET_LOOKUP_OPTIONS (object));
2463+
2464+ switch (prop_id) {
2465+ case PROP_SET_LOOKUP_OPTIONS_VALUE_SET:
2466+ priv->value_set = GARROW_DATUM (g_value_dup_object (value));
2467+ options->value_set = garrow_datum_get_raw (priv->value_set );
2468+ break ;
2469+ case PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS:
2470+ options->skip_nulls = g_value_get_boolean (value);
2471+ break ;
2472+ default :
2473+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2474+ break ;
2475+ }
2476+ }
2477+
2478+ static void
2479+ garrow_set_lookup_options_get_property (GObject *object,
2480+ guint prop_id,
2481+ GValue *value,
2482+ GParamSpec *pspec)
2483+ {
2484+ auto priv = GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE (object);
2485+ auto options =
2486+ garrow_set_lookup_options_get_raw (GARROW_SET_LOOKUP_OPTIONS (object));
2487+
2488+ switch (prop_id) {
2489+ case PROP_SET_LOOKUP_OPTIONS_VALUE_SET:
2490+ g_value_set_object (value, priv->value_set );
2491+ break ;
2492+ case PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS:
2493+ g_value_set_boolean (value, options->skip_nulls );
2494+ break ;
2495+ default :
2496+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
2497+ break ;
2498+ }
2499+ }
2500+
2501+ static void
2502+ garrow_set_lookup_options_init (GArrowSetLookupOptions *object)
2503+ {
2504+ auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE (object);
2505+ priv->options = static_cast <arrow::compute::FunctionOptions *>(
2506+ new arrow::compute::SetLookupOptions ());
2507+ }
2508+
2509+ static void
2510+ garrow_set_lookup_options_class_init (GArrowSetLookupOptionsClass *klass)
2511+ {
2512+ auto gobject_class = G_OBJECT_CLASS (klass);
2513+
2514+ gobject_class->dispose = garrow_set_lookup_options_dispose;
2515+ gobject_class->set_property = garrow_set_lookup_options_set_property;
2516+ gobject_class->get_property = garrow_set_lookup_options_get_property;
2517+
2518+
2519+ arrow::compute::SetLookupOptions options;
2520+
2521+ GParamSpec *spec;
2522+ /* *
2523+ * GArrowSetLookupOptions:value-set:
2524+ *
2525+ * The set of values to look up input values into.
2526+ *
2527+ * Since: 6.0.0
2528+ */
2529+ spec = g_param_spec_object (" value-set" ,
2530+ " Value set" ,
2531+ " The set of values to look up input values into" ,
2532+ GARROW_TYPE_DATUM,
2533+ static_cast <GParamFlags>(G_PARAM_READWRITE |
2534+ G_PARAM_CONSTRUCT_ONLY));
2535+ g_object_class_install_property (gobject_class,
2536+ PROP_SET_LOOKUP_OPTIONS_VALUE_SET,
2537+ spec);
2538+
2539+ /* *
2540+ * GArrowSetLookupOptions:skip-nulls:
2541+ *
2542+ * Whether NULLs are skipped or not.
2543+ *
2544+ * Since: 6.0.0
2545+ */
2546+ spec = g_param_spec_boolean (" skip-nulls" ,
2547+ " Skip NULLs" ,
2548+ " Whether NULLs are skipped or not" ,
2549+ options.skip_nulls ,
2550+ static_cast <GParamFlags>(G_PARAM_READWRITE));
2551+ g_object_class_install_property (gobject_class,
2552+ PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS,
2553+ spec);
2554+ }
2555+
2556+ /* *
2557+ * garrow_set_lookup_options_new:
2558+ * @value_set: A #GArrowArrayDatum or #GArrowChunkedArrayDatum to be looked up.
2559+ *
2560+ * Returns: A newly created #GArrowSetLookupOptions.
2561+ *
2562+ * Since: 6.0.0
2563+ */
2564+ GArrowSetLookupOptions *
2565+ garrow_set_lookup_options_new (GArrowDatum *value_set)
2566+ {
2567+ return GARROW_SET_LOOKUP_OPTIONS (
2568+ g_object_new (GARROW_TYPE_SET_LOOKUP_OPTIONS,
2569+ " value-set" , value_set,
2570+ NULL ));
2571+ }
2572+
2573+
24202574/* *
24212575 * garrow_array_cast:
24222576 * @array: A #GArrowArray.
@@ -3755,3 +3909,12 @@ garrow_sort_options_get_raw(GArrowSortOptions *options)
37553909 return static_cast <arrow::compute::SortOptions *>(
37563910 garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
37573911}
3912+
3913+ arrow::compute::SetLookupOptions *
3914+ garrow_set_lookup_options_get_raw (GArrowSetLookupOptions *options)
3915+ {
3916+ return static_cast <arrow::compute::SetLookupOptions *>(
3917+ garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
3918+ }
3919+
3920+
0 commit comments