This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new faa9d8077f GH-39225: [GLib] Use Cast() instaed of CastTo (#39228)
faa9d8077f is described below
commit faa9d8077fb1066935ee9ba755590515b7e646d7
Author: Hyunseok Seo <[email protected]>
AuthorDate: Sun Jan 7 06:16:54 2024 +0900
GH-39225: [GLib] Use Cast() instaed of CastTo (#39228)
### 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: #39225
Authored-by: Hyunseok Seo <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
c_glib/arrow-glib/scalar.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/c_glib/arrow-glib/scalar.cpp b/c_glib/arrow-glib/scalar.cpp
index d25bdaf89d..c45fca81c0 100644
--- a/c_glib/arrow-glib/scalar.cpp
+++ b/c_glib/arrow-glib/scalar.cpp
@@ -26,6 +26,8 @@
#include <arrow-glib/interval.hpp>
#include <arrow-glib/scalar.hpp>
+#include <arrow/compute/cast.h>
+
G_BEGIN_DECLS
/**
@@ -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,