-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
GH-37229: [MATLAB] Add arrow.type.Date32Type
class and arrow.date32
construction function
#37348
Conversation
2. Add arrow.type.ID.Date32 type enumeration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! Just found a few typos.
namespace alias. Co-authored-by: Sarah Gilmore <[email protected]>
+1 |
After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit 0f73be1. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them. |
### Rationale for this change Now that `arrow.type.Date32Type` class has been added to the MATLAB Interface (#37348), we can add the `arrow.array.Date32Array` class. `Date32Array`s can be created from MATLAB [`datetime`](https://www.mathworks.com/help/matlab/ref/datetime.html) values. ### What changes are included in this PR? 1. Added a new `arrow.array.Date32Array` class. 2. Added a new `arrow.type.traits.Date32Traits` class. 3. Added `arrow.type.Date32Type` support to `arrow.type.traits.traits` function. 4. Fixed typo `arrray` in `tTime32Array` test class. 5. Fixed bug in `numeric_array.h` where the `CType` rather than the `ArrowType` was being used to determine the `DataType` of an array class that is a `NumericArray<T>`. `Date32Array`s can be created from MATLAB [`datetime`](https://www.mathworks.com/help/matlab/ref/datetime.html) values using the `fromMATLAB` method. `Date32Array`s can be converted to MATLAB `datetime` values using the `toMATLAB` method. **Example** ```matlab >> dates = [datetime(2021, 1, 2, 3, 4, 5), datetime(2023, 1, 1), datetime(1989, 2, 3, 10, 10, 10)]' dates = 3x1 datetime array 02-Jan-2021 03:04:05 01-Jan-2023 00:00:00 03-Feb-1989 10:10:10 >> array = arrow.array.Date32Array.fromMATLAB(dates) array = [ 2021-01-02, 2023-01-01, 1989-02-03 ] >> array.toMATLAB() ans = 3x1 datetime array 02-Jan-2021 01-Jan-2023 03-Feb-1989 ``` ### Are these changes tested? Yes. 1. Added a new `tDate32Array` test class. 2. Added `Date32` related test to `ttraits.m`. 6. Added a new `tDate32Traits.m` test class. ### Are there any user-facing changes? Yes. 1. Users can now create `arrow.array.Date32Array`s from MATLAB `datetime`s. ### Future Directions 1. #37230 2. Add `arrow.array.Date64Array`. 3. Add a way to extract the raw `int32` values from an `arrow.array.Date32Array` without converting to a MATLAB `datetime` using `toMATLAB`. ### Notes 1. Thank you @ sgilmore10 for your help with this pull request! * Closes: #37367 Lead-authored-by: Kevin Gurney <[email protected]> Co-authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
….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 <[email protected]> Co-authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Kevin Gurney <[email protected]>
…37445) ### Rationale for this change Now that `arrow.type.Date32Type` class has been added to the MATLAB Interface (apache#37348), we can add the `arrow.array.Date32Array` class. `Date32Array`s can be created from MATLAB [`datetime`](https://www.mathworks.com/help/matlab/ref/datetime.html) values. ### What changes are included in this PR? 1. Added a new `arrow.array.Date32Array` class. 2. Added a new `arrow.type.traits.Date32Traits` class. 3. Added `arrow.type.Date32Type` support to `arrow.type.traits.traits` function. 4. Fixed typo `arrray` in `tTime32Array` test class. 5. Fixed bug in `numeric_array.h` where the `CType` rather than the `ArrowType` was being used to determine the `DataType` of an array class that is a `NumericArray<T>`. `Date32Array`s can be created from MATLAB [`datetime`](https://www.mathworks.com/help/matlab/ref/datetime.html) values using the `fromMATLAB` method. `Date32Array`s can be converted to MATLAB `datetime` values using the `toMATLAB` method. **Example** ```matlab >> dates = [datetime(2021, 1, 2, 3, 4, 5), datetime(2023, 1, 1), datetime(1989, 2, 3, 10, 10, 10)]' dates = 3x1 datetime array 02-Jan-2021 03:04:05 01-Jan-2023 00:00:00 03-Feb-1989 10:10:10 >> array = arrow.array.Date32Array.fromMATLAB(dates) array = [ 2021-01-02, 2023-01-01, 1989-02-03 ] >> array.toMATLAB() ans = 3x1 datetime array 02-Jan-2021 01-Jan-2023 03-Feb-1989 ``` ### Are these changes tested? Yes. 1. Added a new `tDate32Array` test class. 2. Added `Date32` related test to `ttraits.m`. 6. Added a new `tDate32Traits.m` test class. ### Are there any user-facing changes? Yes. 1. Users can now create `arrow.array.Date32Array`s from MATLAB `datetime`s. ### Future Directions 1. apache#37230 2. Add `arrow.array.Date64Array`. 3. Add a way to extract the raw `int32` values from an `arrow.array.Date32Array` without converting to a MATLAB `datetime` using `toMATLAB`. ### Notes 1. Thank you @ sgilmore10 for your help with this pull request! * Closes: apache#37367 Lead-authored-by: Kevin Gurney <[email protected]> Co-authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
…37445) ### Rationale for this change Now that `arrow.type.Date32Type` class has been added to the MATLAB Interface (apache#37348), we can add the `arrow.array.Date32Array` class. `Date32Array`s can be created from MATLAB [`datetime`](https://www.mathworks.com/help/matlab/ref/datetime.html) values. ### What changes are included in this PR? 1. Added a new `arrow.array.Date32Array` class. 2. Added a new `arrow.type.traits.Date32Traits` class. 3. Added `arrow.type.Date32Type` support to `arrow.type.traits.traits` function. 4. Fixed typo `arrray` in `tTime32Array` test class. 5. Fixed bug in `numeric_array.h` where the `CType` rather than the `ArrowType` was being used to determine the `DataType` of an array class that is a `NumericArray<T>`. `Date32Array`s can be created from MATLAB [`datetime`](https://www.mathworks.com/help/matlab/ref/datetime.html) values using the `fromMATLAB` method. `Date32Array`s can be converted to MATLAB `datetime` values using the `toMATLAB` method. **Example** ```matlab >> dates = [datetime(2021, 1, 2, 3, 4, 5), datetime(2023, 1, 1), datetime(1989, 2, 3, 10, 10, 10)]' dates = 3x1 datetime array 02-Jan-2021 03:04:05 01-Jan-2023 00:00:00 03-Feb-1989 10:10:10 >> array = arrow.array.Date32Array.fromMATLAB(dates) array = [ 2021-01-02, 2023-01-01, 1989-02-03 ] >> array.toMATLAB() ans = 3x1 datetime array 02-Jan-2021 01-Jan-2023 03-Feb-1989 ``` ### Are these changes tested? Yes. 1. Added a new `tDate32Array` test class. 2. Added `Date32` related test to `ttraits.m`. 6. Added a new `tDate32Traits.m` test class. ### Are there any user-facing changes? Yes. 1. Users can now create `arrow.array.Date32Array`s from MATLAB `datetime`s. ### Future Directions 1. apache#37230 2. Add `arrow.array.Date64Array`. 3. Add a way to extract the raw `int32` values from an `arrow.array.Date32Array` without converting to a MATLAB `datetime` using `toMATLAB`. ### Notes 1. Thank you @ sgilmore10 for your help with this pull request! * Closes: apache#37367 Lead-authored-by: Kevin Gurney <[email protected]> Co-authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Rationale for this change
In support of adding
arrow.array.Date32Array
, this pull request adds a newarrow.type.Date32Type
class and associatedarrow.date32
construction function to the MATLAB interface.What changes are included in this PR?
arrow.type.Date32Type
class.arrow.date32
construction function that returns anarrow.type.Date32Type
instance.arrow.type.ID.Date32
type enumeration value.arrow.type.DateType
class whicharrow.type.Date32Type
inherits from.arrow.type.Date64Type
will also inherit from this class to share theDateUnit
property. This mirrors the implementation of theTime32Type
andTime64Type
classes inheriting from an abstractarrow.type.TimeType
class to share theTimeUnit
property.Example
Are these changes tested?
Yes.
tDate32Type
test class.tID
test class to includearrow.type.ID.Date32
.Are there any user-facing changes?
Yes.
arrow.type.Date32Type
class.arrow.date32
construction function.arrow.type.ID.Date32
type enumeration value.Future Directions
arrow.type.Date64Type
class andarrow.date64
construction function #37230arrow.array.Date32Array
class.arrow.array.Date64Array
class.arrow.type.Date32Type
class andarrow.date32
construction function #37229