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.type.Type #37472

Closed
sgilmore10 opened this issue Aug 30, 2023 · 1 comment · Fixed by #37474
Closed

[MATLAB] Implement the isequal() method on arrow.type.Type #37472

sgilmore10 opened this issue Aug 30, 2023 · 1 comment · Fixed by #37474

Comments

@sgilmore10
Copy link
Member

Describe the enhancement requested

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

>> t = arrow.int32()

t = 

  Int32Type with properties:

    ID: Int32

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

tf =

  logical

   0

Component(s)

MATLAB

@sgilmore10
Copy link
Member Author

take

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

### Rationale for this change

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

```matlab

>> t = arrow.int32()

t = 

  Int32Type with properties:

    ID: Int32

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

tf =

  logical

   0

```

### What changes are included in this PR?

1. Implemented the `isequal` method on all concrete subclasses of `arrow.type.Type` 
2. Added a new method called `isEqual()` on the `arrow::matlab::type::proxy::Type` class.

**Example Usage**

```matlab
>> t1 = arrow.timestamp(TimeUnit="Second");
>> t2 = arrow.timestamp(TimeUnit="Microsecond");
>> t3 = arrow.timestamp(TimeUnit="Second");

% Compare t1 and t2
>> tf1 = isequal(t1, t2)

tf1 =

  logical

   0

% Compare t1 and t3
>> tf2 = isequal(t1, t3)

tf2 =

  logical

   1
```

### Are these changes tested?

Yes. Added test cases verifying `isequal` behaves as expected for all concrete subclasses of `arrow.type.Type`.

### Are there any user-facing changes?

Yes. Users can now use the `isequal` method to compare `arrow.type.Type` instances for equality.

### Future Directions

1. Implement the `isequal` method for `arrow.type.Field`
2. Implement the `isequal` method for `arrow.tabular.Schema` 

* Closes: #37472

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
…ype.Type` (apache#37474)

### Rationale for this change

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

```matlab

>> t = arrow.int32()

t = 

  Int32Type with properties:

    ID: Int32

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

tf =

  logical

   0

```

### What changes are included in this PR?

1. Implemented the `isequal` method on all concrete subclasses of `arrow.type.Type` 
2. Added a new method called `isEqual()` on the `arrow::matlab::type::proxy::Type` class.

**Example Usage**

```matlab
>> t1 = arrow.timestamp(TimeUnit="Second");
>> t2 = arrow.timestamp(TimeUnit="Microsecond");
>> t3 = arrow.timestamp(TimeUnit="Second");

% Compare t1 and t2
>> tf1 = isequal(t1, t2)

tf1 =

  logical

   0

% Compare t1 and t3
>> tf2 = isequal(t1, t3)

tf2 =

  logical

   1
```

### Are these changes tested?

Yes. Added test cases verifying `isequal` behaves as expected for all concrete subclasses of `arrow.type.Type`.

### Are there any user-facing changes?

Yes. Users can now use the `isequal` method to compare `arrow.type.Type` instances for equality.

### Future Directions

1. Implement the `isequal` method for `arrow.type.Field`
2. Implement the `isequal` method for `arrow.tabular.Schema` 

* Closes: apache#37472

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
…ype.Type` (apache#37474)

### Rationale for this change

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

```matlab

>> t = arrow.int32()

t = 

  Int32Type with properties:

    ID: Int32

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

tf =

  logical

   0

```

### What changes are included in this PR?

1. Implemented the `isequal` method on all concrete subclasses of `arrow.type.Type` 
2. Added a new method called `isEqual()` on the `arrow::matlab::type::proxy::Type` class.

**Example Usage**

```matlab
>> t1 = arrow.timestamp(TimeUnit="Second");
>> t2 = arrow.timestamp(TimeUnit="Microsecond");
>> t3 = arrow.timestamp(TimeUnit="Second");

% Compare t1 and t2
>> tf1 = isequal(t1, t2)

tf1 =

  logical

   0

% Compare t1 and t3
>> tf2 = isequal(t1, t3)

tf2 =

  logical

   1
```

### Are these changes tested?

Yes. Added test cases verifying `isequal` behaves as expected for all concrete subclasses of `arrow.type.Type`.

### Are there any user-facing changes?

Yes. Users can now use the `isequal` method to compare `arrow.type.Type` instances for equality.

### Future Directions

1. Implement the `isequal` method for `arrow.type.Field`
2. Implement the `isequal` method for `arrow.tabular.Schema` 

* Closes: apache#37472

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