Skip to content
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-37232: [MATLAB] Add arrow.type.Time64Type class and arrow.time64 construction function #37287

Merged
merged 13 commits into from
Aug 21, 2023

Conversation

sgilmore10
Copy link
Member

@sgilmore10 sgilmore10 commented Aug 21, 2023

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

>> 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
  2. arrow.type.Time64Type class

Future Directions

  1. [MATLAB] Add arrow.type.Date32Type class and arrow.date32 construction function #37229
  2. [MATLAB] Add arrow.type.Date64Type class and arrow.date64 construction function #37230
  3. Add arrow.array.Time64Array class

@sgilmore10 sgilmore10 marked this pull request as ready for review August 21, 2023 19:03
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Aug 21, 2023
Copy link
Member

@kevingurney kevingurney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request!

matlab/test/arrow/type/tTime64Type.m Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Aug 21, 2023
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Aug 21, 2023
@kevingurney
Copy link
Member

+1

@kevingurney kevingurney merged commit a0ffa91 into apache:main Aug 21, 2023
10 checks passed
@kevingurney kevingurney deleted the GH-37232 branch August 21, 2023 20:29
@kevingurney kevingurney removed the awaiting merge Awaiting merge label Aug 21, 2023
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit a0ffa91.

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.

kevingurney pushed a commit that referenced this pull request Aug 25, 2023
### Rationale for this change

Now that `arrow.type.Time64Type` class has been added to the MATLAB Interface (#37287), we can add the `arrow.array.Time64Array` class.

### What changes are included in this PR?

1. New `arrow.array.Time64Array` class.
2. New `arrow.type.traits.Time64Traits` class.
3. Enhanced `arrow.array(data)` to return a `arrow.array.Time64Array` instance if the input `data` is a MATLAB `duration` array. The MATLAB `duration` type represents length of time in fixed-length units.
4. Enhanced `arrow.type.traits.traits(id)` to return an `arrow.type.traits.Time64Traits` instance if `id` is an `arrow.type.ID.Time64` value or equal to the string `"duration".`
5. Updated the test utility `arrow.internal.test.tabular.createAllSupportedArrayTypes()` to include an `arrow.array.Time64Array` instance in its output.
6. Updated the test utility `arrow.internal.test.tabular.createTableWithSupportedTypes()` to include a `duration` variable on the returned `table`. 
7. Updated the README.md to include `Time32Array` and `Time64Array`.

**Example Usage**
```matlab

% Create a duration array
>> ms = milliseconds([100 150 1001])

ms = 

  1×3 duration array

     0.1 sec    0.15 sec   1.001 sec

% Create an arrow.type.Time64Array
>> time = arrow.array(ms)

time = 

[
  00:00:00.100000,
  00:00:00.150000,
  00:00:01.001000
]

% Create a duration array from an arrow.array.Time64Array
>> data = duration(time) 

data = 

  3×1 duration array

     0.1 sec
    0.15 sec
   1.001 sec

```

### Are these changes tested?

Yes.

1. Added a new test class `tTime64Array.m`.
2. Added a new test class `tTime64Traits.m`
3. Added new test cases to `tArray.m` and `ttraits.m`

### Are there any user-facing changes?

Yes. Users can now create `arrow.array.Time64Array`s from  MATLAB `duration`s

* Closes: #37337

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 pull request 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 pull request Nov 13, 2023
…37368)

### Rationale for this change

Now that `arrow.type.Time64Type` class has been added to the MATLAB Interface (apache#37287), we can add the `arrow.array.Time64Array` class.

### What changes are included in this PR?

1. New `arrow.array.Time64Array` class.
2. New `arrow.type.traits.Time64Traits` class.
3. Enhanced `arrow.array(data)` to return a `arrow.array.Time64Array` instance if the input `data` is a MATLAB `duration` array. The MATLAB `duration` type represents length of time in fixed-length units.
4. Enhanced `arrow.type.traits.traits(id)` to return an `arrow.type.traits.Time64Traits` instance if `id` is an `arrow.type.ID.Time64` value or equal to the string `"duration".`
5. Updated the test utility `arrow.internal.test.tabular.createAllSupportedArrayTypes()` to include an `arrow.array.Time64Array` instance in its output.
6. Updated the test utility `arrow.internal.test.tabular.createTableWithSupportedTypes()` to include a `duration` variable on the returned `table`. 
7. Updated the README.md to include `Time32Array` and `Time64Array`.

**Example Usage**
```matlab

% Create a duration array
>> ms = milliseconds([100 150 1001])

ms = 

  1×3 duration array

     0.1 sec    0.15 sec   1.001 sec

% Create an arrow.type.Time64Array
>> time = arrow.array(ms)

time = 

[
  00:00:00.100000,
  00:00:00.150000,
  00:00:01.001000
]

% Create a duration array from an arrow.array.Time64Array
>> data = duration(time) 

data = 

  3×1 duration array

     0.1 sec
    0.15 sec
   1.001 sec

```

### Are these changes tested?

Yes.

1. Added a new test class `tTime64Array.m`.
2. Added a new test class `tTime64Traits.m`
3. Added new test cases to `tArray.m` and `ttraits.m`

### Are there any user-facing changes?

Yes. Users can now create `arrow.array.Time64Array`s from  MATLAB `duration`s

* Closes: apache#37337

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MATLAB] Add arrow.type.Time64Type class and arrow.time64 construction function
2 participants