Commits


Thor authored and GitHub committed 575b0957a60
GH-36384: [Go] Schema: NumFields (#36365) ### Rationale for this change Previously if one wanted to iterate over the fields in the schema you would call the `Fields()` function and just iterate over the slice. However, due to [this commit](https://github.com/rtpsw/arrow/commit/802674b73c94c84388a6775b424ebe4f6e04274e) there is now an allocation and copy that happens when that's called. So to iterate over the fields without allocations one now must use the `Field(i int)` method; however that means a user must already know exactly how many fields are in the schema which isn't possible today. This adds a simple `NumFields() int` method that returns the number of fields in a schema to allow a user to iterate over all the fields without having to copy them. ### What changes are included in this PR? Expose the number of fields in a schema for iteration over fields. Single function added `NumFields() int` to schema ### Are these changes tested? N/A ### Are there any user-facing changes? Yes this is a new API * Closes: #36384 Authored-by: thorfour <me@thor-hansen.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>