New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MATLAB] Add arrow.type.Date32Type
class and arrow.date32
construction function
#37229
Comments
kevingurney
added a commit
that referenced
this issue
Aug 18, 2023
…#37236) ### Rationale for this change To simplify the implementation of `Time32Type`, `Time64Type`, `Date32Type`, and `Date64Type`, it would be helpful to create an abstract `arrow.type.TemporalType` class that the date and time types can inherit from. As a first step, we can modify the implementation of `TimestampType` to inherit from `TemporalType`. This mimics the class inheritance hierarchy from the C++ libraries. ### What changes are included in this PR? 1. Added a new MATLAB class called `arrow.type.TemporalType`. It inherits from `arrow.type.FixedWidthType` and defines one read-only property: `TimeUnit`. 2. Modified the MATLAB class `arrow.type.TimestampType` to inherit from `arrow.type.TemporalType` instead of `arrow.type.FixedWidthType`. 3. Renamed the C++ `proxy::TimestampType` methods `timeUnit()` and `timeZone()` to `getTimeUnit()` and `getTimeZone()`. ### Are these changes tested? Yes. The existing tests in `tTimetampType.m` cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. Add `arrow.type.Time32Type` (#37231) 2. Add `arrow.type.Time64Type` (#37225) 3. Add `arrow.type.Date32Type` (#37229), 4. Add `arrow.type.Time64Type` (#37230). 5. Add `arrow.array.Time32Array` 6. Add `arrow.array.Time64Array` 7. Add `arrow.array.Date32Array` 8. Add `arrow.array.Date64Array` * Closes: #37234 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
kevingurney
added a commit
that referenced
this issue
Aug 18, 2023
…2` construction function (#37250) ### Rationale for this change To support the addition of `arrow.array.Time32Array`, this pull request adds a new `arrow.type.Time32Type` class and associated `arrow.time32` construction function to the MATLAB interface. ### What changes are included in this PR? 1. New `arrow.type.Time32Type` class. 2. New `arrow.time32` construction function that returns an `arrow.type.Time32Type` instance. **Example** ```matlab >> type = arrow.time32(TimeUnit="Millisecond") type = Time32Type with properties: ID: Time32 TimeUnit: Millisecond >> class(type) ans = 'arrow.type.Time32Type' ``` ### Are these changes tested? Yes. 1. Added new tests for `Time32` type ID enumeration to `tID`. 2. Added a test class `tTimeUnit` for the new validation function `arrow.internal.validate.temporal.timeUnit`. 4. Added a new test class `tTime32Type`. ### Are there any user-facing changes? Yes. There are two new user-facing APIs: 1. `arrow.time32` construction function 2. `arrow.type.Time32Type` class ### Future Directions: 1. #37232 2. #37229 3. #37230 4. #37251 ### Notes 1. Thank you @ sgilmore10 for your help with this pull request! * Closes: #37231 Lead-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
kevingurney
pushed a commit
that referenced
this issue
Aug 21, 2023
### Rationale for this change The original motivation for adding the super-class `arrow.type.TemporalType` in #37236 was to define a common implementation for extracting the `Unit` property from `TimestampType`, `Time32Type`, `Time64Type`, `Date32Type`, and `Date64Type`. However, this approach doesn't work because the `Unit` property on `Date32Type` and `Date64Type` is a `DateUnit`, while the `Unit` property on the other three types is a`TimeUnit`. As a result, we cannot define a shared method for extracting the `Unit` property in `TemporalType`. Instead, we plan on making `arrow.type.TemporalType` a "tag"-class (i.e. it has no properties or methods) so it can be used to group the "temporal" types together to ease authoring conditional logical in client code. In a future PR, we plan on adding functions like `arrow.type.isTemporal`, `arrow.type.isNumeric`, etc. so that clients don't need to query the class type information directly (i.e. call `isa(type, "arrow.type.TemporalType")`). ```matlab function doStuff(arrowArray) import arrow.* arrowType = arrowArray.Type; if type.isTemporal(arrowType) ... else if type.isNumeric(arrowType) ... else ... end end ``` ### What changes are included in this PR? 1. Removed the `TimeUnit` property from `arrow.type.TemporalType` 2. Added `TimeUnit` back as a property on `arrow.type.TimestampType` and `arrow.type.Time32Type` ### Are these changes tested? Yes, the existing tests cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. #37232 2. #37229 3. #37230 * Closes: #37251 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
kevingurney
pushed a commit
that referenced
this issue
Aug 21, 2023
…#37279) ### Rationale for this change To reduce code duplication within `Time32Type` and `Time64Type`, we should add an abstract class called `arrow.type.TimeType` that implements the getter method for the `TimeUnit` property. This class hierarchy will mirror the class hierarchy in the C++ arrow implementation. ### What changes are included in this PR? 1. Defined a new C++ proxy class for called `arrow::matlab::type::proxy::TimeType`. This class defines a `getTimeUnit` method. 2. Modified the C++ proxy class `Time32Type` to inherit from `arrow::matlab::type::proxy::TimeType`. Removed the `getTimeUnit` method from this class because it's now defined on `TimeType`. 3. Added a new MATLAB class called `arrow.type.TimeType`. It has one method: `get.TimeUnit`. 4. Modified `arrow.type.Time32Type` to inherit from `arrow.type.TimeType` and removed its `get.TimeUnit` method. ### Are these changes tested? Yes, the existing tests cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. #37232 2. #37229 3. #37230 * Closes: #37262 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
kevingurney
added a commit
that referenced
this issue
Aug 21, 2023
### Rationale for this change In support of adding `arrow.type.Date32Type` and `arrow.type.Date64Type`, this pull request adds a `arrow.type.DateUnit` enumeration class mirroring the `arrow.type.TimeUnit` enumeration class. `arrow.type.DateUnit` will have two values: `Day` and `Millisecond`. ### What changes are included in this PR? 1. Added a new enumeration class `arrow.type.DateUnit` which mirrors the `arrow.type.TimeUnit` enumeration class. **Example**: ```matlab >> day = arrow.type.DateUnit.Day day = DateUnit enumeration Day >> millisecond = arrow.type.DateUnit.Millisecond millisecond = DateUnit enumeration Millisecond ``` ### Are these changes tested? Yes. 1. Added a new test class `tDateUnit` for `arrow.type.DateUnit` tests. 2. Updated code for `tTimeUnit` for consistency with `tDateUnit`. ### Are there any user-facing changes? Yes. 1. There is now a new user-facing `arrow.type.DateUnit` enumeration class. ### Future Directions 1. Add an `arrow.internal.validate.temporal.dateUnit` helper function that mirrors `arrow.internal.validate.temporal.timeUnit`. 2. #37229 3. #37230 * Closes: #37252 Lead-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
kevingurney
pushed a commit
that referenced
this issue
Aug 21, 2023
…4` construction function (#37287) ### Rationale for this change To add support for `arrow.array.Time64Array`, we will need to add support for a `arrow.type.Time64Type` class and associated `arrow.time64` construction function to the MATLAB interface. ### What changes are included in this PR? 1. New `arrow.type.Time64Type` class. 2. New `arrow.time64` construction function that returns an `arrow.type.Time64Type` instance. **Example** ```matlab >> type = arrow.time64(TimeUnit="Nanosecond") type = Time64Type with properties: ID: Time64 TimeUnit: Nanosecond >> class(type) ans = 'arrow.type.Time64Type' ``` ### Are these changes tested? Yes. 1. Added a new test class `tTime64Type`. 2. Added new tests for `Time64` type ID enumeration to `tID`. ### Are there any user-facing changes? Yes. 1. `arrow.time64` construction function 3. `arrow.type.Time64Type` class ### Future Directions 1. #37229 2. #37230 3. Add `arrow.array.Time64Array` class * Closes: #37232 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
kevingurney
added a commit
that referenced
this issue
Aug 23, 2023
…2` construction function (#37348) ### Rationale for this change In support of adding `arrow.array.Date32Array`, this pull request adds a new `arrow.type.Date32Type` class and associated `arrow.date32` construction function to the MATLAB interface. ### What changes are included in this PR? 1. New `arrow.type.Date32Type` class. 2. New `arrow.date32` construction function that returns an `arrow.type.Date32Type` instance. 3. New `arrow.type.ID.Date32` type enumeration value. 4. Added an abstract `arrow.type.DateType` class which `arrow.type.Date32Type` inherits from. `arrow.type.Date64Type` will also inherit from this class to share the `DateUnit` property. This mirrors the implementation of the `Time32Type` and `Time64Type` classes inheriting from an abstract `arrow.type.TimeType` class to share the `TimeUnit` property. **Example** ```matlab >> type = arrow.date32() type = Date32Type with properties: ID: Date32 DateUnit: Day ``` ### Are these changes tested? Yes. 1. Added a new `tDate32Type` test class. 2. Updated the `tID` test class to include `arrow.type.ID.Date32`. ### Are there any user-facing changes? Yes. 1. There is a new public `arrow.type.Date32Type` class. 2. There is a new public `arrow.date32` construction function. 3. There is a new `arrow.type.ID.Date32` type enumeration value. ### Future Directions 1. #37230 2. Add `arrow.array.Date32Array` class. 3. Add `arrow.array.Date64Array` class. * Closes: #37229 Lead-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
… class (apache#37236) ### Rationale for this change To simplify the implementation of `Time32Type`, `Time64Type`, `Date32Type`, and `Date64Type`, it would be helpful to create an abstract `arrow.type.TemporalType` class that the date and time types can inherit from. As a first step, we can modify the implementation of `TimestampType` to inherit from `TemporalType`. This mimics the class inheritance hierarchy from the C++ libraries. ### What changes are included in this PR? 1. Added a new MATLAB class called `arrow.type.TemporalType`. It inherits from `arrow.type.FixedWidthType` and defines one read-only property: `TimeUnit`. 2. Modified the MATLAB class `arrow.type.TimestampType` to inherit from `arrow.type.TemporalType` instead of `arrow.type.FixedWidthType`. 3. Renamed the C++ `proxy::TimestampType` methods `timeUnit()` and `timeZone()` to `getTimeUnit()` and `getTimeZone()`. ### Are these changes tested? Yes. The existing tests in `tTimetampType.m` cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. Add `arrow.type.Time32Type` (apache#37231) 2. Add `arrow.type.Time64Type` (apache#37225) 3. Add `arrow.type.Date32Type` (apache#37229), 4. Add `arrow.type.Time64Type` (apache#37230). 5. Add `arrow.array.Time32Array` 6. Add `arrow.array.Time64Array` 7. Add `arrow.array.Date32Array` 8. Add `arrow.array.Date64Array` * Closes: apache#37234 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
….time32` construction function (apache#37250) ### Rationale for this change To support the addition of `arrow.array.Time32Array`, this pull request adds a new `arrow.type.Time32Type` class and associated `arrow.time32` construction function to the MATLAB interface. ### What changes are included in this PR? 1. New `arrow.type.Time32Type` class. 2. New `arrow.time32` construction function that returns an `arrow.type.Time32Type` instance. **Example** ```matlab >> type = arrow.time32(TimeUnit="Millisecond") type = Time32Type with properties: ID: Time32 TimeUnit: Millisecond >> class(type) ans = 'arrow.type.Time32Type' ``` ### Are these changes tested? Yes. 1. Added new tests for `Time32` type ID enumeration to `tID`. 2. Added a test class `tTimeUnit` for the new validation function `arrow.internal.validate.temporal.timeUnit`. 4. Added a new test class `tTime32Type`. ### Are there any user-facing changes? Yes. There are two new user-facing APIs: 1. `arrow.time32` construction function 2. `arrow.type.Time32Type` class ### Future Directions: 1. apache#37232 2. apache#37229 3. apache#37230 4. apache#37251 ### Notes 1. Thank you @ sgilmore10 for your help with this pull request! * Closes: apache#37231 Lead-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
…apache#37256) ### Rationale for this change The original motivation for adding the super-class `arrow.type.TemporalType` in apache#37236 was to define a common implementation for extracting the `Unit` property from `TimestampType`, `Time32Type`, `Time64Type`, `Date32Type`, and `Date64Type`. However, this approach doesn't work because the `Unit` property on `Date32Type` and `Date64Type` is a `DateUnit`, while the `Unit` property on the other three types is a`TimeUnit`. As a result, we cannot define a shared method for extracting the `Unit` property in `TemporalType`. Instead, we plan on making `arrow.type.TemporalType` a "tag"-class (i.e. it has no properties or methods) so it can be used to group the "temporal" types together to ease authoring conditional logical in client code. In a future PR, we plan on adding functions like `arrow.type.isTemporal`, `arrow.type.isNumeric`, etc. so that clients don't need to query the class type information directly (i.e. call `isa(type, "arrow.type.TemporalType")`). ```matlab function doStuff(arrowArray) import arrow.* arrowType = arrowArray.Type; if type.isTemporal(arrowType) ... else if type.isNumeric(arrowType) ... else ... end end ``` ### What changes are included in this PR? 1. Removed the `TimeUnit` property from `arrow.type.TemporalType` 2. Added `TimeUnit` back as a property on `arrow.type.TimestampType` and `arrow.type.Time32Type` ### Are these changes tested? Yes, the existing tests cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. apache#37232 2. apache#37229 3. apache#37230 * Closes: apache#37251 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
…eType` (apache#37279) ### Rationale for this change To reduce code duplication within `Time32Type` and `Time64Type`, we should add an abstract class called `arrow.type.TimeType` that implements the getter method for the `TimeUnit` property. This class hierarchy will mirror the class hierarchy in the C++ arrow implementation. ### What changes are included in this PR? 1. Defined a new C++ proxy class for called `arrow::matlab::type::proxy::TimeType`. This class defines a `getTimeUnit` method. 2. Modified the C++ proxy class `Time32Type` to inherit from `arrow::matlab::type::proxy::TimeType`. Removed the `getTimeUnit` method from this class because it's now defined on `TimeType`. 3. Added a new MATLAB class called `arrow.type.TimeType`. It has one method: `get.TimeUnit`. 4. Modified `arrow.type.Time32Type` to inherit from `arrow.type.TimeType` and removed its `get.TimeUnit` method. ### Are these changes tested? Yes, the existing tests cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. apache#37232 2. apache#37229 3. apache#37230 * Closes: apache#37262 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
…pache#37280) ### Rationale for this change In support of adding `arrow.type.Date32Type` and `arrow.type.Date64Type`, this pull request adds a `arrow.type.DateUnit` enumeration class mirroring the `arrow.type.TimeUnit` enumeration class. `arrow.type.DateUnit` will have two values: `Day` and `Millisecond`. ### What changes are included in this PR? 1. Added a new enumeration class `arrow.type.DateUnit` which mirrors the `arrow.type.TimeUnit` enumeration class. **Example**: ```matlab >> day = arrow.type.DateUnit.Day day = DateUnit enumeration Day >> millisecond = arrow.type.DateUnit.Millisecond millisecond = DateUnit enumeration Millisecond ``` ### Are these changes tested? Yes. 1. Added a new test class `tDateUnit` for `arrow.type.DateUnit` tests. 2. Updated code for `tTimeUnit` for consistency with `tDateUnit`. ### Are there any user-facing changes? Yes. 1. There is now a new user-facing `arrow.type.DateUnit` enumeration class. ### Future Directions 1. Add an `arrow.internal.validate.temporal.dateUnit` helper function that mirrors `arrow.internal.validate.temporal.timeUnit`. 2. apache#37229 3. apache#37230 * Closes: apache#37252 Lead-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
….time64` construction function (apache#37287) ### Rationale for this change To add support for `arrow.array.Time64Array`, we will need to add support for a `arrow.type.Time64Type` class and associated `arrow.time64` construction function to the MATLAB interface. ### What changes are included in this PR? 1. New `arrow.type.Time64Type` class. 2. New `arrow.time64` construction function that returns an `arrow.type.Time64Type` instance. **Example** ```matlab >> type = arrow.time64(TimeUnit="Nanosecond") type = Time64Type with properties: ID: Time64 TimeUnit: Nanosecond >> class(type) ans = 'arrow.type.Time64Type' ``` ### Are these changes tested? Yes. 1. Added a new test class `tTime64Type`. 2. Added new tests for `Time64` type ID enumeration to `tID`. ### Are there any user-facing changes? Yes. 1. `arrow.time64` construction function 3. `arrow.type.Time64Type` class ### Future Directions 1. apache#37229 2. apache#37230 3. Add `arrow.array.Time64Array` class * Closes: apache#37232 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
….date32` construction function (apache#37348) ### Rationale for this change In support of adding `arrow.array.Date32Array`, this pull request adds a new `arrow.type.Date32Type` class and associated `arrow.date32` construction function to the MATLAB interface. ### What changes are included in this PR? 1. New `arrow.type.Date32Type` class. 2. New `arrow.date32` construction function that returns an `arrow.type.Date32Type` instance. 3. New `arrow.type.ID.Date32` type enumeration value. 4. Added an abstract `arrow.type.DateType` class which `arrow.type.Date32Type` inherits from. `arrow.type.Date64Type` will also inherit from this class to share the `DateUnit` property. This mirrors the implementation of the `Time32Type` and `Time64Type` classes inheriting from an abstract `arrow.type.TimeType` class to share the `TimeUnit` property. **Example** ```matlab >> type = arrow.date32() type = Date32Type with properties: ID: Date32 DateUnit: Day ``` ### Are these changes tested? Yes. 1. Added a new `tDate32Type` test class. 2. Updated the `tID` test class to include `arrow.type.ID.Date32`. ### Are there any user-facing changes? Yes. 1. There is a new public `arrow.type.Date32Type` class. 2. There is a new public `arrow.date32` construction function. 3. There is a new `arrow.type.ID.Date32` type enumeration value. ### Future Directions 1. apache#37230 2. Add `arrow.array.Date32Array` class. 3. Add `arrow.array.Date64Array` class. * Closes: apache#37229 Lead-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the enhancement requested
To add support for
arrow.array.Date32Array
, we will need to add support for aarrow.type.Date32Type
class and associatedarrow.date32
construction function to the MATLAB interface.Component(s)
MATLAB
The text was updated successfully, but these errors were encountered: