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] Template arrow::matlab::proxy::NumericArray on ArrowType instead of CType #36734

Closed
sgilmore10 opened this issue Jul 17, 2023 · 1 comment · Fixed by #36738
Closed

Comments

@sgilmore10
Copy link
Member

Describe the enhancement requested

The C++ proxy class arrow::matlab::array::proxy::NumericArray is templated on CType, e.g. int32_t. We should instead template on ArrowType. This would allow us to use this class to implement the proxies for TimestampArray, Time64Array, Time32Array, Date64Array and Date32Array as well as the numeric types. We would have to specialize the make method for TimestampArray, Time64Array, and Time32Array, but we would not need to specialize any other methods.

Component(s)

MATLAB

@sgilmore10
Copy link
Member Author

take

kevingurney pushed a commit that referenced this issue Jul 18, 2023
…owType instead of CType (#36738)

### Rationale for this change

We decided to change the template parameter on `arrow::matlab::proxy::NumericArray` to `ArrowType` from `CType` to avoid writing duplicate code. If `proxy::NumericArray` is templated on `ArrowType`, we can use it to implement the proxies for `Date64Array`, `Date32Array`, `Time32Array`, `Time64Array`, and `TimestampArray`. This will help us avoid duplicating code. 

### What changes are included in this PR?

1. Changed the template on `proxy::NumericArray` from `CType` to `ArrowType`
2. Re-implemented the C++ proxy object used for `TimestampArray` in terms of `proxy::NumericArray<arrow::TimestampType>`
3. Defined a template specialization for `NumericArray::make` when the template parameter is `arrow::TimestampType`
4. Defined a `proxy::Traits` `struct` that is templated on `ArrowType`. Specializations of  `Traits` define a`TypeProxy` typedef that can be used at compile-time to get the proxy class that is used to wrap an `ArrowType`.

### Are these changes tested?

Existing tests used.

### Are there any user-facing changes?

No.

* Closes: #36734

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 Jul 18, 2023
chelseajonesr pushed a commit to chelseajonesr/arrow that referenced this issue Jul 20, 2023
…on ArrowType instead of CType (apache#36738)

### Rationale for this change

We decided to change the template parameter on `arrow::matlab::proxy::NumericArray` to `ArrowType` from `CType` to avoid writing duplicate code. If `proxy::NumericArray` is templated on `ArrowType`, we can use it to implement the proxies for `Date64Array`, `Date32Array`, `Time32Array`, `Time64Array`, and `TimestampArray`. This will help us avoid duplicating code. 

### What changes are included in this PR?

1. Changed the template on `proxy::NumericArray` from `CType` to `ArrowType`
2. Re-implemented the C++ proxy object used for `TimestampArray` in terms of `proxy::NumericArray<arrow::TimestampType>`
3. Defined a template specialization for `NumericArray::make` when the template parameter is `arrow::TimestampType`
4. Defined a `proxy::Traits` `struct` that is templated on `ArrowType`. Specializations of  `Traits` define a`TypeProxy` typedef that can be used at compile-time to get the proxy class that is used to wrap an `ArrowType`.

### Are these changes tested?

Existing tests used.

### Are there any user-facing changes?

No.

* Closes: apache#36734

Authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Kevin Gurney <kgurney@mathworks.com>
R-JunmingChen pushed a commit to R-JunmingChen/arrow that referenced this issue Aug 20, 2023
…on ArrowType instead of CType (apache#36738)

### Rationale for this change

We decided to change the template parameter on `arrow::matlab::proxy::NumericArray` to `ArrowType` from `CType` to avoid writing duplicate code. If `proxy::NumericArray` is templated on `ArrowType`, we can use it to implement the proxies for `Date64Array`, `Date32Array`, `Time32Array`, `Time64Array`, and `TimestampArray`. This will help us avoid duplicating code. 

### What changes are included in this PR?

1. Changed the template on `proxy::NumericArray` from `CType` to `ArrowType`
2. Re-implemented the C++ proxy object used for `TimestampArray` in terms of `proxy::NumericArray<arrow::TimestampType>`
3. Defined a template specialization for `NumericArray::make` when the template parameter is `arrow::TimestampType`
4. Defined a `proxy::Traits` `struct` that is templated on `ArrowType`. Specializations of  `Traits` define a`TypeProxy` typedef that can be used at compile-time to get the proxy class that is used to wrap an `ArrowType`.

### Are these changes tested?

Existing tests used.

### Are there any user-facing changes?

No.

* Closes: apache#36734

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
None yet
2 participants