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

[MATLAB] Add signed integer array MATLAB classes (i.e. Int8Array, Int16Array, Int32Array, Int64Array) #35558

Closed
sgilmore10 opened this issue May 11, 2023 · 1 comment · Fixed by #35561

Comments

@sgilmore10
Copy link
Member

Describe the enhancement requested

Followup to #35495 in which we added the MATLAB class Float32Array.

Arrow Array Type MATLAB Type
Int8Array int8
Int16Array int16
Int32Array int32
Int64Array int64

Component(s)

MATLAB

@sgilmore10 sgilmore10 changed the title [MATLAB] Add unsigned integer array MATLAB classes (i.e. Int8Array, Int16Array, Int32Array, Int64Array) [MATLAB] Add signed integer array MATLAB classes (i.e. Int8Array, Int16Array, Int32Array, Int64Array) May 11, 2023
@kevingurney
Copy link
Member

take

kou pushed a commit that referenced this issue May 22, 2023
…8Array`, `Int16Array`, `Int32Array`, `Int64Array`) (#35561)

### Rationale for this change

Followup to #35495 in which we added the MATLAB class `Float32Array`.

This pull request adds support for round tripping signed integer between `arrow.array.<Array>` classes and associated MATLAB types (e.g. `int8`, `int16`, `int32`, `int64`).

| Arrow Array Type | MATLAB Type |
| ------------------------- | -------------------- |
| `Int8Array`             | `int8`                |
| `Int16Array`             | `int16`                |
| `Int32Array`             | `int32`                |
| `Int64Array`             | `int64`                |

Example of round-tripping `int8` data:

```matlab
>> int8MatlabArray = int8([1, 2, 3]')

int8MatlabArray =

  3x1 int8 column vector

   1
   2
   3

>> int8ArrowArray = arrow.array.Int8Array(int8MatlabArray) 

int8ArrowArray = 

[
  1,
  2,
  3
]

>> int8MatlabArrayRoundTripped = toMATLAB(int8ArrowArray)

int8MatlabArrayRoundTripped =

  3x1 int8 column vector

   1
   2
   3

>> all(int8MatlabArray == int8MatlabArrayRoundTripped)

ans =

  logical

   1

```

### What changes are included in this PR?

Added four new signed integer type `arrow.array.<Array>` concrete subclasses.

1.  `arrow.array.Int8Array`
3. `arrow.array.Int16Array`
4. `arrow.array.Int32Array` 
5. `arrow.array.Int64Array` 

### Are these changes tested?

Yes, we added the following four test classes:

1.  `tInt8Array.m`
2. `tInt16Array.m`
3. `tInt32Array.m`
4. `tInt64Array.m`

### Are there any user-facing changes?

Yes. This change introduces 4 new publicly documented classes:

1.  `arrow.array.Int8Array`
3. `arrow.array.Int16Array`
4. `arrow.array.Int32Array` 
5. `arrow.array.Int64Array` 

### Future Directions

1. Add support for null values (i.e. validity bitmap) for the signed integer array types.

### Notes

!. Thank you to @ sgilmore10 for her help with this pull request!
* Closes: #35558

Lead-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
@kou kou added this to the 13.0.0 milestone May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment