Skip to content

Commit 0c49503

Browse files
authored
GH-48755: [MATLAB] Rename getArrayProxyIDs to getProxyIDs (#48756)
### Rationale for this change The internal helper function `getArrayProxyIDs` was misleadingly named since it works with both Arrays and RecordBatches, not just arrays. ### What changes are included in this PR? - Renamed `getArrayProxyIDs.m` to `getProxyIDs.m` - Updated all call sites - Removed TODO comment requesting this change ### Are these changes tested? Existing tests cover functionality. ### Are there any user-facing changes? No, dev-only. * GitHub Issue: #48755 Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 81e4046 commit 0c49503

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

matlab/src/matlab/+arrow/+array/+internal/getArrayProxyIDs.m renamed to matlab/src/matlab/+arrow/+array/+internal/getProxyIDs.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
%GETARRAYPROXYIDS Extract the Proxy IDs underlying a cell array of
2-
% arrow.array.Array instances.
1+
%GETPROXYIDS Extract the Proxy IDs underlying a cell array of
2+
% arrow.array.Array or arrow.tabular.RecordBatch instances.
33

44
% Licensed to the Apache Software Foundation (ASF) under one or more
55
% contributor license agreements. See the NOTICE file distributed with
@@ -15,12 +15,12 @@
1515
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1616
% implied. See the License for the specific language governing
1717
% permissions and limitations under the License.
18-
function proxyIDs = getArrayProxyIDs(arrowArrays)
19-
proxyIDs = zeros(1, numel(arrowArrays), "uint64");
18+
function proxyIDs = getProxyIDs(objects)
19+
proxyIDs = zeros(1, numel(objects), "uint64");
2020

21-
% Convert each MATLAB array into a corresponding
22-
% arrow.array.Array.
23-
for ii = 1:numel(arrowArrays)
24-
proxyIDs(ii) = arrowArrays{ii}.Proxy.ID;
21+
% Extract the Proxy.ID from each object
22+
for ii = 1:numel(objects)
23+
proxyIDs(ii) = objects{ii}.Proxy.ID;
2524
end
26-
end
25+
end
26+

matlab/src/matlab/+arrow/+array/ChunkedArray.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
type = arrays{1}.Type;
122122
end
123123

124-
proxyIDs = arrow.array.internal.getArrayProxyIDs(arrays);
124+
proxyIDs = arrow.array.internal.getProxyIDs(arrays);
125125
args = struct(ArrayProxyIDs=proxyIDs, TypeProxyID=type.Proxy.ID);
126126
proxyName = "arrow.array.proxy.ChunkedArray";
127127
proxy = arrow.internal.proxy.create(proxyName, args);

matlab/src/matlab/+arrow/+array/StructArray.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123

124124
import arrow.tabular.internal.validateArrayLengths
125125
import arrow.tabular.internal.validateColumnNames
126-
import arrow.array.internal.getArrayProxyIDs
126+
import arrow.array.internal.getProxyIDs
127127
import arrow.internal.validate.parseValid
128128

129129
if numel(arrowArrays) == 0
@@ -135,7 +135,7 @@
135135
validateColumnNames(opts.FieldNames, numel(arrowArrays));
136136
validElements = parseValid(opts, arrowArrays{1}.NumElements);
137137

138-
arrayProxyIDs = getArrayProxyIDs(arrowArrays);
138+
arrayProxyIDs = getProxyIDs(arrowArrays);
139139
args = struct(ArrayProxyIDs=arrayProxyIDs, ...
140140
FieldNames=opts.FieldNames, Valid=validElements);
141141
proxyName = "arrow.array.proxy.StructArray";
@@ -152,7 +152,7 @@
152152

153153
import arrow.tabular.internal.decompose
154154
import arrow.tabular.internal.validateColumnNames
155-
import arrow.array.internal.getArrayProxyIDs
155+
import arrow.array.internal.getProxyIDs
156156
import arrow.internal.validate.parseValid
157157

158158
if width(T) == 0
@@ -166,7 +166,7 @@
166166
validateColumnNames(opts.FieldNames, width(T));
167167

168168
arrowArrays = decompose(T);
169-
arrayProxyIDs = getArrayProxyIDs(arrowArrays);
169+
arrayProxyIDs = getProxyIDs(arrowArrays);
170170
validElements = parseValid(opts, height(T));
171171

172172
args = struct(ArrayProxyIDs=arrayProxyIDs, ...

matlab/src/matlab/+arrow/+tabular/RecordBatch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ function export(obj, cArrowArrayAddress, cArrowSchemaAddress)
6565

6666
import arrow.tabular.internal.validateArrayLengths
6767
import arrow.tabular.internal.validateColumnNames
68-
import arrow.array.internal.getArrayProxyIDs
68+
import arrow.array.internal.getProxyIDs
6969

7070
numColumns = numel(arrowArrays);
7171
validateArrayLengths(arrowArrays);
7272
validateColumnNames(opts.ColumnNames, numColumns);
7373

74-
arrayProxyIDs = getArrayProxyIDs(arrowArrays);
74+
arrayProxyIDs = getProxyIDs(arrowArrays);
7575
args = struct(ArrayProxyIDs=arrayProxyIDs, ColumnNames=opts.ColumnNames);
7676
proxyName = "arrow.tabular.proxy.RecordBatch";
7777
proxy = arrow.internal.proxy.create(proxyName, args);

matlab/src/matlab/+arrow/+tabular/Table.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747

4848
import arrow.tabular.internal.validateArrayLengths
4949
import arrow.tabular.internal.validateColumnNames
50-
import arrow.array.internal.getArrayProxyIDs
50+
import arrow.array.internal.getProxyIDs
5151

5252
numColumns = numel(arrowArrays);
5353
validateArrayLengths(arrowArrays);
5454
validateColumnNames(opts.ColumnNames, numColumns);
5555

56-
arrayProxyIDs = getArrayProxyIDs(arrowArrays);
56+
arrayProxyIDs = getProxyIDs(arrowArrays);
5757
args = struct(Method="from_arrays", ArrayProxyIDs=arrayProxyIDs, ColumnNames=opts.ColumnNames);
5858
proxyName = "arrow.tabular.proxy.Table";
5959
proxy = arrow.internal.proxy.create(proxyName, args);
@@ -83,8 +83,7 @@
8383
end
8484
end
8585

86-
% TODO: Rename getArrayProxyIDs to getProxyIDs
87-
proxyIDs = arrow.array.internal.getArrayProxyIDs(batches);
86+
proxyIDs = arrow.array.internal.getProxyIDs(batches);
8887
args = struct(Method="from_record_batches", RecordBatchProxyIDs=proxyIDs);
8988
proxyName = "arrow.tabular.proxy.Table";
9089
proxy = arrow.internal.proxy.create(proxyName, args);

matlab/src/matlab/+arrow/recordBatch.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
end
2121

2222
arrowArrays = arrow.tabular.internal.decompose(T);
23-
arrayProxyIDs = arrow.array.internal.getArrayProxyIDs(arrowArrays);
23+
arrayProxyIDs = arrow.array.internal.getProxyIDs(arrowArrays);
2424

2525
columnNames = string(T.Properties.VariableNames);
2626
args = struct(ArrayProxyIDs=arrayProxyIDs, ColumnNames=columnNames);

0 commit comments

Comments
 (0)