-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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.array.Time32Array
class
#37290
Comments
take |
kou
pushed a commit
that referenced
this issue
Aug 23, 2023
### Rationale for this change Now that the `arrow.type.Time32Type` class has been added to the MATLAB Interface (#37250), we can add the `arrow.array.Time32Array` class. ### What changes are included in this PR? 1. Added a new class `arrow.array.Time32Array`. It has the following read-only properties: `Type` and `Length`. It has the following methods: `fromMATLAB()`, `toMATLAB()`, and `duration()`. For reference, `duration` arrays in MATLAB represent lengths of time in fixed-length units. Here's a [link](https://www.mathworks.com/help/matlab/ref/duration.html) to the documentation. 2. Added a new class called `arrow.type.traits.Time32Traits`. **Example Usage** ```matlab >> times = seconds([100 120 NaN 200]) times = 1×4 duration array 100 sec 120 sec NaN sec 200 sec >> time32Array = arrow.array.Time32Array.fromMATLAB(times) time32Array = [ 00:01:40, 00:02:00, null, 00:03:20 ] >> roundtrip = toMATLAB(time32Array) roundtrip = 4×1 duration array 100 sec 120 sec NaN sec 200 sec ``` You can also specify the `TimeUnit` to use via a name-value pair. `TimeUnit` can either be `"Second"` (default) or `"Milisecond"`. ```matlab >> times = seconds([100 120 NaN 200]); >> time32Array = arrow.array.Time32Array.fromMATLAB(times, TimeUnit="Millisecond") time32Array = [ 00:01:40.000, 00:02:00.000, null, 00:03:20.000 ] ``` ### Are these changes tested? Yes. Added two new test classes: `tTime32Array.m` and `tTime32Traits.m`. ### Are there any user-facing changes? Yes, users can now create `arrow.array.Time32Array`s from MATLAB `duration`s via the static `fromMATLAB` method on `arrow.array.Time32Array`. ### Future Directions 1. Add `arrow.array.Time64Array` 2. Add `arrow.type.Date32Type` and `arrow.array.Date32Array` 4. Add `arrow.type.Date64Type` and `arrow.array.Date64Array` * Closes: #37290 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this issue
Nov 13, 2023
…37315) ### Rationale for this change Now that the `arrow.type.Time32Type` class has been added to the MATLAB Interface (apache#37250), we can add the `arrow.array.Time32Array` class. ### What changes are included in this PR? 1. Added a new class `arrow.array.Time32Array`. It has the following read-only properties: `Type` and `Length`. It has the following methods: `fromMATLAB()`, `toMATLAB()`, and `duration()`. For reference, `duration` arrays in MATLAB represent lengths of time in fixed-length units. Here's a [link](https://www.mathworks.com/help/matlab/ref/duration.html) to the documentation. 2. Added a new class called `arrow.type.traits.Time32Traits`. **Example Usage** ```matlab >> times = seconds([100 120 NaN 200]) times = 1×4 duration array 100 sec 120 sec NaN sec 200 sec >> time32Array = arrow.array.Time32Array.fromMATLAB(times) time32Array = [ 00:01:40, 00:02:00, null, 00:03:20 ] >> roundtrip = toMATLAB(time32Array) roundtrip = 4×1 duration array 100 sec 120 sec NaN sec 200 sec ``` You can also specify the `TimeUnit` to use via a name-value pair. `TimeUnit` can either be `"Second"` (default) or `"Milisecond"`. ```matlab >> times = seconds([100 120 NaN 200]); >> time32Array = arrow.array.Time32Array.fromMATLAB(times, TimeUnit="Millisecond") time32Array = [ 00:01:40.000, 00:02:00.000, null, 00:03:20.000 ] ``` ### Are these changes tested? Yes. Added two new test classes: `tTime32Array.m` and `tTime32Traits.m`. ### Are there any user-facing changes? Yes, users can now create `arrow.array.Time32Array`s from MATLAB `duration`s via the static `fromMATLAB` method on `arrow.array.Time32Array`. ### Future Directions 1. Add `arrow.array.Time64Array` 2. Add `arrow.type.Date32Type` and `arrow.array.Date32Array` 4. Add `arrow.type.Date64Type` and `arrow.array.Date64Array` * Closes: apache#37290 Authored-by: Sarah Gilmore <sgilmore@mathworks.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the enhancement requested
Now that
arrow.type.Time32Type
class has been added to the MATLAB Interface (#37250), we can add thearrow.array.Time32Array
class.Component(s)
MATLAB
The text was updated successfully, but these errors were encountered: