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 2023/08/04 15:27:05 UTC
[GitHub] [arrow] sgilmore10 opened a new pull request, #37025: [GH-36984]: [MATLAB] Create `arrow.recordbatch` convenience constructor function
sgilmore10 opened a new pull request, #37025:
URL: https://github.com/apache/arrow/pull/37025
### Rationale for this change
For parity with how `arrow.array.Array` objects are constructed, we should create a construction function called `arrow.recordbatch()` for `arrow.tabular.RecordBatch`:
```matlab
>> t = table(["A"; "B"; "C"], [1; 2; 3])
t =
3×2 table
Var1 Var2
____ ____
"A" 1
"B" 2
"C" 3
>> rb = arrow.recordbatch(t)
rb =
Var1: [
"A",
"B",
"C"
]
Var2: [
1,
2,
3
]
>> class(rb)
ans =
'arrow.tabular.RecordBatch'
```
The `arrow.tabular.RecordBatch` constructor will accept a scalar `libmexclass.proxy.Proxy` object instead of a MATLAB `table`.
### What changes are included in this PR?
1. Added the convenience constructor function `arrow.recordbatch()`. I accepts a `table` as input.
2. Modified `arrow.tabular.RecordBatch`'s constructor to expect a scalar `libmexclass.proxy.Proxy` object as input instead of a `table`.
### Are these changes tested?
Yes, updated the test cases in `tRecordBatch.m` to use the new convenience constructor `arrow.recordbatch()` .
### Are there any user-facing changes?
Yes, users will now have to use `arrow.recordbatch()` when constructing a record batch from a MATLAB `table` instead of `arrow.tabular.RecordBatch`'s constructor.
--
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
[GitHub] [arrow] kevingurney merged pull request #37025: GH-36984: [MATLAB] Create `arrow.recordbatch` convenience constructor function
Posted by "kevingurney (via GitHub)" <gi...@apache.org>.
kevingurney merged PR #37025:
URL: https://github.com/apache/arrow/pull/37025
--
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
[GitHub] [arrow] github-actions[bot] commented on pull request #37025: [GH-36984]: [MATLAB] Create `arrow.recordbatch` convenience constructor function
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37025:
URL: https://github.com/apache/arrow/pull/37025#issuecomment-1665788809
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
See also:
* [Other pull requests](https://github.com/apache/arrow/pulls/)
* [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches)
--
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
[GitHub] [arrow] kevingurney commented on pull request #37025: GH-36984: [MATLAB] Create `arrow.recordbatch` convenience constructor function
Posted by "kevingurney (via GitHub)" <gi...@apache.org>.
kevingurney commented on PR #37025:
URL: https://github.com/apache/arrow/pull/37025#issuecomment-1666058709
+1
--
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
[GitHub] [arrow] conbench-apache-arrow[bot] commented on pull request #37025: GH-36984: [MATLAB] Create `arrow.recordbatch` convenience constructor function
Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #37025:
URL: https://github.com/apache/arrow/pull/37025#issuecomment-1671748573
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 19d0daf40c2db5164a6bfefc91019253d8db7157.
There were no benchmark performance regressions. 🎉
The [full Conbench report](https://github.com/apache/arrow/runs/15755170081) has more details. It also includes information about 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
[GitHub] [arrow] sgilmore10 commented on a diff in pull request #37025: GH-36984: [MATLAB] Create `arrow.recordbatch` convenience constructor function
Posted by "sgilmore10 (via GitHub)" <gi...@apache.org>.
sgilmore10 commented on code in PR #37025:
URL: https://github.com/apache/arrow/pull/37025#discussion_r1284753871
##########
matlab/src/matlab/+arrow/recordbatch.m:
##########
@@ -0,0 +1,57 @@
+%RECORDBATCH Creates an arrow.tabular.RecordBatch from a table.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements. See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License. You may obtain a copy of the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied. See the License for the specific language governing
+% permissions and limitations under the License.
+function rb = recordbatch(T)
+ arguments
+ T table
+ end
+
+ arrowArrays = decompose(T);
+ arrayProxyIDs = getArrowProxyIDs(arrowArrays);
+
+ columnNames = string(T.Properties.VariableNames);
+ args = struct(ArrayProxyIDs=arrayProxyIDs, ColumnNames=columnNames);
+ proxyName = "arrow.tabular.proxy.RecordBatch";
+ proxy = arrow.internal.proxy.create(proxyName, args);
+
+ rb = arrow.tabular.RecordBatch(proxy);
+end
+
+function arrowArrays = decompose(T)
Review Comment:
Good point.
--
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
[GitHub] [arrow] kevingurney commented on a diff in pull request #37025: GH-36984: [MATLAB] Create `arrow.recordbatch` convenience constructor function
Posted by "kevingurney (via GitHub)" <gi...@apache.org>.
kevingurney commented on code in PR #37025:
URL: https://github.com/apache/arrow/pull/37025#discussion_r1284743727
##########
matlab/src/matlab/+arrow/recordbatch.m:
##########
@@ -0,0 +1,57 @@
+%RECORDBATCH Creates an arrow.tabular.RecordBatch from a table.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements. See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License. You may obtain a copy of the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied. See the License for the specific language governing
+% permissions and limitations under the License.
+function rb = recordbatch(T)
+ arguments
+ T table
+ end
+
+ arrowArrays = decompose(T);
+ arrayProxyIDs = getArrowProxyIDs(arrowArrays);
+
+ columnNames = string(T.Properties.VariableNames);
+ args = struct(ArrayProxyIDs=arrayProxyIDs, ColumnNames=columnNames);
+ proxyName = "arrow.tabular.proxy.RecordBatch";
+ proxy = arrow.internal.proxy.create(proxyName, args);
+
+ rb = arrow.tabular.RecordBatch(proxy);
+end
+
+function arrowArrays = decompose(T)
+% Decompose the input MATLAB table input a cell array of
+% equivalent arrow.array.Array instances.
+
+ numColumns = width(T);
+ arrowArrays = cell(1, numColumns);
+
+ % Convert each MATLAB array into a corresponding
+ % arrow.array.Array.
+ for ii = 1:numColumns
+ arrowArrays{ii} = arrow.array(T{:, ii});
+ end
+end
+
+function proxyIDs = getArrowProxyIDs(arrowArrays)
Review Comment:
Can we name this `getArrowArrayProxyIDs`?
##########
matlab/src/matlab/+arrow/recordbatch.m:
##########
@@ -0,0 +1,57 @@
+%RECORDBATCH Creates an arrow.tabular.RecordBatch from a table.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements. See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License. You may obtain a copy of the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied. See the License for the specific language governing
+% permissions and limitations under the License.
+function rb = recordbatch(T)
+ arguments
+ T table
+ end
+
+ arrowArrays = decompose(T);
+ arrayProxyIDs = getArrowProxyIDs(arrowArrays);
+
+ columnNames = string(T.Properties.VariableNames);
+ args = struct(ArrayProxyIDs=arrayProxyIDs, ColumnNames=columnNames);
+ proxyName = "arrow.tabular.proxy.RecordBatch";
+ proxy = arrow.internal.proxy.create(proxyName, args);
+
+ rb = arrow.tabular.RecordBatch(proxy);
+end
+
+function arrowArrays = decompose(T)
+% Decompose the input MATLAB table input a cell array of
+% equivalent arrow.array.Array instances.
+
+ numColumns = width(T);
+ arrowArrays = cell(1, numColumns);
+
+ % Convert each MATLAB array into a corresponding
+ % arrow.array.Array.
+ for ii = 1:numColumns
+ arrowArrays{ii} = arrow.array(T{:, ii});
+ end
+end
+
+function proxyIDs = getArrowProxyIDs(arrowArrays)
Review Comment:
Actually, it probably makes sense to not include `Arrow` in the name since that part is probably implied.
##########
matlab/src/matlab/+arrow/recordbatch.m:
##########
@@ -0,0 +1,57 @@
+%RECORDBATCH Creates an arrow.tabular.RecordBatch from a table.
+
+% Licensed to the Apache Software Foundation (ASF) under one or more
+% contributor license agreements. See the NOTICE file distributed with
+% this work for additional information regarding copyright ownership.
+% The ASF licenses this file to you under the Apache License, Version
+% 2.0 (the "License"); you may not use this file except in compliance
+% with the License. You may obtain a copy of the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+% implied. See the License for the specific language governing
+% permissions and limitations under the License.
+function rb = recordbatch(T)
+ arguments
+ T table
+ end
+
+ arrowArrays = decompose(T);
+ arrayProxyIDs = getArrowProxyIDs(arrowArrays);
+
+ columnNames = string(T.Properties.VariableNames);
+ args = struct(ArrayProxyIDs=arrayProxyIDs, ColumnNames=columnNames);
+ proxyName = "arrow.tabular.proxy.RecordBatch";
+ proxy = arrow.internal.proxy.create(proxyName, args);
+
+ rb = arrow.tabular.RecordBatch(proxy);
+end
+
+function arrowArrays = decompose(T)
Review Comment:
Maybe we can move `decompose` and `getArrowProxyIds` into a package `arrow.tabular.internal` to keep this file a bit smaller?
--
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