kou commented on code in PR #48528:
URL: https://github.com/apache/arrow/pull/48528#discussion_r2654992486
##########
c_glib/arrow-glib/compute.cpp:
##########
@@ -7091,6 +7094,119 @@ garrow_extract_regex_options_new(void)
return GARROW_EXTRACT_REGEX_OPTIONS(options);
}
+enum {
+ PROP_SPLIT_OPTIONS_MAX_SPLITS = 1,
+ PROP_SPLIT_OPTIONS_REVERSE,
+};
+
+G_DEFINE_TYPE(GArrowSplitOptions, garrow_split_options,
GARROW_TYPE_FUNCTION_OPTIONS)
+
+static void
+garrow_split_options_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ auto options = garrow_split_options_get_raw(GARROW_SPLIT_OPTIONS(object));
+
+ switch (prop_id) {
+ case PROP_SPLIT_OPTIONS_MAX_SPLITS:
+ options->max_splits = g_value_get_int64(value);
+ break;
+ case PROP_SPLIT_OPTIONS_REVERSE:
+ options->reverse = g_value_get_boolean(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_split_options_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ auto options = garrow_split_options_get_raw(GARROW_SPLIT_OPTIONS(object));
+
+ switch (prop_id) {
+ case PROP_SPLIT_OPTIONS_MAX_SPLITS:
+ g_value_set_int64(value, options->max_splits);
+ break;
+ case PROP_SPLIT_OPTIONS_REVERSE:
+ g_value_set_boolean(value, options->reverse);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+garrow_split_options_init(GArrowSplitOptions *object)
+{
+ auto arrow_priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object);
+ arrow_priv->options =
+ static_cast<arrow::compute::FunctionOptions *>(new
arrow::compute::SplitOptions());
+}
+
+static void
+garrow_split_options_class_init(GArrowSplitOptionsClass *klass)
+{
+ auto gobject_class = G_OBJECT_CLASS(klass);
+
+ gobject_class->set_property = garrow_split_options_set_property;
+ gobject_class->get_property = garrow_split_options_get_property;
+
+ arrow::compute::SplitOptions options;
+
+ GParamSpec *spec;
+ /**
+ * GArrowSplitOptions:max-splits:
+ *
+ * Maximum number of splits allowed, or unlimited when -1.
+ *
+ * Since: 23.0.0
+ */
+ spec = g_param_spec_int64("max-splits",
+ "Max splits",
+ "Maximum number of splits allowed, or unlimited
when -1",
+ G_MININT64,
Review Comment:
How about using `-1` as the minimum value?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]