You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "hiroyuki-sato (via GitHub)" <gi...@apache.org> on 2025/05/12 00:46:28 UTC

[PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#ndim [arrow]

hiroyuki-sato opened a new pull request, #46399:
URL: https://github.com/apache/arrow/pull/46399

   ### Rationale for this change
   
   The C++ API implemented `FixedShapeTensor::ndim()` instance method. GLib was not yet supported.
   
   ### What changes are included in this PR?
   
   Add `GArrowFixedShapeTensorDataType#ndim` instance method.
   
   ### Are these changes tested?
   
   Yes.
   
   ### Are there any user-facing changes?
   
   Yes.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dims [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2889255521

   rebased to the latest for rerun CI.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#ndim [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2870422152

   :warning: GitHub issue #46398 **has been automatically assigned in GitHub** to PR creator.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dimensions [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2889565157

   Thanks. The method renamed.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dimensions [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #46399:
URL: https://github.com/apache/arrow/pull/46399#discussion_r2094886844


##########
c_glib/arrow-glib/basic-data-type.cpp:
##########
@@ -2282,6 +2307,19 @@ garrow_fixed_shape_tensor_data_type_init(GArrowFixedShapeTensorDataType *object)
 static void
 garrow_fixed_shape_tensor_data_type_class_init(GArrowFixedShapeTensorDataTypeClass *klass)
 {
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+  gobject_class->get_property = garrow_fixed_shape_tensor_data_type_get_property;
+
+  spec = g_param_spec_uint64("n_dimensions",

Review Comment:
   Could you add a docstring for public properties?
   
   ```suggestion
     /**
      * GArrowFixedShapeTensorDataType::n-dimensions:
      *
      * The number of dimensions of tensor elements.
      *
      * Since: 21.0.0
      */
     spec = g_param_spec_uint64("n_dimensions",
   ```



##########
c_glib/arrow-glib/basic-data-type.cpp:
##########
@@ -2282,6 +2307,19 @@ garrow_fixed_shape_tensor_data_type_init(GArrowFixedShapeTensorDataType *object)
 static void
 garrow_fixed_shape_tensor_data_type_class_init(GArrowFixedShapeTensorDataTypeClass *klass)
 {
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+  gobject_class->get_property = garrow_fixed_shape_tensor_data_type_get_property;
+
+  spec = g_param_spec_uint64("n_dimensions",
+                             "NDimensions",

Review Comment:
   ```suggestion
                                "N dimensions",
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dimensions [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2896150213

   @kou Thanks. Suggested change applied. Please take a look when you get a chance.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#ndim [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #46399:
URL: https://github.com/apache/arrow/pull/46399#discussion_r2083679146


##########
c_glib/arrow-glib/basic-data-type.cpp:
##########
@@ -2366,6 +2366,21 @@ garrow_fixed_shape_tensor_data_type_get_shape(GArrowFixedShapeTensorDataType *da
   return arrow_shape.data();
 }
 
+/**
+ * garrow_fixed_shape_tensor_data_type_get_ndim:

Review Comment:
   Could you implement this as a property because this is not a complex type such as an array?
   
   Could you use `n_dims` or `n_dimensions` instead of `ndim`?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dimensions [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou merged PR #46399:
URL: https://github.com/apache/arrow/pull/46399


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#ndim [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on code in PR #46399:
URL: https://github.com/apache/arrow/pull/46399#discussion_r2083683946


##########
c_glib/arrow-glib/basic-data-type.cpp:
##########
@@ -2366,6 +2366,21 @@ garrow_fixed_shape_tensor_data_type_get_shape(GArrowFixedShapeTensorDataType *da
   return arrow_shape.data();
 }
 
+/**
+ * garrow_fixed_shape_tensor_data_type_get_ndim:

Review Comment:
   OK. Will try it.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#ndim [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2870482285

   Requested change a little difficult for me. I will implement other methods (permutation, dim_names) at first. 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dimensions [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2897143941

   After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 719be48f15e1afc60dbcda477bd3f927aca06d90.
   
   There were no benchmark performance regressions. 🎉
   
   The [full Conbench report](https://github.com/apache/arrow/runs/42616739375) has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dims [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2889432484

   Could you use `n_dimensions` instead of `n_dims` because `GArrowTensor` uses `n_dimensions` not `n_dims`?
   https://github.com/apache/arrow/blob/1229ceddd512aa5b3a601019ee3b4bae28cfa3e6/c_glib/arrow-glib/tensor.h#L69-L71


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dims [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on code in PR #46399:
URL: https://github.com/apache/arrow/pull/46399#discussion_r2094020739


##########
c_glib/arrow-glib/basic-data-type.cpp:
##########
@@ -2282,6 +2307,19 @@ garrow_fixed_shape_tensor_data_type_init(GArrowFixedShapeTensorDataType *object)
 static void
 garrow_fixed_shape_tensor_data_type_class_init(GArrowFixedShapeTensorDataTypeClass *klass)
 {
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+  gobject_class->get_property = garrow_fixed_shape_tensor_data_type_get_property;
+
+  spec = g_param_spec_uint64("n_dims",
+                             "Ndims",
+                             "Number of dimensions of tensor elements",
+                             0,
+                             G_MAXUINT64,
+                             0,
+                             static_cast<GParamFlags>(G_PARAM_READABLE));
+  g_object_class_install_property(gobject_class, PROP_N_DIMS, spec);
 }

Review Comment:
   `FixedShapeTensorType::ndim()` returns `size_t`. I couldn't find `g_param_spec_size_t`. So I used `g_param_spec_uint64`
   https://arrow.apache.org/docs/dev/cpp/api/extension.html#_CPPv4NK5arrow9extension20FixedShapeTensorType4ndimEv



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-46398: [GLib] Add GArrowFixedShapeTensorDataType#n_dims [arrow]

Posted by "hiroyuki-sato (via GitHub)" <gi...@apache.org>.
hiroyuki-sato commented on PR #46399:
URL: https://github.com/apache/arrow/pull/46399#issuecomment-2888177132

   @kou I rewrote the method. Please take a look when you get a chance. and Could you re-run failed CI?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org