Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a62b1f7
Fix: Add support for null sort option per sort key.
Light-City Nov 3, 2023
d8bca7c
fix test
Light-City Nov 10, 2023
970f5bf
fix sortkey assert
Light-City Nov 14, 2023
6c0bc76
fix serde test
Light-City Nov 14, 2023
25984c5
better api
Taepper Jun 25, 2025
c07f37a
Merge remote-tracking branch 'refs/remotes/fork/main' into GH-38558
Taepper Jun 25, 2025
241fbee
Merge branch 'refs/heads/better-api' into GH-38558
Taepper Jun 25, 2025
dafbe14
merge follow-up
Taepper Jun 25, 2025
48a3e0c
merge follow-up
Taepper Jun 26, 2025
5c9eb50
formatting
Taepper Jun 26, 2025
12d1b0d
formatting
Taepper Jun 26, 2025
0b442f7
missing unwrap_null_placement in python
Taepper Jun 26, 2025
4398d16
do not remove demoted null_placement from python api
Taepper Jun 26, 2025
bdc4069
fix member name in hash_aggregate_test
Taepper Jun 26, 2025
8fc630c
update ToString method output
Taepper Jun 26, 2025
dcb3b7a
format remove extra empty line
Taepper Jun 26, 2025
682a37a
fix python interface
Taepper Jun 26, 2025
e6afb8a
python formatting
Taepper Jun 26, 2025
82299bc
do not pass None to python C binding
Taepper Jun 26, 2025
370cdac
format python
Taepper Jun 26, 2025
503a7d1
fix minor python api mistakes
Taepper Jun 26, 2025
1d0883e
python formatting
Taepper Jun 26, 2025
7833add
do not rename member of exposed API struct
Taepper Jun 26, 2025
6e2759b
do not rename member of exposed API struct, missed test file
Taepper Jun 26, 2025
0a029ca
format cc file
Taepper Jun 26, 2025
3463a59
updating api that was not using additional argument for some reason (…
Taepper Jun 26, 2025
e01a009
make null_placement optional in the python acero api
Taepper Jun 26, 2025
794a2cd
minor additional fixes
Taepper Jun 26, 2025
adaae37
amend c_glib api to use std::optional<NullPlacement> for RankOptions
Taepper Jun 27, 2025
14c3914
amend c_glib api to use std::optional<NullPlacement> for RankOptions
Taepper Jun 27, 2025
791d8e9
amend c_glib api to use std::optional<NullPlacement> for RankOptions
Taepper Jun 27, 2025
bee7e81
amend c_glib api to use std::optional<NullPlacement> for RankOptions
Taepper Jun 29, 2025
cbfd596
fix mistake where default null placement was AtStart
Taepper Jun 29, 2025
779169e
fix mistake where null_placement was not correctly set when sort_keys…
Taepper Jun 29, 2025
dbd75d0
fix c_glib bindings
Taepper Jun 29, 2025
67e99ac
formatting
Taepper Jun 29, 2025
e26fbc4
formatting
Taepper Jun 29, 2025
1dd5079
Merge remote-tracking branch 'origin/main' into GH-38558
Taepper Jan 22, 2026
72a28f9
Merge branch 'main' into GH-38558
Taepper Jan 23, 2026
e07a673
also update RankQuantileOptions to new NullPlacement api
Taepper Jan 23, 2026
290812f
update library version documentation
Taepper Jan 23, 2026
5320622
rename GARROW_OPTIONAL_NULL_PLACEMENT_UNSET to GARROW_OPTIONAL_NULL_P…
Taepper Jan 23, 2026
bf31270
formatting
Taepper Jan 23, 2026
2e58463
ruby default value formatting
Taepper Jan 23, 2026
79995df
change red-arrow gem to use different syntax for specifying null_plac…
Taepper Jan 23, 2026
bac578a
update ruby test functions that use direct GObject introspection
Taepper Jan 23, 2026
1411115
simplify helper functions
Taepper Jan 23, 2026
8f041b5
move and export helper functions
Taepper Jan 23, 2026
d36fbb6
fixup move and export helper functions
Taepper Jan 23, 2026
272ec3f
format ruby
Taepper Jan 23, 2026
f1fda48
fix another ruby test
Taepper Jan 23, 2026
e398fe4
fix another ruby test
Taepper Jan 24, 2026
4778d97
Improve `GArrowOptionalNullPlacement` documentation
Taepper Jan 24, 2026
15542b0
Make static_cast of GARROW_OPTIONAL_NULL_PLACEMENT safer by having GA…
Taepper Jan 24, 2026
b7293cb
improve placement of helper garrow_optional_null_placement_* helper f…
Taepper Jan 24, 2026
b33465e
more ruby test fixes
Taepper Jan 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 81 additions & 24 deletions c_glib/arrow-glib/compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,7 @@ typedef struct GArrowSortKeyPrivate_
enum {
PROP_SORT_KEY_TARGET = 1,
PROP_SORT_KEY_ORDER,
PROP_SORT_KEY_NULL_PLACEMENT,
};

G_DEFINE_TYPE_WITH_PRIVATE(GArrowSortKey, garrow_sort_key, G_TYPE_OBJECT)
Expand Down Expand Up @@ -3130,6 +3131,10 @@ garrow_sort_key_set_property(GObject *object,
priv->sort_key.order =
static_cast<arrow::compute::SortOrder>(g_value_get_enum(value));
break;
case PROP_SORT_KEY_NULL_PLACEMENT:
priv->sort_key.null_placement =
static_cast<arrow::compute::NullPlacement>(g_value_get_enum(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
Expand Down Expand Up @@ -3158,6 +3163,10 @@ garrow_sort_key_get_property(GObject *object,
case PROP_SORT_KEY_ORDER:
g_value_set_enum(value, static_cast<GArrowSortOrder>(priv->sort_key.order));
break;
case PROP_SORT_KEY_NULL_PLACEMENT:
g_value_set_enum(value,
static_cast<GArrowNullPlacement>(priv->sort_key.null_placement));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
Expand Down Expand Up @@ -3214,25 +3223,50 @@ garrow_sort_key_class_init(GArrowSortKeyClass *klass)
0,
static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_SORT_KEY_ORDER, spec);

/**
* GArrowSortKey::null-placement:
*
* Whether nulls and NaNs are placed at the start or at the end.
*
* Since: 24.0.0
*/
spec = g_param_spec_enum(
"null-placement",
"Null Placement",
"Whether nulls and NaNs are placed at the start or at the end",
GARROW_TYPE_NULL_PLACEMENT,
0,
static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_SORT_KEY_NULL_PLACEMENT, spec);
}

/**
* garrow_sort_key_new:
* @target: A name or dot path for sort target.
* @order: How to order by this sort key.
* @null_placement: Whether nulls and NaNs are placed at the start or at the end.
*
* Returns: A newly created #GArrowSortKey.
*
* Since: 3.0.0
*/
GArrowSortKey *
garrow_sort_key_new(const gchar *target, GArrowSortOrder order, GError **error)
garrow_sort_key_new(const gchar *target,
GArrowSortOrder order,
GArrowNullPlacement null_placement,
GError **error)
{
auto arrow_reference_result = garrow_field_reference_resolve_raw(target);
if (!garrow::check(error, arrow_reference_result, "[sort-key][new]")) {
return NULL;
}
auto sort_key = g_object_new(GARROW_TYPE_SORT_KEY, "order", order, NULL);
auto sort_key = g_object_new(GARROW_TYPE_SORT_KEY,
"order",
order,
"null-placement",
null_placement,
NULL);
auto priv = GARROW_SORT_KEY_GET_PRIVATE(sort_key);
priv->sort_key.target = *arrow_reference_result;
return GARROW_SORT_KEY(sort_key);
Expand Down Expand Up @@ -4516,8 +4550,8 @@ garrow_rank_options_set_property(GObject *object,

switch (prop_id) {
case PROP_RANK_OPTIONS_NULL_PLACEMENT:
options->null_placement =
static_cast<arrow::compute::NullPlacement>(g_value_get_enum(value));
options->null_placement = garrow_optional_null_placement_to_raw(
static_cast<GArrowOptionalNullPlacement>(g_value_get_enum(value)));
Comment on lines +4553 to +4554
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options->null_placement = garrow_optional_null_placement_to_raw(
static_cast<GArrowOptionalNullPlacement>(g_value_get_enum(value)));
{
auto null_placement = static_cast<GArrowOptionalNullPlacement>(g_value_get_enum(value));
if (null_placement == GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED) {
options->null_placement = std::nullopt;
} else {
options->null_placement = null_placement
}
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be missing a static_cast:

    {
      auto null_placement = static_cast<GArrowOptionalNullPlacement>(g_value_get_enum(value));
      if (null_placement == GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED) {
        options->null_placement = std::nullopt;
      } else {
        options->null_placement = static_cast<arrow::compute::NullPlacement>(null_placement);
      }
    }

Are you sure this is the cleaner way to go? Should I replace all usage of the helper function garrow_optional_null_placement_to_raw like this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we have multiple places that use these helper functions. I missed them. Sorry.

Could you export these helper functions from compute.hpp instead of defining them in an anonymous namespace? And could you simplify these helper functions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I did this, but this lead to the following change:

The return type is a cpp object and not a pointer as for most other exported functions. Therefore, its definition must be outside the G_BEGIN_DECLS/G_END_DECLS (these define extern "C"). I moved it there, but it makes it feel a little out of place. No other definition before the line G_BEGIN_DECLS is exported.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move them after the G_END_DECLS

G_END_DECLS
? We place exported C++ functions after G_END_DECLS.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this was embarrassing to miss. Thanks for the pointer!

break;
case PROP_RANK_OPTIONS_TIEBREAKER:
options->tiebreaker =
Expand All @@ -4539,7 +4573,8 @@ garrow_rank_options_get_property(GObject *object,

switch (prop_id) {
case PROP_RANK_OPTIONS_NULL_PLACEMENT:
g_value_set_enum(value, static_cast<GArrowNullPlacement>(options->null_placement));
g_value_set_enum(value,
garrow_optional_null_placement_from_raw(options->null_placement));
break;
case PROP_RANK_OPTIONS_TIEBREAKER:
g_value_set_enum(value, static_cast<GArrowRankTiebreaker>(options->tiebreaker));
Expand Down Expand Up @@ -4576,13 +4611,15 @@ garrow_rank_options_class_init(GArrowRankOptionsClass *klass)
*
* Since: 12.0.0
*/
spec = g_param_spec_enum("null-placement",
"Null placement",
"Whether nulls and NaNs are placed "
"at the start or at the end.",
GARROW_TYPE_NULL_PLACEMENT,
static_cast<GArrowNullPlacement>(options.null_placement),
static_cast<GParamFlags>(G_PARAM_READWRITE));
spec =
g_param_spec_enum("null-placement",
"Null placement",
"Whether nulls and NaNs are placed "
"at the start or at the end.",
GARROW_TYPE_OPTIONAL_NULL_PLACEMENT,
garrow_optional_null_placement_from_raw(options.null_placement),
static_cast<GParamFlags>(G_PARAM_READWRITE));

g_object_class_install_property(gobject_class, PROP_RANK_OPTIONS_NULL_PLACEMENT, spec);

/**
Expand Down Expand Up @@ -8821,8 +8858,8 @@ garrow_rank_quantile_options_set_property(GObject *object,

switch (prop_id) {
case PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT:
options->null_placement =
static_cast<arrow::compute::NullPlacement>(g_value_get_enum(value));
options->null_placement = garrow_optional_null_placement_to_raw(
static_cast<GArrowOptionalNullPlacement>(g_value_get_enum(value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
Expand All @@ -8841,7 +8878,8 @@ garrow_rank_quantile_options_get_property(GObject *object,

switch (prop_id) {
case PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT:
g_value_set_enum(value, static_cast<GArrowNullPlacement>(options->null_placement));
g_value_set_enum(value,
garrow_optional_null_placement_from_raw(options->null_placement));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
Expand Down Expand Up @@ -8875,13 +8913,14 @@ garrow_rank_quantile_options_class_init(GArrowRankQuantileOptionsClass *klass)
*
* Since: 23.0.0
*/
spec = g_param_spec_enum("null-placement",
"Null placement",
"Whether nulls and NaNs are placed "
"at the start or at the end.",
GARROW_TYPE_NULL_PLACEMENT,
static_cast<GArrowNullPlacement>(options.null_placement),
static_cast<GParamFlags>(G_PARAM_READWRITE));
spec =
g_param_spec_enum("null-placement",
"Null placement",
"Whether nulls and NaNs are placed "
"at the start or at the end.",
GARROW_TYPE_OPTIONAL_NULL_PLACEMENT,
garrow_optional_null_placement_from_raw(options.null_placement),
static_cast<GParamFlags>(G_PARAM_READWRITE));
g_object_class_install_property(gobject_class,
PROP_RANK_QUANTILE_OPTIONS_NULL_PLACEMENT,
spec);
Expand Down Expand Up @@ -11170,8 +11209,6 @@ garrow_sort_options_new_raw(const arrow::compute::SortOptions *arrow_options)
auto options = GARROW_SORT_OPTIONS(g_object_new(GARROW_TYPE_SORT_OPTIONS, NULL));
auto arrow_new_options = garrow_sort_options_get_raw(options);
arrow_new_options->sort_keys = arrow_options->sort_keys;
/* TODO: Use property when we add support for null_placement. */
arrow_new_options->null_placement = arrow_options->null_placement;
return options;
}

Expand All @@ -11182,6 +11219,26 @@ garrow_sort_options_get_raw(GArrowSortOptions *options)
garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options)));
}

GArrowOptionalNullPlacement
garrow_optional_null_placement_from_raw(
const std::optional<arrow::compute::NullPlacement> &arrow_null_placement)
{
if (!arrow_null_placement.has_value()) {
return GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED;
}
return static_cast<GArrowOptionalNullPlacement>(arrow_null_placement.value());
}

std::optional<arrow::compute::NullPlacement>
garrow_optional_null_placement_to_raw(GArrowOptionalNullPlacement garrow_null_placement)
{
if (garrow_null_placement == GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED) {
return std::nullopt;
} else {
return static_cast<arrow::compute::NullPlacement>(garrow_null_placement);
}
}

GArrowSetLookupOptions *
garrow_set_lookup_options_new_raw(const arrow::compute::SetLookupOptions *arrow_options)
{
Expand Down
35 changes: 34 additions & 1 deletion c_glib/arrow-glib/compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,36 @@ typedef enum /*<prefix=GARROW_NULL_PLACEMENT_>*/ {
GARROW_NULL_PLACEMENT_AT_END,
} GArrowNullPlacement;

/**
* GArrowOptionalNullPlacement:
* @GARROW_OPTIONAL_NULL_PLACEMENT_AT_START:
* Place nulls and NaNs before any non-null values.
* NaNs will come after nulls.
* Ignore null-placement of each individual
* `arrow:compute::SortKey`.
* @GARROW_OPTIONAL_NULL_PLACEMENT_AT_END:
* Place nulls and NaNs after any non-null values.
* NaNs will come before nulls.
* Ignore null-placement of each individual
* `arrow:compute::SortKey`.
* @GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED:
* Do not specify null placement.
* Instead, the null-placement of each individual
* `arrow:compute::SortKey` will be followed.
*
* They are corresponding to `arrow::compute::NullPlacement` values except
* `GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED`.
* `GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED` is used to specify
* `std::nullopt`.
*
* Since: 24.0.0
*/
typedef enum /*<prefix=GARROW_OPTIONAL_NULL_PLACEMENT_>*/ {
GARROW_OPTIONAL_NULL_PLACEMENT_UNSPECIFIED = -1,
GARROW_OPTIONAL_NULL_PLACEMENT_AT_START,
GARROW_OPTIONAL_NULL_PLACEMENT_AT_END,
} GArrowOptionalNullPlacement;

#define GARROW_TYPE_ARRAY_SORT_OPTIONS (garrow_array_sort_options_get_type())
GARROW_AVAILABLE_IN_3_0
G_DECLARE_DERIVABLE_TYPE(GArrowArraySortOptions,
Expand Down Expand Up @@ -539,7 +569,10 @@ struct _GArrowSortKeyClass

GARROW_AVAILABLE_IN_3_0
GArrowSortKey *
garrow_sort_key_new(const gchar *target, GArrowSortOrder order, GError **error);
garrow_sort_key_new(const gchar *target,
GArrowSortOrder order,
GArrowNullPlacement null_placement,
GError **error);

GARROW_AVAILABLE_IN_3_0
gboolean
Expand Down
6 changes: 6 additions & 0 deletions c_glib/arrow-glib/compute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ garrow_sort_options_new_raw(const arrow::compute::SortOptions *arrow_options);
arrow::compute::SortOptions *
garrow_sort_options_get_raw(GArrowSortOptions *options);

GArrowOptionalNullPlacement
garrow_optional_null_placement_from_raw(
const std::optional<arrow::compute::NullPlacement> &arrow_null_placement);
std::optional<arrow::compute::NullPlacement>
garrow_optional_null_placement_to_raw(GArrowOptionalNullPlacement garrow_null_placement);

GArrowSetLookupOptions *
garrow_set_lookup_options_new_raw(const arrow::compute::SetLookupOptions *arrow_options);
arrow::compute::SetLookupOptions *
Expand Down
18 changes: 6 additions & 12 deletions c_glib/test/test-rank-options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,23 @@ def test_equal

def test_sort_keys
sort_keys = [
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_end),
]
@options.sort_keys = sort_keys
assert_equal(sort_keys, @options.sort_keys)
end

def test_add_sort_key
@options.add_sort_key(Arrow::SortKey.new("column1", :ascending))
@options.add_sort_key(Arrow::SortKey.new("column2", :descending))
@options.add_sort_key(Arrow::SortKey.new("column1", :ascending, :at_end))
@options.add_sort_key(Arrow::SortKey.new("column2", :descending, :at_start))
assert_equal([
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_start),
],
@options.sort_keys)
end

def test_null_placement
assert_equal(Arrow::NullPlacement::AT_END, @options.null_placement)
@options.null_placement = :at_start
assert_equal(Arrow::NullPlacement::AT_START, @options.null_placement)
end

def test_tiebreaker
assert_equal(Arrow::RankTiebreaker::FIRST, @options.tiebreaker)
@options.tiebreaker = :max
Expand Down
18 changes: 10 additions & 8 deletions c_glib/test/test-rank-quantile-options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,29 @@ def setup

def test_sort_keys
sort_keys = [
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_end),
]
@options.sort_keys = sort_keys
assert_equal(sort_keys, @options.sort_keys)
end

def test_add_sort_key
@options.add_sort_key(Arrow::SortKey.new("column1", :ascending))
@options.add_sort_key(Arrow::SortKey.new("column2", :descending))
@options.add_sort_key(Arrow::SortKey.new("column1", :ascending, :at_end))
@options.add_sort_key(Arrow::SortKey.new("column2", :descending, :at_end))
assert_equal([
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_end),
],
@options.sort_keys)
end

def test_null_placement
assert_equal(Arrow::NullPlacement::AT_END, @options.null_placement)
assert_equal(Arrow::OptionalNullPlacement::UNSPECIFIED, @options.null_placement)
@options.null_placement = :at_end
assert_equal(Arrow::OptionalNullPlacement::AT_END, @options.null_placement)
@options.null_placement = :at_start
assert_equal(Arrow::NullPlacement::AT_START, @options.null_placement)
assert_equal(Arrow::OptionalNullPlacement::AT_START, @options.null_placement)
end

def test_rank_quantile_function
Expand Down
14 changes: 7 additions & 7 deletions c_glib/test/test-select-k-options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ def test_k

def test_sort_keys
sort_keys = [
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_end),
]
@options.sort_keys = sort_keys
assert_equal(sort_keys, @options.sort_keys)
end

def test_add_sort_key
@options.add_sort_key(Arrow::SortKey.new("column1", :ascending))
@options.add_sort_key(Arrow::SortKey.new("column2", :descending))
@options.add_sort_key(Arrow::SortKey.new("column1", :ascending, :at_end))
@options.add_sort_key(Arrow::SortKey.new("column2", :descending, :at_end))
assert_equal([
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_end),
],
@options.sort_keys)
end
Expand All @@ -53,7 +53,7 @@ def test_select_k_unstable_function
Arrow::ArrayDatum.new(input_array),
]
@options.k = 3
@options.add_sort_key(Arrow::SortKey.new("dummy", :descending))
@options.add_sort_key(Arrow::SortKey.new("dummy", :descending, :at_end))
select_k_unstable_function = Arrow::Function.find("select_k_unstable")
result = select_k_unstable_function.execute(args, @options).value
assert_equal(build_uint64_array([4, 2, 0]), result)
Expand Down
8 changes: 4 additions & 4 deletions c_glib/test/test-sort-indices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def test_record_batch
}
record_batch = build_record_batch(columns)
sort_keys = [
Arrow::SortKey.new("column1", :ascending),
Arrow::SortKey.new("column2", :descending),
Arrow::SortKey.new("column1", :ascending, :at_end),
Arrow::SortKey.new("column2", :descending, :at_end),
]
options = Arrow::SortOptions.new(sort_keys)
assert_equal(build_uint64_array([4, 1, 0, 5, 3, 2]),
Expand All @@ -61,8 +61,8 @@ def test_table
}
table = build_table(columns)
options = Arrow::SortOptions.new
options.add_sort_key(Arrow::SortKey.new("column1", :ascending))
options.add_sort_key(Arrow::SortKey.new("column2", :descending))
options.add_sort_key(Arrow::SortKey.new("column1", :ascending, :at_end))
options.add_sort_key(Arrow::SortKey.new("column2", :descending, :at_end))
assert_equal(build_uint64_array([4, 1, 0, 5, 3, 2]),
table.sort_indices(options))
end
Expand Down
Loading