@@ -335,6 +335,8 @@ G_BEGIN_DECLS
335335 *
336336 * #GArrowWeekOptions is a class to customize the `week` function.
337337 *
338+ * #GArrowWinsorizeOptions is a class to customize the `winsorize` function.
339+ *
338340 * There are many functions to compute data on an array.
339341 */
340342
@@ -10451,6 +10453,124 @@ garrow_week_options_new(void)
1045110453 return GARROW_WEEK_OPTIONS (g_object_new (GARROW_TYPE_WEEK_OPTIONS, NULL ));
1045210454}
1045310455
10456+ enum {
10457+ PROP_WINSORIZE_OPTIONS_LOWER_LIMIT = 1 ,
10458+ PROP_WINSORIZE_OPTIONS_UPPER_LIMIT,
10459+ };
10460+
10461+ G_DEFINE_TYPE (GArrowWinsorizeOptions, garrow_winsorize_options, GARROW_TYPE_FUNCTION_OPTIONS)
10462+
10463+ static void
10464+ garrow_winsorize_options_set_property(GObject *object,
10465+ guint prop_id,
10466+ const GValue *value,
10467+ GParamSpec *pspec)
10468+ {
10469+ auto options = garrow_winsorize_options_get_raw (GARROW_WINSORIZE_OPTIONS (object));
10470+
10471+ switch (prop_id) {
10472+ case PROP_WINSORIZE_OPTIONS_LOWER_LIMIT:
10473+ options->lower_limit = g_value_get_double (value);
10474+ break ;
10475+ case PROP_WINSORIZE_OPTIONS_UPPER_LIMIT:
10476+ options->upper_limit = g_value_get_double (value);
10477+ break ;
10478+ default :
10479+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
10480+ break ;
10481+ }
10482+ }
10483+
10484+ static void
10485+ garrow_winsorize_options_get_property (GObject *object,
10486+ guint prop_id,
10487+ GValue *value,
10488+ GParamSpec *pspec)
10489+ {
10490+ auto options = garrow_winsorize_options_get_raw (GARROW_WINSORIZE_OPTIONS (object));
10491+
10492+ switch (prop_id) {
10493+ case PROP_WINSORIZE_OPTIONS_LOWER_LIMIT:
10494+ g_value_set_double (value, options->lower_limit );
10495+ break ;
10496+ case PROP_WINSORIZE_OPTIONS_UPPER_LIMIT:
10497+ g_value_set_double (value, options->upper_limit );
10498+ break ;
10499+ default :
10500+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
10501+ break ;
10502+ }
10503+ }
10504+
10505+ static void
10506+ garrow_winsorize_options_init (GArrowWinsorizeOptions *object)
10507+ {
10508+ auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE (object);
10509+ priv->options =
10510+ static_cast <arrow::compute::FunctionOptions *>(new arrow::compute::WinsorizeOptions ());
10511+ }
10512+
10513+ static void
10514+ garrow_winsorize_options_class_init (GArrowWinsorizeOptionsClass *klass)
10515+ {
10516+ auto gobject_class = G_OBJECT_CLASS (klass);
10517+
10518+ gobject_class->set_property = garrow_winsorize_options_set_property;
10519+ gobject_class->get_property = garrow_winsorize_options_get_property;
10520+
10521+ auto options = arrow::compute::WinsorizeOptions ();
10522+
10523+ GParamSpec *spec;
10524+ /* *
10525+ * GArrowWinsorizeOptions:lower-limit:
10526+ *
10527+ * The quantile below which all values are replaced with the quantile's value.
10528+ * For example, if lower_limit = 0.05, then all values in the lower 5% percentile
10529+ * will be replaced with the 5% percentile value.
10530+ *
10531+ * Since: 23.0.0
10532+ */
10533+ spec = g_param_spec_double (" lower-limit" ,
10534+ " Lower limit" ,
10535+ " The quantile below which all values are replaced with the quantile's value. For example, if lower_limit = 0.05, then all values in the lower 5% percentile will be replaced with the 5% percentile value" ,
10536+ 0.0 ,
10537+ 1.0 ,
10538+ options.lower_limit ,
10539+ static_cast <GParamFlags>(G_PARAM_READWRITE));
10540+ g_object_class_install_property (gobject_class, PROP_WINSORIZE_OPTIONS_LOWER_LIMIT, spec);
10541+
10542+ /* *
10543+ * GArrowWinsorizeOptions:upper-limit:
10544+ *
10545+ * The quantile above which all values are replaced with the quantile's value.
10546+ * For example, if upper_limit = 0.95, then all values in the upper 95% percentile
10547+ * will be replaced with the 95% percentile value.
10548+ *
10549+ * Since: 23.0.0
10550+ */
10551+ spec = g_param_spec_double (" upper-limit" ,
10552+ " Upper limit" ,
10553+ " The quantile above which all values are replaced with the quantile's value. For example, if upper_limit = 0.95, then all values in the upper 95% percentile will be replaced with the 95% percentile value" ,
10554+ 0.0 ,
10555+ 1.0 ,
10556+ options.upper_limit ,
10557+ static_cast <GParamFlags>(G_PARAM_READWRITE));
10558+ g_object_class_install_property (gobject_class, PROP_WINSORIZE_OPTIONS_UPPER_LIMIT, spec);
10559+ }
10560+
10561+ /* *
10562+ * garrow_winsorize_options_new:
10563+ *
10564+ * Returns: A newly created #GArrowWinsorizeOptions.
10565+ *
10566+ * Since: 23.0.0
10567+ */
10568+ GArrowWinsorizeOptions *
10569+ garrow_winsorize_options_new (void )
10570+ {
10571+ return GARROW_WINSORIZE_OPTIONS (g_object_new (GARROW_TYPE_WINSORIZE_OPTIONS, NULL ));
10572+ }
10573+
1045410574G_END_DECLS
1045510575
1045610576arrow::Result<arrow::FieldRef>
@@ -10727,6 +10847,11 @@ garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_opt
1072710847 static_cast <const arrow::compute::WeekOptions *>(arrow_options);
1072810848 auto options = garrow_week_options_new_raw (arrow_week_options);
1072910849 return GARROW_FUNCTION_OPTIONS (options);
10850+ } else if (arrow_type_name == " WinsorizeOptions" ) {
10851+ const auto arrow_winsorize_options =
10852+ static_cast <const arrow::compute::WinsorizeOptions *>(arrow_options);
10853+ auto options = garrow_winsorize_options_new_raw (arrow_winsorize_options);
10854+ return GARROW_FUNCTION_OPTIONS (options);
1073010855 } else {
1073110856 auto options = g_object_new (GARROW_TYPE_FUNCTION_OPTIONS, NULL );
1073210857 return GARROW_FUNCTION_OPTIONS (options);
@@ -11853,3 +11978,22 @@ garrow_week_options_get_raw(GArrowWeekOptions *options)
1185311978 return static_cast <arrow::compute::WeekOptions *>(
1185411979 garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
1185511980}
11981+
11982+ GArrowWinsorizeOptions *
11983+ garrow_winsorize_options_new_raw (const arrow::compute::WinsorizeOptions *arrow_options)
11984+ {
11985+ auto options = g_object_new (GARROW_TYPE_WINSORIZE_OPTIONS,
11986+ " lower-limit" ,
11987+ arrow_options->lower_limit ,
11988+ " upper-limit" ,
11989+ arrow_options->upper_limit ,
11990+ NULL );
11991+ return GARROW_WINSORIZE_OPTIONS (options);
11992+ }
11993+
11994+ arrow::compute::WinsorizeOptions *
11995+ garrow_winsorize_options_get_raw (GArrowWinsorizeOptions *options)
11996+ {
11997+ return static_cast <arrow::compute::WinsorizeOptions *>(
11998+ garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
11999+ }
0 commit comments