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] Implement the isequal() method on arrow.array.Array #37391

Closed
sgilmore10 opened this issue Aug 25, 2023 · 1 comment · Fixed by #37446
Closed

[MATLAB] Implement the isequal() method on arrow.array.Array #37391

sgilmore10 opened this issue Aug 25, 2023 · 1 comment · Fixed by #37446

Comments

@sgilmore10
Copy link
Member

Describe the enhancement requested

Currently, it's not possible to determine if two arrow.array.Array instances are equal because the isequal() method always returns false by default:

Example

>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   0

Component(s)

MATLAB

@sgilmore10
Copy link
Member Author

take

kevingurney pushed a commit that referenced this issue Aug 30, 2023
…rray` (#37446)

### Rationale for this change

Currently, it's not possible to determine if two `arrow.array.Array` instances are equal because the `isequal()` method always returns `false` by default:

**Example**
 
```matlab
>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   0
````

### What changes are included in this PR?

1. Defined an `isequal()` overload on the `arrow.array.Array` super-class.
2. Added a new method called `isEqual()` on the `arrow::matlab::array::proxy::Array` class. 

Two arrays are considered equal in the MATLAB Interface if the following conditions are met:

 1. They have the same type
 2. They have the same length
 3. The same elements are valid
 4. Corresponding valid elements are equal.

**NOTE:** NaN values are not considered equal.

**Example**

```matlab
>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   1

```

### Are these changes tested?

Yes. Added positive and negative `isequal` tests for all concrete subclasses of `arrow.array.Array`.

### Are there any user-facing changes?

Yes. Users can now use `isequal()` with `arrow.array.Array` subclasses.

### Future Directions

1. Implement [`isequaln`](https://www.mathworks.com/help/matlab/ref/isequaln.html) so that users can test array equality with NaNs being treated as equal. 
* Closes: #37391

Authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
@kevingurney kevingurney added this to the 14.0.0 milestone Aug 30, 2023
loicalleyne pushed a commit to loicalleyne/arrow that referenced this issue Nov 13, 2023
…rray.Array` (apache#37446)

### Rationale for this change

Currently, it's not possible to determine if two `arrow.array.Array` instances are equal because the `isequal()` method always returns `false` by default:

**Example**
 
```matlab
>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   0
````

### What changes are included in this PR?

1. Defined an `isequal()` overload on the `arrow.array.Array` super-class.
2. Added a new method called `isEqual()` on the `arrow::matlab::array::proxy::Array` class. 

Two arrays are considered equal in the MATLAB Interface if the following conditions are met:

 1. They have the same type
 2. They have the same length
 3. The same elements are valid
 4. Corresponding valid elements are equal.

**NOTE:** NaN values are not considered equal.

**Example**

```matlab
>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   1

```

### Are these changes tested?

Yes. Added positive and negative `isequal` tests for all concrete subclasses of `arrow.array.Array`.

### Are there any user-facing changes?

Yes. Users can now use `isequal()` with `arrow.array.Array` subclasses.

### Future Directions

1. Implement [`isequaln`](https://www.mathworks.com/help/matlab/ref/isequaln.html) so that users can test array equality with NaNs being treated as equal. 
* Closes: apache#37391

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
…rray.Array` (apache#37446)

### Rationale for this change

Currently, it's not possible to determine if two `arrow.array.Array` instances are equal because the `isequal()` method always returns `false` by default:

**Example**
 
```matlab
>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   0
````

### What changes are included in this PR?

1. Defined an `isequal()` overload on the `arrow.array.Array` super-class.
2. Added a new method called `isEqual()` on the `arrow::matlab::array::proxy::Array` class. 

Two arrays are considered equal in the MATLAB Interface if the following conditions are met:

 1. They have the same type
 2. They have the same length
 3. The same elements are valid
 4. Corresponding valid elements are equal.

**NOTE:** NaN values are not considered equal.

**Example**

```matlab
>> a = arrow.array([1 2 3])

a = 

[
  1,
  2,
  3
]

% Compare a with itself. 
>> tf = isequal(a, a)

tf =

  logical

   1

```

### Are these changes tested?

Yes. Added positive and negative `isequal` tests for all concrete subclasses of `arrow.array.Array`.

### Are there any user-facing changes?

Yes. Users can now use `isequal()` with `arrow.array.Array` subclasses.

### Future Directions

1. Implement [`isequaln`](https://www.mathworks.com/help/matlab/ref/isequaln.html) so that users can test array equality with NaNs being treated as equal. 
* Closes: apache#37391

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
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants