kevingurney opened a new pull request, #36855:
URL: https://github.com/apache/arrow/pull/36855

   ### Rationale for this change
   
   Now that the MATLAB interface supports creating `Type` objects - like 
`arrow.type.Int64Type`, we can add support for `Field` objects (i.e. name + 
type).
   
   This mirrors the `Field` type in other Arrow interfaces, [like 
PyArrow](https://arrow.apache.org/docs/python/generated/pyarrow.field.html).
   
   
   ### What changes are included in this PR?
   
   Two new user-facing APIs have been added:
   
   1. `arrow.field(name, type)` constructor function
   2. `arrow.type.Field` class (returned by the `arrow.field` constructor 
function.
   
   **Example**:
   
   ```matlab
   >> field = arrow.field("Speed", arrow.type.uint64)   
   
   field = 
   
   Speed: uint64
   >> field.Type
   
   ans = 
   
     UInt64Type with properties:
   
       ID: UInt64
   
   >> field.Name
   
   ans = 
   
       "Speed"
   ```
   
   ### Are these changes tested?
   
   Yes.
   
   1. Added new `tField.m` MATLAB test class.
   
   ### Are there any user-facing changes?
   
   Yes.
   
   Two new user-facing APIs have been added:
   
   1. `arrow.field(name, type)` constructor function
   2. `arrow.type.Field` class (returned by the `arrow.field` constructor 
function)
   
   ### Future Directions
   
   1. We intentionally placed `arrow.field` in the top-level `arrow` package, 
rather than under a nested `arrow.type` package (where the corresponding class 
`arrow.type.Field` is). This is to avoid name conflicts between 
`arrow.type.field` and `arrow.type.Field` and also to make it easier to use the 
recommended public/user-facing APIs with less typing (i.e. without needing to 
typing nested package names). While working on this change, we realized that it 
would make sense to move the "type constructor functions" (e.g. 
`arrow.type.boolean`, `arrow.type.uint64`, etc.) into the top-level `arrow` 
package, as well (i.e. `arrow.boolean`, `arrow.uint64`, etc.). In other words, 
moving forward, the recommended APIs for the MATLAB interface will be placed 
directly under the top-level `arrow` package. This should hopefully result in 
an easier to use interface and make it easier for users to use multiple 
language bindings (e.g. MATLAB and PyArrow) together, with less context 
switching. 
   
   ### Notes
   
   1. @sgilmore10 is working on a follow up PR for simplifying the `switch` 
statement code `makeTypeProxy`. Her solution will be more generic, so that we 
can re-use it elsewhere across the code base of the MATLAB interface.
   2. Thank you @sgilmore10 for your help with this pull request!


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to