You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "sgilmore10 (via GitHub)" <gi...@apache.org> on 2024/05/24 18:04:08 UTC

[PR] GH-41803: [MATLAB] Add C Data Interface format import/export functionality for `arrow.tabular.RecordBatch` [arrow]

sgilmore10 opened a new pull request, #41817:
URL: https://github.com/apache/arrow/pull/41817

   ### Rationale for this change
   
   This pull requests adds two new APIs for importing and exporting `arrow.tabular.RecordBatch` instances using the C Data Interface format.
   
   **Example:**
   ```matlab
   >> T = table((1:3)', ["A"; "B"; "C"]);
   >> expected = arrow.recordBatch(T)
   
   expected = 
   
     Arrow RecordBatch with 3 rows and 2 columns:
   
       Schema:
   
           Var1: Float64 | Var2: String
   
       First Row:
   
           1 | "A"
   
   >> cArray = arrow.c.Array();
   >> cSchema = arrow.c.Schema();
   
   % Export the RecordBatch to C Data Interface Format
   >> expected.export(cArray.Address, cSchema.Address);
   
   % Import the RecordBatch from C Data Interface Format
   >> actual = arrow.tabular.RecordBatch.import(cArray, cSchema)
   
   actual = 
   
     Arrow RecordBatch with 3 rows and 2 columns:
   
       Schema:
   
           Var1: Float64 | Var2: String
   
       First Row:
   
           1 | "A"
   
   % The RecordBatch is the same after round-tripping to the C Data Interface format
   >> isequal(actual, expected)
   
   ans =
   
     logical
   
      1
   
   ```
   ### What changes are included in this PR?
   
   1. Added a new method `arrow.tabular.RecordBatch.export` for exporting `RecordBatch` objects to the C Data Interface format.
   2. Added a new static method `arrow.tabular.RecordBatch.import` for importing `RecordBatch` objects from the C Data Interface format.
   3. Added a new internal class `arrow.c.internal.RecordBatchImporter` for importing `RecordBatch` objects from the C Data Interface format.
   
   ### Are these changes tested?
   
   Yes.
   
   1. Added a new test file `matlab/test/arrow/c/tRoundtripRecordBatch.m` which has basic round-trip tests for importing and exporting `RecordBatch` objects.
   
   ### Are there any user-facing changes?
   
   Yes.
   
   1. Two new user-facing methods were added to `arrow.tabular.RecordBatch`. The first is `arrow.tabular.RecordBatch.export(cArrowArrayAddress, cArrowSchemaAddress)`. The second is `arrow.tabular.RecordBatch.import(cArray, cSchema)`. These APIs can be used to export/import `RecordBatch` objects using the C Data Interface format.
   
   
   ### Future Directions
   
   1. Add integration tests for sharing data between MATLAB/mlarrow and Python/pyarrow running in the same process using the [MATLAB interface to Python](https://www.mathworks.com/help/matlab/call-python-libraries.html).
   2. Add support for the Arrow [C stream interface format](https://arrow.apache.org/docs/format/CStreamInterface.html).
   
   ### Notes
   
   1. Thanks to @kevingurney for the help with this feature! 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41803: [MATLAB] Add C Data Interface format import/export functionality for `arrow.tabular.RecordBatch` [arrow]

Posted by "sgilmore10 (via GitHub)" <gi...@apache.org>.
sgilmore10 merged PR #41817:
URL: https://github.com/apache/arrow/pull/41817


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41803: [MATLAB] Add C Data Interface format import/export functionality for `arrow.tabular.RecordBatch` [arrow]

Posted by "sgilmore10 (via GitHub)" <gi...@apache.org>.
sgilmore10 commented on PR #41817:
URL: https://github.com/apache/arrow/pull/41817#issuecomment-2135228035

   > +1
   > 
   > We need `RecordBatchImporter` because we can't define custom constructor (something like `static libmexclass::proxyMakeResult arrow::matlab::tabular::proxy::RecordBatch::import(....)`), right?
   
   Yes, that's correct. @kevingurney and I have talked about extending `mathworks/libmexclass` to support either static proxy methods or free-floating functions at some point. We just haven't been able to get around to adding that functionality yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41803: [MATLAB] Add C Data Interface format import/export functionality for `arrow.tabular.RecordBatch` [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #41817:
URL: https://github.com/apache/arrow/pull/41817#issuecomment-2151026391

   After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit fe2d926ef385be58833f0e5e09d1860c63f800e6.
   
   There were no benchmark performance regressions. 🎉
   
   The [full Conbench report](https://github.com/apache/arrow/runs/25864602062) has more details. It also includes information about 13 possible false positives for unstable benchmarks that are known to sometimes produce them.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org