Skip to content

Commit

Permalink
apacheGH-39225: [GLib] Use Cast() instaed of CastTo (apache#39228)
Browse files Browse the repository at this point in the history
### Rationale for this change

Remove legacy code

### What changes are included in this PR?

* Replace the legacy scalar CastTo implementation for GLib. 

### Are these changes tested?

No.

### Are there any user-facing changes?

No.

* Closes: apache#39225

Authored-by: Hyunseok Seo <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
llama90 authored and dgreiss committed Feb 17, 2024
1 parent ce6567e commit 6500a41
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions c_glib/arrow-glib/scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <arrow-glib/interval.hpp>
#include <arrow-glib/scalar.hpp>

#include <arrow/compute/cast.h>

G_BEGIN_DECLS

/**
Expand Down Expand Up @@ -385,9 +387,9 @@ garrow_scalar_cast(GArrowScalar *scalar,
{
const auto arrow_scalar = garrow_scalar_get_raw(scalar);
const auto arrow_data_type = garrow_data_type_get_raw(data_type);
auto arrow_casted_scalar_result = arrow_scalar->CastTo(arrow_data_type);
auto arrow_casted_scalar_result = arrow::compute::Cast(arrow_scalar, arrow_data_type);
if (garrow::check(error, arrow_casted_scalar_result, "[scalar][cast]")) {
auto arrow_casted_scalar = *arrow_casted_scalar_result;
auto arrow_casted_scalar = (*arrow_casted_scalar_result).scalar();
return garrow_scalar_new_raw(&arrow_casted_scalar,
"scalar", &arrow_casted_scalar,
"data-type", data_type,
Expand Down

0 comments on commit 6500a41

Please sign in to comment.