@@ -264,6 +264,8 @@ G_BEGIN_DECLS
264264 * #GArrowElementWiseAggregateOptions is a class to customize element-wise
265265 * aggregate functions such as `min_element_wise` and `max_element_wise`.
266266 *
267+ * #GArrowDayOfWeekOptions is a class to customize the `day_of_week` function.
268+ *
267269 * There are many functions to compute data on an array.
268270 */
269271
@@ -6869,6 +6871,127 @@ garrow_element_wise_aggregate_options_new(void)
68696871 return GARROW_ELEMENT_WISE_AGGREGATE_OPTIONS (options);
68706872}
68716873
6874+ enum {
6875+ PROP_DAY_OF_WEEK_OPTIONS_COUNT_FROM_ZERO = 1 ,
6876+ PROP_DAY_OF_WEEK_OPTIONS_WEEK_START,
6877+ };
6878+
6879+ G_DEFINE_TYPE (GArrowDayOfWeekOptions,
6880+ garrow_day_of_week_options,
6881+ GARROW_TYPE_FUNCTION_OPTIONS)
6882+
6883+ static void
6884+ garrow_day_of_week_options_set_property(GObject *object,
6885+ guint prop_id,
6886+ const GValue *value,
6887+ GParamSpec *pspec)
6888+ {
6889+ auto options = garrow_day_of_week_options_get_raw (GARROW_DAY_OF_WEEK_OPTIONS (object));
6890+
6891+ switch (prop_id) {
6892+ case PROP_DAY_OF_WEEK_OPTIONS_COUNT_FROM_ZERO:
6893+ options->count_from_zero = g_value_get_boolean (value);
6894+ break ;
6895+ case PROP_DAY_OF_WEEK_OPTIONS_WEEK_START:
6896+ options->week_start = g_value_get_uint (value);
6897+ break ;
6898+ default :
6899+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
6900+ break ;
6901+ }
6902+ }
6903+
6904+ static void
6905+ garrow_day_of_week_options_get_property (GObject *object,
6906+ guint prop_id,
6907+ GValue *value,
6908+ GParamSpec *pspec)
6909+ {
6910+ auto options = garrow_day_of_week_options_get_raw (GARROW_DAY_OF_WEEK_OPTIONS (object));
6911+
6912+ switch (prop_id) {
6913+ case PROP_DAY_OF_WEEK_OPTIONS_COUNT_FROM_ZERO:
6914+ g_value_set_boolean (value, options->count_from_zero );
6915+ break ;
6916+ case PROP_DAY_OF_WEEK_OPTIONS_WEEK_START:
6917+ g_value_set_uint (value, options->week_start );
6918+ break ;
6919+ default :
6920+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
6921+ break ;
6922+ }
6923+ }
6924+
6925+ static void
6926+ garrow_day_of_week_options_init (GArrowDayOfWeekOptions *object)
6927+ {
6928+ auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE (object);
6929+ priv->options = static_cast <arrow::compute::FunctionOptions *>(
6930+ new arrow::compute::DayOfWeekOptions ());
6931+ }
6932+
6933+ static void
6934+ garrow_day_of_week_options_class_init (GArrowDayOfWeekOptionsClass *klass)
6935+ {
6936+ auto gobject_class = G_OBJECT_CLASS (klass);
6937+
6938+ gobject_class->set_property = garrow_day_of_week_options_set_property;
6939+ gobject_class->get_property = garrow_day_of_week_options_get_property;
6940+
6941+ arrow::compute::DayOfWeekOptions options;
6942+
6943+ GParamSpec *spec;
6944+ /* *
6945+ * GArrowDayOfWeekOptions:count-from-zero:
6946+ *
6947+ * Number days from 0 if true and from 1 if false.
6948+ *
6949+ * Since: 23.0.0
6950+ */
6951+ spec = g_param_spec_boolean (" count-from-zero" ,
6952+ " Count from zero" ,
6953+ " Number days from 0 if true and from 1 if false" ,
6954+ options.count_from_zero ,
6955+ static_cast <GParamFlags>(G_PARAM_READWRITE));
6956+ g_object_class_install_property (gobject_class,
6957+ PROP_DAY_OF_WEEK_OPTIONS_COUNT_FROM_ZERO,
6958+ spec);
6959+
6960+ /* *
6961+ * GArrowDayOfWeekOptions:week-start:
6962+ *
6963+ * What day does the week start with (Monday=1, Sunday=7).
6964+ * The numbering is unaffected by the count_from_zero parameter.
6965+ *
6966+ * Since: 23.0.0
6967+ */
6968+ spec = g_param_spec_uint (" week-start" ,
6969+ " Week start" ,
6970+ " What day does the week start with (Monday=1, Sunday=7). The "
6971+ " numbering is unaffected by the count_from_zero parameter" ,
6972+ 1 ,
6973+ 7 ,
6974+ options.week_start ,
6975+ static_cast <GParamFlags>(G_PARAM_READWRITE));
6976+ g_object_class_install_property (gobject_class,
6977+ PROP_DAY_OF_WEEK_OPTIONS_WEEK_START,
6978+ spec);
6979+ }
6980+
6981+ /* *
6982+ * garrow_day_of_week_options_new:
6983+ *
6984+ * Returns: A newly created #GArrowDayOfWeekOptions.
6985+ *
6986+ * Since: 23.0.0
6987+ */
6988+ GArrowDayOfWeekOptions *
6989+ garrow_day_of_week_options_new (void )
6990+ {
6991+ auto options = g_object_new (GARROW_TYPE_DAY_OF_WEEK_OPTIONS, NULL );
6992+ return GARROW_DAY_OF_WEEK_OPTIONS (options);
6993+ }
6994+
68726995G_END_DECLS
68736996
68746997arrow::Result<arrow::FieldRef>
@@ -7022,6 +7145,11 @@ garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_opt
70227145 auto options =
70237146 garrow_element_wise_aggregate_options_new_raw (arrow_element_wise_aggregate_options);
70247147 return GARROW_FUNCTION_OPTIONS (options);
7148+ } else if (arrow_type_name == " DayOfWeekOptions" ) {
7149+ const auto arrow_day_of_week_options =
7150+ static_cast <const arrow::compute::DayOfWeekOptions *>(arrow_options);
7151+ auto options = garrow_day_of_week_options_new_raw (arrow_day_of_week_options);
7152+ return GARROW_FUNCTION_OPTIONS (options);
70257153 } else {
70267154 auto options = g_object_new (GARROW_TYPE_FUNCTION_OPTIONS, NULL );
70277155 return GARROW_FUNCTION_OPTIONS (options);
@@ -7626,3 +7754,21 @@ garrow_element_wise_aggregate_options_get_raw(GArrowElementWiseAggregateOptions
76267754 return static_cast <arrow::compute::ElementWiseAggregateOptions *>(
76277755 garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
76287756}
7757+
7758+ GArrowDayOfWeekOptions *
7759+ garrow_day_of_week_options_new_raw (const arrow::compute::DayOfWeekOptions *arrow_options)
7760+ {
7761+ return GARROW_DAY_OF_WEEK_OPTIONS (g_object_new (GARROW_TYPE_DAY_OF_WEEK_OPTIONS,
7762+ " count-from-zero" ,
7763+ arrow_options->count_from_zero ,
7764+ " week-start" ,
7765+ arrow_options->week_start ,
7766+ NULL ));
7767+ }
7768+
7769+ arrow::compute::DayOfWeekOptions *
7770+ garrow_day_of_week_options_get_raw (GArrowDayOfWeekOptions *options)
7771+ {
7772+ return static_cast <arrow::compute::DayOfWeekOptions *>(
7773+ garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
7774+ }
0 commit comments