Skip to content

GH-37151: [MATLAB] Use makeValidVariableNames and makeValidDimensionNames in implementation of table method for RecordBatch - #37152

Merged
kevingurney merged 1 commit into
apache:mainfrom
mathworks:GH-37151
Aug 14, 2023
Merged

kevingurney merged 1 commit into
apache:mainfrom
mathworks:GH-37151

Conversation

@kevingurney

@kevingurney kevingurney commented Aug 14, 2023 •

Copy link
Copy Markdown
Member

Rationale for this change

#37098 added utilities for making valid MATLAB table VariableNames (makeValidVariableNames) and DimensionNames (makeValidDimensionNames) from an arbitrary list of strings.

This pull request uses these utilities to ensure that RecordBatch field names are converted to valid MATLAB table VariableNames/DimensionNames when calling the table/toMATLAB methods.

What changes are included in this PR?

  1. Used makeValidVariableNames and makeValidDimensionNames utilities in the implementation of the table method for the RecordBatch class to ensure that column names are converted to valid MATLAB table VariableNames/DimensionNames.

Are these changes tested?

Yes.

  1. The existing tests in arrow/matlab/test/arrow/tabular/tMakeValidVariableNames.m and arrow/matlab/test/arrow/tabular/tMakeValidDimensionNames.m already test that an arbitrary list of column names are converted into valid MATLAB table VariableNames/DimensionNames.
  2. There is currently no straightforward way to create a RecordBatch with field names that are invalid MATLAB VariableNames/DimensionNames using the MATLAB interface. When we have a way to do this in the MATLAB interface, we can add more "integration" tests which verify that a RecordBatch with field names that are invalid MATLAB table VariableNames/DimensionNames are converted into valid VariableNames/DimensionNames when the table/toMATLAB methods are called.

Are there any user-facing changes?

Yes.

A RecordBatch with field names that are invalid MATLAB table VariableNames/DimensionNames will now be converted into a MATLAB table with valid VariableNames/DimensionNames when calling the table/toMATLAB methods.

Future Directions

  1. [MATLAB] Implement featherread in terms of arrow.internal.io.feather.Reader #37046 (this change to the table method of the RecordBatch class should help preserve the behavior of storing original RecordBatch field names in the VariableDescriptions property of the output MATLAB table returned by featherread).

implementation of `table` method for `RecordBatch`.

@sgilmore10 sgilmore10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for integrating these changes!

@kevingurney

Copy link
Copy Markdown
Member Author

+1

@kevingurney
kevingurney merged commit b05190e into apache:main Aug 14, 2023
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit b05190e.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them.

@kevingurney
kevingurney deleted the GH-37151 branch August 21, 2023 18:13
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…imensionNames` in implementation of `table` method for `RecordBatch` (apache#37152)

### Rationale for this change

apache#37098 added utilities for making valid MATLAB `table` `VariableNames` (`makeValidVariableNames`) and `DimensionNames` (`makeValidDimensionNames`) from an arbitrary list of strings.

This pull request uses these utilities to ensure that `RecordBatch` field names are converted to valid MATLAB `table` `VariableNames`/`DimensionNames` when calling the `table`/`toMATLAB` methods.

### What changes are included in this PR?

1. Used `makeValidVariableNames` and `makeValidDimensionNames` utilities in the implementation of the `table` method for the `RecordBatch` class to ensure that column names are converted to valid MATLAB `table` `VariableNames`/`DimensionNames`.

### Are these changes tested?

Yes.

1. The existing tests in `arrow/matlab/test/arrow/tabular/tMakeValidVariableNames.m` and `arrow/matlab/test/arrow/tabular/tMakeValidDimensionNames.m` already test that an arbitrary list of column names are converted into valid MATLAB `table` `VariableNames`/`DimensionNames`.
2. There is currently no straightforward way to create a `RecordBatch` with field names that are invalid MATLAB `VariableNames`/`DimensionNames` using the MATLAB interface. When we have a way to do this in the MATLAB interface, we can add more "integration" tests which verify that a `RecordBatch` with field names that are invalid MATLAB `table` `VariableNames`/`DimensionNames` are converted into valid `VariableNames`/`DimensionNames` when the `table`/`toMATLAB` methods are called.

### Are there any user-facing changes?

Yes.

A `RecordBatch` with field names that are invalid MATLAB `table` `VariableNames`/`DimensionNames` will now be converted into a MATLAB `table` with valid `VariableNames`/`DimensionNames` when calling the `table`/`toMATLAB` methods.

### Future Directions

1. apache#37046 (this change to the `table` method of the `RecordBatch` class should help preserve the behavior of storing original `RecordBatch` field names in the `VariableDescriptions` property of the output MATLAB `table` returned by `featherread`).
* Closes: apache#37151

Authored-by: Kevin Gurney <kgurney@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

Development

Successfully merging this pull request may close these issues.

[MATLAB] Use makeValidVariableNames and makeValidDimensionNames in implementation of table method for RecordBatch

2 participants