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-37812: [MATLAB] Add arrow.type.ListType MATLAB class #38189

Merged
merged 20 commits into from
Oct 11, 2023

Conversation

kevingurney
Copy link
Member

@kevingurney kevingurney commented Oct 10, 2023

Rationale for this change

In support of adding an arrow.array.ListArray MATLAB class, this pull request adds a new arrow.type.ListType MATLAB class.

What changes are included in this PR?

  1. New arrow.list(<type>) MATLAB construction function.
  2. New arrow.list.ListType MATLAB class. ListType has a property named Type which indicates the inner type of the List. Type can be set to any subclass arrow.type.Type (including arrow.type.ListType, to support nested lists).
  3. New arrow.type.ID.List type ID enumeration value.
  4. New arrow.type.traits.ListTraits type traits class. Some of the properties, such as ArrayConstructor and ArrayProxyClassName, are set to missing because they are dependent on adding arrow.array.ListArray first.

Example

% Create a simple List<String> type.
>> stringListType = arrow.list(arrow.string())

stringListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.StringType]

% Create a nested List<List<Boolean>> type.
>> nestedListType = arrow.list(arrow.list(arrow.boolean()))

nestedListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.ListType]

% Extract the first-level, inner type, which is List<Boolean>.
>> innerType = nestedListType.Type

innerType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.BooleanType]

% Extract the second-level, nested inner type, which is Boolean.
>> innerType.Type  

ans = 

  BooleanType with properties:

    ID: Boolean

Are these changes tested?

Yes.

  1. Added tListType.m.
  2. Added tListTraits.m.
  3. Updated tField.m to include arrow.list.
  4. Updated tID.m to include arrow.type.ID.List.
  5. Updated tTypeDisplay.m to include arrow.type.ListType.
  6. Updated ttraits.m to include arrow.type.traits.ListTraits.

Are there any user-facing changes?

Yes.

Client MATLAB code can now creates instances of arrow.type.ListType by using the arrow.list(<type>) construction function.

Future Directions

  1. [MATLAB] Add arrow.array.ListArray MATLAB class #37815

2. Add list_type.cc to CMakeLists.txt sources.
2. Use libmexclass::proxy namespace.
3. Cast to `arrow::ListType`.
2. Add ListTraits.
2. Fix indentation of Struct type case.
…ng`.

2. Update `traits.m` to not include case for MATLAB `cell` type.
3. Update `tField.m` to include `arrow.list`.
4. Update `tID.m` to include `arrow.type.ID.List`.
5. Update `tTypeDisplay.m` to include `arrow.type.ListType`.
6. Update `ttraits.m` to include `arrow.type.traits.ListTraits`.
7. Add `tListTraits.m`.
Copy link
Member

@sgilmore10 sgilmore10 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 adding this! Looks great!

matlab/src/cpp/arrow/matlab/type/proxy/list_type.cc Outdated Show resolved Hide resolved
matlab/src/matlab/+arrow/+type/ID.m Outdated Show resolved Hide resolved
matlab/src/matlab/+arrow/list.m Outdated Show resolved Hide resolved
matlab/test/arrow/type/tListType.m Outdated Show resolved Hide resolved
matlab/test/arrow/type/tListType.m Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Oct 10, 2023
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

matlab/src/cpp/arrow/matlab/type/proxy/list_type.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting merge Awaiting merge awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting merge Awaiting merge labels Oct 11, 2023
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Oct 11, 2023
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Oct 11, 2023
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Oct 11, 2023
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 11, 2023
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Oct 11, 2023
@kevingurney
Copy link
Member Author

+1

@kevingurney kevingurney merged commit 852f09d into apache:main Oct 11, 2023
10 checks passed
@kevingurney kevingurney deleted the GH-37812 branch October 11, 2023 15:33
@kevingurney kevingurney removed the awaiting changes Awaiting changes label Oct 11, 2023
llama90 pushed a commit to llama90/arrow that referenced this pull request Oct 12, 2023
…he#38189)

### Rationale for this change

In support of adding an [`arrow.array.ListArray`](apache#37815) MATLAB class, this pull request adds a new `arrow.type.ListType` MATLAB class.

### What changes are included in this PR?

1. New `arrow.list(<type>)` MATLAB construction function.
2. New `arrow.list.ListType` MATLAB class. `ListType` has a property named `Type` which indicates the inner type of the `List`. `Type` can be set to any subclass `arrow.type.Type` (including `arrow.type.ListType`, to support nested lists).
3. New `arrow.type.ID.List` type ID enumeration value.
4. New `arrow.type.traits.ListTraits` type traits class. Some of the properties, such as `ArrayConstructor` and `ArrayProxyClassName`, are set to `missing` because they are dependent on adding [`arrow.array.ListArray`](apache#37815) first.

**Example**
```matlab
% Create a simple List<String> type.
>> stringListType = arrow.list(arrow.string())

stringListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.StringType]

% Create a nested List<List<Boolean>> type.
>> nestedListType = arrow.list(arrow.list(arrow.boolean()))

nestedListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.ListType]

% Extract the first-level, inner type, which is List<Boolean>.
>> innerType = nestedListType.Type

innerType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.BooleanType]

% Extract the second-level, nested inner type, which is Boolean.
>> innerType.Type  

ans = 

  BooleanType with properties:

    ID: Boolean
```

### Are these changes tested?

Yes.

1. Added `tListType.m`.
2. Added `tListTraits.m`.
3. Updated `tField.m` to include `arrow.list`.
4. Updated `tID.m` to include `arrow.type.ID.List`.
6. Updated `tTypeDisplay.m` to include `arrow.type.ListType`.
7. Updated `ttraits.m` to include `arrow.type.traits.ListTraits`.

### Are there any user-facing changes?

Yes.

Client MATLAB code can now creates instances of `arrow.type.ListType` by using the `arrow.list(<type>)` construction function.

### Future Directions

1. apache#37815
* Closes: apache#37812

Authored-by: Kevin Gurney <[email protected]>
Signed-off-by: Kevin Gurney <[email protected]>
@conbench-apache-arrow
Copy link

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

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

JerAguilon pushed a commit to JerAguilon/arrow that referenced this pull request Oct 23, 2023
…he#38189)

### Rationale for this change

In support of adding an [`arrow.array.ListArray`](apache#37815) MATLAB class, this pull request adds a new `arrow.type.ListType` MATLAB class.

### What changes are included in this PR?

1. New `arrow.list(<type>)` MATLAB construction function.
2. New `arrow.list.ListType` MATLAB class. `ListType` has a property named `Type` which indicates the inner type of the `List`. `Type` can be set to any subclass `arrow.type.Type` (including `arrow.type.ListType`, to support nested lists).
3. New `arrow.type.ID.List` type ID enumeration value.
4. New `arrow.type.traits.ListTraits` type traits class. Some of the properties, such as `ArrayConstructor` and `ArrayProxyClassName`, are set to `missing` because they are dependent on adding [`arrow.array.ListArray`](apache#37815) first.

**Example**
```matlab
% Create a simple List<String> type.
>> stringListType = arrow.list(arrow.string())

stringListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.StringType]

% Create a nested List<List<Boolean>> type.
>> nestedListType = arrow.list(arrow.list(arrow.boolean()))

nestedListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.ListType]

% Extract the first-level, inner type, which is List<Boolean>.
>> innerType = nestedListType.Type

innerType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.BooleanType]

% Extract the second-level, nested inner type, which is Boolean.
>> innerType.Type  

ans = 

  BooleanType with properties:

    ID: Boolean
```

### Are these changes tested?

Yes.

1. Added `tListType.m`.
2. Added `tListTraits.m`.
3. Updated `tField.m` to include `arrow.list`.
4. Updated `tID.m` to include `arrow.type.ID.List`.
6. Updated `tTypeDisplay.m` to include `arrow.type.ListType`.
7. Updated `ttraits.m` to include `arrow.type.traits.ListTraits`.

### Are there any user-facing changes?

Yes.

Client MATLAB code can now creates instances of `arrow.type.ListType` by using the `arrow.list(<type>)` construction function.

### Future Directions

1. apache#37815
* Closes: apache#37812

Authored-by: Kevin Gurney <[email protected]>
Signed-off-by: Kevin Gurney <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…he#38189)

### Rationale for this change

In support of adding an [`arrow.array.ListArray`](apache#37815) MATLAB class, this pull request adds a new `arrow.type.ListType` MATLAB class.

### What changes are included in this PR?

1. New `arrow.list(<type>)` MATLAB construction function.
2. New `arrow.list.ListType` MATLAB class. `ListType` has a property named `Type` which indicates the inner type of the `List`. `Type` can be set to any subclass `arrow.type.Type` (including `arrow.type.ListType`, to support nested lists).
3. New `arrow.type.ID.List` type ID enumeration value.
4. New `arrow.type.traits.ListTraits` type traits class. Some of the properties, such as `ArrayConstructor` and `ArrayProxyClassName`, are set to `missing` because they are dependent on adding [`arrow.array.ListArray`](apache#37815) first.

**Example**
```matlab
% Create a simple List<String> type.
>> stringListType = arrow.list(arrow.string())

stringListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.StringType]

% Create a nested List<List<Boolean>> type.
>> nestedListType = arrow.list(arrow.list(arrow.boolean()))

nestedListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.ListType]

% Extract the first-level, inner type, which is List<Boolean>.
>> innerType = nestedListType.Type

innerType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.BooleanType]

% Extract the second-level, nested inner type, which is Boolean.
>> innerType.Type  

ans = 

  BooleanType with properties:

    ID: Boolean
```

### Are these changes tested?

Yes.

1. Added `tListType.m`.
2. Added `tListTraits.m`.
3. Updated `tField.m` to include `arrow.list`.
4. Updated `tID.m` to include `arrow.type.ID.List`.
6. Updated `tTypeDisplay.m` to include `arrow.type.ListType`.
7. Updated `ttraits.m` to include `arrow.type.traits.ListTraits`.

### Are there any user-facing changes?

Yes.

Client MATLAB code can now creates instances of `arrow.type.ListType` by using the `arrow.list(<type>)` construction function.

### Future Directions

1. apache#37815
* Closes: apache#37812

Authored-by: Kevin Gurney <[email protected]>
Signed-off-by: Kevin Gurney <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…he#38189)

### Rationale for this change

In support of adding an [`arrow.array.ListArray`](apache#37815) MATLAB class, this pull request adds a new `arrow.type.ListType` MATLAB class.

### What changes are included in this PR?

1. New `arrow.list(<type>)` MATLAB construction function.
2. New `arrow.list.ListType` MATLAB class. `ListType` has a property named `Type` which indicates the inner type of the `List`. `Type` can be set to any subclass `arrow.type.Type` (including `arrow.type.ListType`, to support nested lists).
3. New `arrow.type.ID.List` type ID enumeration value.
4. New `arrow.type.traits.ListTraits` type traits class. Some of the properties, such as `ArrayConstructor` and `ArrayProxyClassName`, are set to `missing` because they are dependent on adding [`arrow.array.ListArray`](apache#37815) first.

**Example**
```matlab
% Create a simple List<String> type.
>> stringListType = arrow.list(arrow.string())

stringListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.StringType]

% Create a nested List<List<Boolean>> type.
>> nestedListType = arrow.list(arrow.list(arrow.boolean()))

nestedListType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.ListType]

% Extract the first-level, inner type, which is List<Boolean>.
>> innerType = nestedListType.Type

innerType = 

  ListType with properties:

      ID: List
    Type: [1x1 arrow.type.BooleanType]

% Extract the second-level, nested inner type, which is Boolean.
>> innerType.Type  

ans = 

  BooleanType with properties:

    ID: Boolean
```

### Are these changes tested?

Yes.

1. Added `tListType.m`.
2. Added `tListTraits.m`.
3. Updated `tField.m` to include `arrow.list`.
4. Updated `tID.m` to include `arrow.type.ID.List`.
6. Updated `tTypeDisplay.m` to include `arrow.type.ListType`.
7. Updated `ttraits.m` to include `arrow.type.traits.ListTraits`.

### Are there any user-facing changes?

Yes.

Client MATLAB code can now creates instances of `arrow.type.ListType` by using the `arrow.list(<type>)` construction function.

### Future Directions

1. apache#37815
* Closes: apache#37812

Authored-by: Kevin Gurney <[email protected]>
Signed-off-by: Kevin Gurney <[email protected]>
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.ListType MATLAB class
3 participants