You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/30 06:37:27 UTC

[GitHub] [arrow] edponce commented on a change in pull request #12041: ARROW-15203: [GLib] garrow_struct_scalar_get_value() for scalar from C++ returns value

edponce commented on a change in pull request #12041:
URL: https://github.com/apache/arrow/pull/12041#discussion_r776588154



##########
File path: c_glib/arrow-glib/scalar.cpp
##########
@@ -2039,6 +2039,16 @@ GList *
 garrow_struct_scalar_get_value(GArrowStructScalar *scalar)
 {
   auto priv = GARROW_STRUCT_SCALAR_GET_PRIVATE(scalar);
+  if (!priv->value) {
+    auto arrow_scalar =
+      std::static_pointer_cast<arrow::StructScalar>(
+        garrow_scalar_get_raw(GARROW_SCALAR(scalar)));
+    for (auto arrow_element : arrow_scalar->value) {
+      priv->value = g_list_prepend(priv->value,
+                                   garrow_scalar_new_raw(&arrow_element));
+    }
+    priv->value = g_list_reverse(priv->value);
+  }

Review comment:
       Why prepend and then reverse instead of only appending?




-- 
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