You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "sdf-jkl (via GitHub)" <gi...@apache.org> on 2026/06/10 18:40:36 UTC

[PR] Add `StructArray::field_` APIs symmetric to `StructArray::column_` ones [arrow-rs]

sdf-jkl opened a new pull request, #10110:
URL: https://github.com/apache/arrow-rs/pull/10110

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
   -->
   
   - Closes #10092.
   
   # Rationale for this change
   
   check issue
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   
   - Add two `field_` APIs symmetric to `column_` ones.
   - Reuse `Fields::find` in `column_by_name` to avoid a `Vec` alloc.
   - Fix doc pointing to an old Jira issue. Now points to #9205
   - `MapArray::entries_fields` avoid a `Vec` alloc.
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   
   - Yes, unit tests
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   
   If this PR claims a performance improvement, please include evidence such as benchmark results.
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   
   If there are any breaking changes to public APIs, please call them out.
   -->
   
   New `StructArray` APIs.


-- 
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] Add `StructArray::field_` APIs symmetric to `StructArray::column_` ones [arrow-rs]

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


-- 
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] Add `StructArray::field_` APIs symmetric to `StructArray::column_` ones [arrow-rs]

Posted by "sdf-jkl (via GitHub)" <gi...@apache.org>.
sdf-jkl commented on PR #10110:
URL: https://github.com/apache/arrow-rs/pull/10110#issuecomment-4681949072

   @alamb @scovich PTAL


-- 
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] Add `StructArray::field_` APIs symmetric to `StructArray::column_` ones [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10110:
URL: https://github.com/apache/arrow-rs/pull/10110#discussion_r3402944600


##########
arrow-array/src/array/struct_array.rs:
##########
@@ -319,12 +319,25 @@ impl StructArray {
     ///
     /// Note: A schema can currently have duplicate field names, in which case
     /// the first field will always be selected.
-    /// This issue will be addressed in [ARROW-11178](https://issues.apache.org/jira/browse/ARROW-11178)
+    /// This issue will be addressed in [#9205](https://github.com/apache/arrow-rs/issues/9205)
     pub fn column_by_name(&self, column_name: &str) -> Option<&ArrayRef> {
-        self.column_names()
-            .iter()
-            .position(|c| c == &column_name)
-            .map(|pos| self.column(pos))
+        self.fields()
+            .find(column_name)
+            .map(|(pos, _)| self.column(pos))
+    }
+
+    /// Returns the [`FieldRef`] at `pos`.

Review Comment:
   nice



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