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] Rename Length property on arrow.array.Array and arrow.array.ChunkedArray to NumElements #38164

Closed
sgilmore10 opened this issue Oct 9, 2023 · 1 comment · Fixed by #38190

Comments

@sgilmore10
Copy link
Member

sgilmore10 commented Oct 9, 2023

Describe the enhancement requested

We would like to rename the Length property of arrow.array.Array to NumElements because MATLAB has a function called length(A), which returns the length of the largest array dimension in A.
Because arrow.array.Array inherits from matlab.mixin.Scalar, it's size is always 1x1, so the length() function always returns 1. This may confuse users because the Length property of arrow.array.Array returns the number of elements within the array, which may not be 1.

>>  array = arrow.array([1 2 3 4 5]);

% The length property returns the number of elements in the array
>> array.Length

ans =

  int64

   5

% The length method returns the length of the largest dimension
>> length(array)

ans =

     1

I suspect this inconsistency will confuse users, so we should rename the Length property to NumElements.

Component(s)

MATLAB

@sgilmore10
Copy link
Member Author

take

@sgilmore10 sgilmore10 changed the title [MATLAB] Rename arrow.array.Array Length property to NumElements [MATLAB] Rename Length property on arrow.array.Array and arrow.array.ChunkedArray to NumElements Oct 10, 2023
kevingurney pushed a commit that referenced this issue Oct 11, 2023
…d `arrow.array.ChunkedArray` to `NumElements` (#38190)

### Rationale for this change

We would like to rename the `Length` property on `arrow.array.Array` (and `arrow.array.ChunkedArray`) to `NumElements` because MATLAB has a function called `length(A)`, which returns the length of the largest array dimension in `A`.  
Because `arrow.array.Array` inherits from `matlab.mixin.Scalar`, it's size is always `1x1`, so the `length()` function always returns `1`. This may confuse users because the `Length` property of `arrow.array.Array` returns the number of elements within the array, which may not be `1`. 

```matlab
>> array = arrow.array([1 2 3 4 5]);

% The length property returns the number of elements in the array
>> array.Length

ans =

  int64

   5

% The length method returns the length of the largest dimension
>> length(array)

ans =

     1
```

I suspect this inconsistency will confuse users, so we should rename the `Length` property to `NumElements`. 

### What changes are included in this PR?

1. Renamed `Length` property on `arrow.array.Array` to `NumElements`
2. Renamed `Length` property on `arrow.array.ChunkedArray` to `NumElements`

### Are these changes tested?

Yes. I modified the existing `Length` test cases to now test the `NumElements` property.

### Are there any user-facing changes?

Yes. Please note this is a breaking change because `Length` is no longer a property on either `arrow.array.Array` or `arrow.array.ChunkedArray`. However, we have not yet cut an initial release of the MATLAB interface, so we don't expect this change should affect too many users at this point. 

* Closes: #38164

Authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
@kevingurney kevingurney added this to the 15.0.0 milestone Oct 11, 2023
JerAguilon pushed a commit to JerAguilon/arrow that referenced this issue Oct 23, 2023
…ay` and `arrow.array.ChunkedArray` to `NumElements` (apache#38190)

### Rationale for this change

We would like to rename the `Length` property on `arrow.array.Array` (and `arrow.array.ChunkedArray`) to `NumElements` because MATLAB has a function called `length(A)`, which returns the length of the largest array dimension in `A`.  
Because `arrow.array.Array` inherits from `matlab.mixin.Scalar`, it's size is always `1x1`, so the `length()` function always returns `1`. This may confuse users because the `Length` property of `arrow.array.Array` returns the number of elements within the array, which may not be `1`. 

```matlab
>> array = arrow.array([1 2 3 4 5]);

% The length property returns the number of elements in the array
>> array.Length

ans =

  int64

   5

% The length method returns the length of the largest dimension
>> length(array)

ans =

     1
```

I suspect this inconsistency will confuse users, so we should rename the `Length` property to `NumElements`. 

### What changes are included in this PR?

1. Renamed `Length` property on `arrow.array.Array` to `NumElements`
2. Renamed `Length` property on `arrow.array.ChunkedArray` to `NumElements`

### Are these changes tested?

Yes. I modified the existing `Length` test cases to now test the `NumElements` property.

### Are there any user-facing changes?

Yes. Please note this is a breaking change because `Length` is no longer a property on either `arrow.array.Array` or `arrow.array.ChunkedArray`. However, we have not yet cut an initial release of the MATLAB interface, so we don't expect this change should affect too many users at this point. 

* Closes: apache#38164

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 issue Nov 13, 2023
…ay` and `arrow.array.ChunkedArray` to `NumElements` (apache#38190)

### Rationale for this change

We would like to rename the `Length` property on `arrow.array.Array` (and `arrow.array.ChunkedArray`) to `NumElements` because MATLAB has a function called `length(A)`, which returns the length of the largest array dimension in `A`.  
Because `arrow.array.Array` inherits from `matlab.mixin.Scalar`, it's size is always `1x1`, so the `length()` function always returns `1`. This may confuse users because the `Length` property of `arrow.array.Array` returns the number of elements within the array, which may not be `1`. 

```matlab
>> array = arrow.array([1 2 3 4 5]);

% The length property returns the number of elements in the array
>> array.Length

ans =

  int64

   5

% The length method returns the length of the largest dimension
>> length(array)

ans =

     1
```

I suspect this inconsistency will confuse users, so we should rename the `Length` property to `NumElements`. 

### What changes are included in this PR?

1. Renamed `Length` property on `arrow.array.Array` to `NumElements`
2. Renamed `Length` property on `arrow.array.ChunkedArray` to `NumElements`

### Are these changes tested?

Yes. I modified the existing `Length` test cases to now test the `NumElements` property.

### Are there any user-facing changes?

Yes. Please note this is a breaking change because `Length` is no longer a property on either `arrow.array.Array` or `arrow.array.ChunkedArray`. However, we have not yet cut an initial release of the MATLAB interface, so we don't expect this change should affect too many users at this point. 

* Closes: apache#38164

Authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…ay` and `arrow.array.ChunkedArray` to `NumElements` (apache#38190)

### Rationale for this change

We would like to rename the `Length` property on `arrow.array.Array` (and `arrow.array.ChunkedArray`) to `NumElements` because MATLAB has a function called `length(A)`, which returns the length of the largest array dimension in `A`.  
Because `arrow.array.Array` inherits from `matlab.mixin.Scalar`, it's size is always `1x1`, so the `length()` function always returns `1`. This may confuse users because the `Length` property of `arrow.array.Array` returns the number of elements within the array, which may not be `1`. 

```matlab
>> array = arrow.array([1 2 3 4 5]);

% The length property returns the number of elements in the array
>> array.Length

ans =

  int64

   5

% The length method returns the length of the largest dimension
>> length(array)

ans =

     1
```

I suspect this inconsistency will confuse users, so we should rename the `Length` property to `NumElements`. 

### What changes are included in this PR?

1. Renamed `Length` property on `arrow.array.Array` to `NumElements`
2. Renamed `Length` property on `arrow.array.ChunkedArray` to `NumElements`

### Are these changes tested?

Yes. I modified the existing `Length` test cases to now test the `NumElements` property.

### Are there any user-facing changes?

Yes. Please note this is a breaking change because `Length` is no longer a property on either `arrow.array.Array` or `arrow.array.ChunkedArray`. However, we have not yet cut an initial release of the MATLAB interface, so we don't expect this change should affect too many users at this point. 

* Closes: apache#38164

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