sgilmore10 opened a new pull request, #36731:
URL: https://github.com/apache/arrow/pull/36731
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's
Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing
Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor
PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes).
Could you open an issue for this pull request on GitHub?
https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the
[Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.)
of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
Now that the issue #36363 is closed via PR #36419, we can initialize the
`Type` property of `arrow.array.Array` subclasses from existing proxy ids.
Currently, we create a new proxy `Type` object whose underlying
`arrow::DataType` are semantically equal to - but not the same as - the
`arrow::DataType` owned by the Array proxy. It would be preferable if the
`Type` and `Array` proxy classes refer to the same `arrow::DataType` object
(i.e. the same object on the heap).
### What changes are included in this PR?
1. Upgraded `libmexclass` to commit
[d04f88d](https://github.com/mathworks/libmexclass/commit/d04f88d2a6f6dcf65d595183eda03c4b66b2961f).
In this commit, we added a static "make-like" function to `Proxy` called
`create`.
2. Modified the constructors of all `Type` objects to expect a single
`Proxy` object as input. This is a breaking change and means clients are no
longer expected to build `Type` objects via their instructors. Instead, we
introduced standalone functions that clients can use to construct `Type`
objects, i.e. `arrow.type.int8`, `arrow.type.string`, `arrow.type.timestamp`,
etc. These functions deal with creating the `Proxy` objects to pass to the
`Type` constructors. Below is an example of the new workflow for creating
`Type` objects.
```matlab
>> timestampType = arrow.type.timestamp(TimeUnit="second",
TimeZone="America/New_York")
timestampType =
TimestampType with properties:
ID: Timestamp
```
NOTE: We plan on enhancing the display to show the `TimeUnit` and `TimeZone`
properties.
3. Made `Type` a
[dependent](https://www.mathworks.com/help/matlab/matlab_oop/access-methods-for-dependent-properties.html)
property on `arrow.array.Arary`. The `get.Type` method constructs a `Type`
object on demand by making a proxy that wraps the same `arrow::DataType` object
stored within the `arrow::Array`.
### Are these changes tested?
Yes, updated existing tests.
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
6. 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)?
-->
### Are there any user-facing changes?
Yes, we added new standalone functions for creating `Type` objects.
### Notes
Thanks @kevingurney for the advice!
--
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]