@@ -306,6 +306,9 @@ G_BEGIN_DECLS
306306 * #GArrowPivotWiderOptions is a class to customize the `pivot_wider` and
307307 * `hash_pivot_wider` functions.
308308 *
309+ * #GArrowRankQuantileOptions is a class to customize the `rank_quantile` and
310+ * `rank_normal` functions.
311+ *
309312 * There are many functions to compute data on an array.
310313 */
311314
@@ -8762,6 +8765,155 @@ garrow_pivot_wider_options_new(void)
87628765 g_object_new (GARROW_TYPE_PIVOT_WIDER_OPTIONS, nullptr ));
87638766}
87648767
8768+ enum {
8769+ PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT = 1 ,
8770+ };
8771+
8772+ G_DEFINE_TYPE (GArrowRankQuantileOptions,
8773+ garrow_rank_quantile_options,
8774+ GARROW_TYPE_FUNCTION_OPTIONS)
8775+
8776+ static void
8777+ garrow_rank_quantile_options_set_property(GObject *object,
8778+ guint prop_id,
8779+ const GValue *value,
8780+ GParamSpec *pspec)
8781+ {
8782+ auto options =
8783+ garrow_rank_quantile_options_get_raw (GARROW_RANK_QUANTILE_OPTIONS (object));
8784+
8785+ switch (prop_id) {
8786+ case PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT:
8787+ options->null_placement =
8788+ static_cast <arrow::compute::NullPlacement>(g_value_get_enum (value));
8789+ break ;
8790+ default :
8791+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
8792+ break ;
8793+ }
8794+ }
8795+
8796+ static void
8797+ garrow_rank_quantile_options_get_property (GObject *object,
8798+ guint prop_id,
8799+ GValue *value,
8800+ GParamSpec *pspec)
8801+ {
8802+ auto options =
8803+ garrow_rank_quantile_options_get_raw (GARROW_RANK_QUANTILE_OPTIONS (object));
8804+
8805+ switch (prop_id) {
8806+ case PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT:
8807+ g_value_set_enum (value, static_cast <GArrowNullPlacement>(options->null_placement ));
8808+ break ;
8809+ default :
8810+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
8811+ break ;
8812+ }
8813+ }
8814+
8815+ static void
8816+ garrow_rank_quantile_options_init (GArrowRankQuantileOptions *object)
8817+ {
8818+ auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE (object);
8819+ priv->options = static_cast <arrow::compute::FunctionOptions *>(
8820+ new arrow::compute::RankQuantileOptions ());
8821+ }
8822+
8823+ static void
8824+ garrow_rank_quantile_options_class_init (GArrowRankQuantileOptionsClass *klass)
8825+ {
8826+ auto gobject_class = G_OBJECT_CLASS (klass);
8827+
8828+ gobject_class->set_property = garrow_rank_quantile_options_set_property;
8829+ gobject_class->get_property = garrow_rank_quantile_options_get_property;
8830+
8831+ auto options = arrow::compute::RankQuantileOptions::Defaults ();
8832+
8833+ GParamSpec *spec;
8834+ /* *
8835+ * GArrowRankQuantileOptions:null-placement:
8836+ *
8837+ * Whether nulls and NaNs are placed at the start or at the end.
8838+ *
8839+ * Since: 23.0.0
8840+ */
8841+ spec = g_param_spec_enum (" null-placement" ,
8842+ " Null placement" ,
8843+ " Whether nulls and NaNs are placed "
8844+ " at the start or at the end." ,
8845+ GARROW_TYPE_NULL_PLACEMENT,
8846+ static_cast <GArrowNullPlacement>(options.null_placement ),
8847+ static_cast <GParamFlags>(G_PARAM_READWRITE));
8848+ g_object_class_install_property (gobject_class,
8849+ PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT,
8850+ spec);
8851+ }
8852+
8853+ /* *
8854+ * garrow_rank_quantile_options_new:
8855+ *
8856+ * Returns: A newly created #GArrowRankQuantileOptions.
8857+ *
8858+ * Since: 23.0.0
8859+ */
8860+ GArrowRankQuantileOptions *
8861+ garrow_rank_quantile_options_new (void )
8862+ {
8863+ return GARROW_RANK_QUANTILE_OPTIONS (
8864+ g_object_new (GARROW_TYPE_RANK_QUANTILE_OPTIONS, nullptr ));
8865+ }
8866+
8867+ /* *
8868+ * garrow_rank_quantile_options_get_sort_keys:
8869+ * @options: A #GArrowRankQuantileOptions.
8870+ *
8871+ * Returns: (transfer full) (element-type GArrowSortKey):
8872+ * The sort keys to be used.
8873+ *
8874+ * Since: 23.0.0
8875+ */
8876+ GList *
8877+ garrow_rank_quantile_options_get_sort_keys (GArrowRankQuantileOptions *options)
8878+ {
8879+ auto arrow_options = garrow_rank_quantile_options_get_raw (options);
8880+ return garrow_sort_keys_new_raw (arrow_options->sort_keys );
8881+ }
8882+
8883+ /* *
8884+ * garrow_rank_quantile_options_set_sort_keys:
8885+ * @options: A #GArrowRankQuantileOptions.
8886+ * @sort_keys: (element-type GArrowSortKey): The sort keys to be used.
8887+ *
8888+ * Set sort keys to be used.
8889+ *
8890+ * Since: 23.0.0
8891+ */
8892+ void
8893+ garrow_rank_quantile_options_set_sort_keys (GArrowRankQuantileOptions *options,
8894+ GList *sort_keys)
8895+ {
8896+ auto arrow_options = garrow_rank_quantile_options_get_raw (options);
8897+ garrow_raw_sort_keys_set (arrow_options->sort_keys , sort_keys);
8898+ }
8899+
8900+ /* *
8901+ * garrow_rank_quantile_options_add_sort_key:
8902+ * @options: A #GArrowRankQuantileOptions.
8903+ * @sort_key: The sort key to be added.
8904+ *
8905+ * Add a sort key to be used.
8906+ *
8907+ * Since: 23.0.0
8908+ */
8909+ void
8910+ garrow_rank_quantile_options_add_sort_key (GArrowRankQuantileOptions *options,
8911+ GArrowSortKey *sort_key)
8912+ {
8913+ auto arrow_options = garrow_rank_quantile_options_get_raw (options);
8914+ garrow_raw_sort_keys_add (arrow_options->sort_keys , sort_key);
8915+ }
8916+
87658917G_END_DECLS
87668918
87678919arrow::Result<arrow::FieldRef>
@@ -8981,6 +9133,11 @@ garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_opt
89819133 static_cast <const arrow::compute::PivotWiderOptions *>(arrow_options);
89829134 auto options = garrow_pivot_wider_options_new_raw (arrow_pivot_wider_options);
89839135 return GARROW_FUNCTION_OPTIONS (options);
9136+ } else if (arrow_type_name == " RankQuantileOptions" ) {
9137+ const auto arrow_rank_quantile_options =
9138+ static_cast <const arrow::compute::RankQuantileOptions *>(arrow_options);
9139+ auto options = garrow_rank_quantile_options_new_raw (arrow_rank_quantile_options);
9140+ return GARROW_FUNCTION_OPTIONS (options);
89849141 } else {
89859142 auto options = g_object_new (GARROW_TYPE_FUNCTION_OPTIONS, NULL );
89869143 return GARROW_FUNCTION_OPTIONS (options);
@@ -9870,3 +10027,24 @@ garrow_pivot_wider_options_get_raw(GArrowPivotWiderOptions *options)
987010027 return static_cast <arrow::compute::PivotWiderOptions *>(
987110028 garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
987210029}
10030+
10031+ GArrowRankQuantileOptions *
10032+ garrow_rank_quantile_options_new_raw (
10033+ const arrow::compute::RankQuantileOptions *arrow_options)
10034+ {
10035+ auto options =
10036+ GARROW_RANK_QUANTILE_OPTIONS (g_object_new (GARROW_TYPE_RANK_QUANTILE_OPTIONS,
10037+ " null-placement" ,
10038+ arrow_options->null_placement ,
10039+ nullptr ));
10040+ auto arrow_new_options = garrow_rank_quantile_options_get_raw (options);
10041+ arrow_new_options->sort_keys = arrow_options->sort_keys ;
10042+ return options;
10043+ }
10044+
10045+ arrow::compute::RankQuantileOptions *
10046+ garrow_rank_quantile_options_get_raw (GArrowRankQuantileOptions *options)
10047+ {
10048+ return static_cast <arrow::compute::RankQuantileOptions *>(
10049+ garrow_function_options_get_raw (GARROW_FUNCTION_OPTIONS (options)));
10050+ }
0 commit comments