Skip to content

Commit

Permalink
1. Set ListTraits properties that are not yet implemented to `missi…
Browse files Browse the repository at this point in the history
…ng`.

2. Update `traits.m` to not include case for MATLAB `cell` type.
3. Update `tField.m` to include `arrow.list`.
4. Update `tID.m` to include `arrow.type.ID.List`.
5. Update `tTypeDisplay.m` to include `arrow.type.ListType`.
6. Update `ttraits.m` to include `arrow.type.traits.ListTraits`.
7. Add `tListTraits.m`.
  • Loading branch information
kevingurney committed Oct 10, 2023
1 parent de948bd commit a29e52c
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 4 deletions.
4 changes: 2 additions & 2 deletions matlab/src/matlab/+arrow/+type/+traits/ListTraits.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
TypeConstructor = @arrow.type.ListType
TypeClassName = "arrow.type.ListType"
TypeProxyClassName = "arrow.type.proxy.ListType"
MatlabConstructor = @cell
MatlabClassName = "cell"
MatlabConstructor = missing
MatlabClassName = missing
end

end
2 changes: 0 additions & 2 deletions matlab/src/matlab/+arrow/+type/+traits/traits.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@
typeTraits = TimestampTraits();
case "duration"
typeTraits = Time64Traits();
case "cell"
typeTraits = ListTraits();
case "table"
typeTraits = StructTraits();
otherwise
Expand Down
1 change: 1 addition & 0 deletions matlab/test/arrow/type/tField.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function TestSupportedTypes(testCase)
arrow.float64, ...
arrow.string, ...
arrow.timestamp, ...
arrow.list(arrow.uint64()), ...
arrow.struct(arrow.field("A", arrow.float32()))
};
for ii = 1:numel(supportedTypes)
Expand Down
1 change: 1 addition & 0 deletions matlab/test/arrow/type/tID.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function CastToUInt64(testCase)
ID.Timestamp, 18, ...
ID.Time32, 19, ...
ID.Time64, 20, ...
ID.List, 25, ...
ID.Struct, 26 ...
);

Expand Down
28 changes: 28 additions & 0 deletions matlab/test/arrow/type/tTypeDisplay.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,33 @@ function StructTypeDisplay(testCase)
actualDisplay = evalc('disp(type)');
verify(testCase, actualDisplay, expectedDisplay);
end

function ListTypeDisplay(testCase)
% Verify the display of ListType objects.
%
% Example:
%
% ListType with properties:
%
% ID: Struct
% Type: [1x1 arrow.type.StringType]

import arrow.internal.test.display.verify
import arrow.internal.test.display.makeLinkString
import arrow.internal.test.display.makeDimensionString

type = arrow.list(arrow.string()); %#ok<NASGU>
classnameLink = makeLinkString(FullClassName="arrow.type.ListType", ClassName="ListType", BoldFont=true);
header = " " + classnameLink + " with properties:" + newline;
body = strjust(pad(["ID:"; "Type:"]));
dimensionString = makeDimensionString([1 1]);
typeString = compose("[%s %s]", dimensionString, "arrow.type.StringType");
body = body + " " + ["List"; typeString];
body = " " + body;
footer = string(newline);
expectedDisplay = char(strjoin([header body' footer], newline));
actualDisplay = evalc('disp(type)');
verify(testCase, actualDisplay, expectedDisplay);
end
end
end
31 changes: 31 additions & 0 deletions matlab/test/arrow/type/traits/tListTraits.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
% 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.

classdef tListTraits < hTypeTraits

properties
TraitsConstructor = @arrow.type.traits.ListTraits
ArrayConstructor = missing
ArrayClassName = missing
ArrayProxyClassName = missing
ArrayStaticConstructor = missing
TypeConstructor = @arrow.type.ListType
TypeClassName = "arrow.type.ListType"
TypeProxyClassName = "arrow.type.proxy.ListType"
MatlabConstructor = missing
MatlabClassName = missing
end

end
12 changes: 12 additions & 0 deletions matlab/test/arrow/type/traits/ttraits.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,18 @@ function TestStruct(testCase)
testCase.verifyEqual(actualTraits, expectedTraits);
end

function TestList(testCase)
import arrow.type.traits.*
import arrow.type.*

type = ID.List;
expectedTraits = ListTraits();

actualTraits = traits(type);

testCase.verifyEqual(actualTraits, expectedTraits);
end

function TestMatlabUInt8(testCase)
import arrow.type.traits.*

Expand Down

0 comments on commit a29e52c

Please sign in to comment.