@@ -336,6 +336,9 @@ G_BEGIN_DECLS
336336 *
337337 * #GArrowWinsorizeOptions is a class to customize the `winsorize` function.
338338 *
339+ * #GArrowZeroFillOptions is a class to customize the `utf8_zero_fill`
340+ * function.
341+ *
339342 * There are many functions to compute data on an array.
340343 */
341344
@@ -10364,6 +10367,121 @@ garrow_winsorize_options_new(void)
1036410367 return GARROW_WINSORIZE_OPTIONS (g_object_new (GARROW_TYPE_WINSORIZE_OPTIONS, nullptr ));
1036510368}
1036610369
10370+ enum {
10371+ PROP_ZERO_FILL_OPTIONS_WIDTH = 1 ,
10372+ PROP_ZERO_FILL_OPTIONS_PADDING,
10373+ };
10374+
10375+ G_DEFINE_TYPE (GArrowZeroFillOptions,
10376+ garrow_zero_fill_options,
10377+ GARROW_TYPE_FUNCTION_OPTIONS)
10378+
10379+ static void
10380+ garrow_zero_fill_options_set_property(GObject *object,
10381+ guint prop_id,
10382+ const GValue *value,
10383+ GParamSpec *pspec)
10384+ {
10385+ auto options = garrow_zero_fill_options_get_raw (GARROW_ZERO_FILL_OPTIONS (object));
10386+
10387+ switch (prop_id) {
10388+ case PROP_ZERO_FILL_OPTIONS_WIDTH:
10389+ options->width = g_value_get_int64 (value);
10390+ break ;
10391+ case PROP_ZERO_FILL_OPTIONS_PADDING:
10392+ options->padding = g_value_get_string (value);
10393+ break ;
10394+ default :
10395+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
10396+ break ;
10397+ }
10398+ }
10399+
10400+ static void
10401+ garrow_zero_fill_options_get_property (GObject *object,
10402+ guint prop_id,
10403+ GValue *value,
10404+ GParamSpec *pspec)
10405+ {
10406+ auto options = garrow_zero_fill_options_get_raw (GARROW_ZERO_FILL_OPTIONS (object));
10407+
10408+ switch (prop_id) {
10409+ case PROP_ZERO_FILL_OPTIONS_WIDTH:
10410+ g_value_set_int64 (value, options->width );
10411+ break ;
10412+ case PROP_ZERO_FILL_OPTIONS_PADDING:
10413+ g_value_set_string (value, options->padding .c_str ());
10414+ break ;
10415+ default :
10416+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
10417+ break ;
10418+ }
10419+ }
10420+
10421+ static void
10422+ garrow_zero_fill_options_init (GArrowZeroFillOptions *object)
10423+ {
10424+ auto arrow_priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE (object);
10425+ arrow_priv->options =
10426+ static_cast <arrow::compute::FunctionOptions *>(new arrow::compute::ZeroFillOptions ());
10427+ }
10428+
10429+ static void
10430+ garrow_zero_fill_options_class_init (GArrowZeroFillOptionsClass *klass)
10431+ {
10432+ auto gobject_class = G_OBJECT_CLASS (klass);
10433+
10434+ gobject_class->set_property = garrow_zero_fill_options_set_property;
10435+ gobject_class->get_property = garrow_zero_fill_options_get_property;
10436+
10437+ arrow::compute::ZeroFillOptions options;
10438+
10439+ GParamSpec *spec;
10440+ /* *
10441+ * GArrowZeroFillOptions:width:
10442+ *
10443+ * The desired string length.
10444+ *
10445+ * Since: 23.0.0
10446+ */
10447+ spec = g_param_spec_int64 (" width" ,
10448+ " Width" ,
10449+ " The desired string length" ,
10450+ G_MININT64,
10451+ G_MAXINT64,
10452+ options.width ,
10453+ static_cast <GParamFlags>(G_PARAM_READWRITE));
10454+ g_object_class_install_property (gobject_class, PROP_ZERO_FILL_OPTIONS_WIDTH, spec);
10455+
10456+ /* *
10457+ * GArrowZeroFillOptions:padding:
10458+ *
10459+ * What to pad the string with. Should be one codepoint (Unicode).
10460+ *
10461+ * Since: 23.0.0
10462+ */
10463+ spec =
10464+ g_param_spec_string (" padding" ,
10465+ " Padding" ,
10466+ " What to pad the string with. Should be one codepoint (Unicode)" ,
10467+ options.padding .c_str (),
10468+ static_cast <GParamFlags>(G_PARAM_READWRITE));
10469+ g_object_class_install_property (gobject_class, PROP_ZERO_FILL_OPTIONS_PADDING, spec);
10470+ }
10471+
10472+ /* *
10473+ * garrow_zero_fill_options_new:
10474+ *
10475+ * Returns: A newly created #GArrowZeroFillOptions.
10476+ *
10477+ * Since: 23.0.0
10478+ */
10479+ GArrowZeroFillOptions *
10480+ garrow_zero_fill_options_new (void )
10481+ {
10482+ return GARROW_ZERO_FILL_OPTIONS (g_object_new (GARROW_TYPE_ZERO_FILL_OPTIONS, nullptr ));
10483+ }
10484+
1036710485G_END_DECLS
1036810486
1036910487arrow::Result<arrow::FieldRef>
@@ -10639,6 +10757,11 @@ garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_opt
1063910757 static_cast <const arrow::compute::WinsorizeOptions *>(arrow_options);
1064010758 auto options = garrow_winsorize_options_new_raw (arrow_winsorize_options);
1064110759 return GARROW_FUNCTION_OPTIONS (options);
10760+ } else if (arrow_type_name == " ZeroFillOptions" ) {
10761+ const auto arrow_zero_fill_options =
10762+ static_cast <const arrow::compute::ZeroFillOptions *>(arrow_options);
10763+ auto options = garrow_zero_fill_options_new_raw (arrow_zero_fill_options);
10764+ return GARROW_FUNCTION_OPTIONS (options);
1064210765 } else {
1064310766 auto options = g_object_new (GARROW_TYPE_FUNCTION_OPTIONS, NULL );
1064410767 return GARROW_FUNCTION_OPTIONS (options);
@@ -11756,3 +11879,21 @@ garrow_winsorize_options_get_raw(GArrowWinsorizeOptions *options)
1175611879 return static_cast <arrow::compute::WinsorizeOptions *>(
1175711880 garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
1175811881}
11882+
11883+ GArrowZeroFillOptions *
11884+ garrow_zero_fill_options_new_raw (const arrow::compute::ZeroFillOptions *arrow_options)
11885+ {
11886+ return GARROW_ZERO_FILL_OPTIONS (g_object_new (GARROW_TYPE_ZERO_FILL_OPTIONS,
11887+ " width" ,
11888+ arrow_options->width ,
11889+ " padding" ,
11890+ arrow_options->padding .c_str (),
11891+ nullptr ));
11892+ }
11893+
11894+ arrow::compute::ZeroFillOptions *
11895+ garrow_zero_fill_options_get_raw (GArrowZeroFillOptions *options)
11896+ {
11897+ return static_cast <arrow::compute::ZeroFillOptions *>(
11898+ garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
11899+ }
0 commit comments