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 unsigned integer array MATLAB classes (i.e. UInt8Array, UInt16Array, UInt32Array, UInt64Array) #35557

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

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
UInt8Array uint8
UInt16Array uint16
UInt32Array uint32
UInt64Array uint64

Component(s)

MATLAB

@sgilmore10 sgilmore10 changed the title [MATLAB] Add unsigned integer array MATLAB classes (i.e. UInt8Array, UInt16Array, 'UInt32Array, UInt64Array`) [MATLAB] Add unsigned integer array MATLAB classes (i.e. UInt8Array, UInt16Array, UInt32Array, UInt64Array) May 11, 2023
@sgilmore10
Copy link
Member Author

take

kou pushed a commit that referenced this issue May 19, 2023
…nt8Array`, `UInt16Array`, `UInt32Array`, `UInt64Array`) (#35562)

### 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.<Type>Array` classes and associated MATLAB types (e.g. `uint8`, `uint16`, `uint32`, `uint64`).

| Arrow Array Type | MATLAB Type |
| ----------------- | -------------- |
| `UInt8Array` | `uint8`|
| `UInt16Array` | `uint16`|
| `UInt32Array` | `uint32`|
| `UInt64Array` | `uint64`|

Example of round-tripping `uint8` data:

```matlab
>> uint8MATLABArray = uint8([1 2 3]')

uint8MATLABArray =

  3×1 uint8 column vector

   1
   2
   3

>> uint8ArrowArray = arrow.array.UInt8Array(uint8MATLABArray)

uint8ArrowArray = 

[
  1,
  2,
  3
]

>> uint8MATLABArrayRoundTripped = toMATLAB(uint8ArrowArray)

uint8MATLABArrayRoundTripped =

  3×1 uint8 column vector

   1
   2
   3

>> all(uint8MATLABArray == uint8MATLABArrayRoundTripped)

ans =

  logical

   1
```

### What changes are included in this PR?
Added four new unsigned integer type `arrow.array.<Array>` concrete subclasses.

1. `arrow.array.UInt8Array`
2. `arrow.array.UInt16Array`
3. `arrow.array.UInt32Array`
4. `arrow.array.UInt64Array`

### Are these changes tested?

Yes, we added the following four test classes:

1. `tUInt8Array.m`
2. `tUInt16Array.m`
3. `tUInt32Array.m`
4. `tUInt64Array.m`

### Are there any user-facing changes?

Yes. This change introduces 4 new publicly documented classes:

1. `arrow.array.UInt8Array`
2. `arrow.array.UInt16Array`
3. `arrow.array.UInt32Array`
4. `arrow.array.UInt64Array`

### Future Directions

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

### NOTES

1. Thank you to @ kevingurney for his help with this PR!
* Closes: #35557

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