Commit a23c2c7
authored
### Rationale for this change
Currently, the `arrow.table` construction function will return an empty `arrow.tabular.Table` if no input arguments are passed to the function. However, `arrow.recordBatch` throws an error in this case. We should consider making `arrow.recordBatch` behave consistently with `arrow.table` in this case.
This should be relatively straightforward to implement. We can just set the input argument `T` to default to `table.empty(0,0)` in the `arguments` block of the `recordBatch` function, in the same way that `arrow.table` does:
https://github.com/apache/arrow/blob/73454b7040fbea3a187c1bfabd7ea02d46ca3c41/matlab/src/matlab/%2Barrow/table.m#L21
### What changes are included in this PR?
Updated the `arrow.recordBatch` function to return an `arrow.tabular.RecordBatch` instance with zero columns and zero rows if called with zero input arguments. Before this change, the `arrow.recordBatch` function would throw an error if called with zero input arguments.
**Example Usage:**
```matlab
>> rb = arrow.recordBatch()
rb =
Arrow RecordBatch with 0 rows and 0 columns
```
### Are these changes tested?
Yes. Added a new test case to `tRecordBatch` called `ConvenienceConstructorZeroArguments`.
### Are there any user-facing changes?
Yes. Users can now call `arrow.recordBatch` with zero input arguments.
* GitHub Issue: #38211
Authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Signed-off-by: Sarah Gilmore <sgilmore@mathworks.com>
1 parent 8b23360 commit a23c2c7
2 files changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
| |||
0 commit comments