kevingurney commented on code in PR #37474:
URL: https://github.com/apache/arrow/pull/37474#discussion_r1310736367
##########
matlab/test/arrow/type/tTime32Type.m:
##########
@@ -119,6 +119,53 @@ function InvalidProxy(testCase)
testCase.verifyError(@() arrow.type.Time32Type(proxy),
"arrow:proxy:ProxyNameMismatch");
end
+ function IsEqualTrue(testCase)
+ % Verifies isequal method of arrow.type.Int8Type returns true if
+ % these conditions are met:
+ %
+ % 1. All input arguments have a class type arrow.type.Time32Type
+ % 2. All inputs have the same size
+ % 3. The TimeUnit values of elements at corresponding positions in
the arrays are equal
+
+ % Scalar Time32Type arrays
+ time32Type1 = arrow.time32(TimeUnit="Second");
+ time32Type2 = arrow.time32(TimeUnit="Second");
+ time32Type3 = arrow.time32(TimeUnit="Millisecond");
+ time32Type4 = arrow.time32(TimeUnit="Millisecond");
+ testCase.verifyTrue(isequal(time32Type1, time32Type2));
+ testCase.verifyTrue(isequal(time32Type3, time32Type4));
+
+ % Non-scalar Time32Type arrays
+ typeArray1 = [time32Type1 time32Type3];
+ typeArray2 = [time32Type2 time32Type4];
+ testCase.verifyTrue(isequal(typeArray1, typeArray2));
+ end
+
+ function IsEqualFalse(testCase)
+ % Verify isequal returns false when expected.
+ time32Type1 = arrow.time32(TimeUnit="Second");
+ time32Type2 = arrow.time32(TimeUnit="Millisecond");
+ int32Type = arrow.int32();
+ testCase.verifyFalse(isequal(time32Type1, time32Type2));
+ testCase.verifyFalse(isequal(time32Type1, int32Type));
+
+ % arrays have different dimensions
Review Comment:
arrays -> Arrays
##########
matlab/test/arrow/type/tTimestampType.m:
##########
@@ -128,5 +132,67 @@ function Display(testCase)
actualDisplay = evalc('disp(type)');
testCase.verifyEqual(actualDisplay, expectedDisplay);
end
+
+ function IsEqualTrue(testCase, TimeZone)
+ % Verifies isequal method of arrow.type.TimestampType returns
+ % true if these conditions are met:
+ %
+ % 1. All input arguments have a class type arrow.type.TimestampType
+ % 2. All inputs have the same size
+ % 3. The TimeUnit values of elements at corresponding positions in
the arrays are equal
+ % 3. The TimeZone values of elements at corresponding positions in
the arrays are equal
+
+ % Scalar TimestampType arrays
+ time64Type1 = arrow.timestamp(TimeUnit="Second",
TimeZone=TimeZone);
+ time64Type2 = arrow.timestamp(TimeUnit="Second",
TimeZone=TimeZone);
+
+ time64Type3 = arrow.timestamp(TimeUnit="Millisecond",
TimeZone=TimeZone);
+ time64Type4 = arrow.timestamp(TimeUnit="Millisecond",
TimeZone=TimeZone);
+
+ time64Type5 = arrow.timestamp(TimeUnit="Microsecond",
TimeZone=TimeZone);
+ time64Type6 = arrow.timestamp(TimeUnit="Microsecond",
TimeZone=TimeZone);
+
+ time64Type7 = arrow.timestamp(TimeUnit="Nanosecond",
TimeZone=TimeZone);
+ time64Type8 = arrow.timestamp(TimeUnit="Nanosecond",
TimeZone=TimeZone);
+
+ % Scalar TimestampType arrays
+ testCase.verifyTrue(isequal(time64Type1, time64Type2));
+ testCase.verifyTrue(isequal(time64Type3, time64Type4));
+ testCase.verifyTrue(isequal(time64Type5, time64Type6));
+ testCase.verifyTrue(isequal(time64Type7, time64Type8));
+
+ % Non-scalar TimestampType arrays
+ typeArray1 = [time64Type1 time64Type3 time64Type5 time64Type7];
+ typeArray2 = [time64Type2 time64Type4 time64Type6 time64Type8];
+ testCase.verifyTrue(isequal(typeArray1, typeArray2));
+ end
+
+ function IsEqualFalse(testCase)
+ % Verify isequal returns false when expected.
+
+ time64Type1 = arrow.timestamp(TimeUnit="Second");
Review Comment:
time64 -> timestamp
##########
matlab/test/arrow/type/tTime32Type.m:
##########
@@ -119,6 +119,53 @@ function InvalidProxy(testCase)
testCase.verifyError(@() arrow.type.Time32Type(proxy),
"arrow:proxy:ProxyNameMismatch");
end
+ function IsEqualTrue(testCase)
+ % Verifies isequal method of arrow.type.Int8Type returns true if
Review Comment:
arrow.type.Int8Type -> arrow.type.Time32Type
##########
matlab/test/arrow/type/tTimestampType.m:
##########
@@ -128,5 +132,67 @@ function Display(testCase)
actualDisplay = evalc('disp(type)');
testCase.verifyEqual(actualDisplay, expectedDisplay);
end
+
+ function IsEqualTrue(testCase, TimeZone)
+ % Verifies isequal method of arrow.type.TimestampType returns
+ % true if these conditions are met:
+ %
+ % 1. All input arguments have a class type arrow.type.TimestampType
+ % 2. All inputs have the same size
+ % 3. The TimeUnit values of elements at corresponding positions in
the arrays are equal
+ % 3. The TimeZone values of elements at corresponding positions in
the arrays are equal
Review Comment:
3. -> 4.
##########
matlab/test/arrow/type/tTimestampType.m:
##########
@@ -128,5 +132,67 @@ function Display(testCase)
actualDisplay = evalc('disp(type)');
testCase.verifyEqual(actualDisplay, expectedDisplay);
end
+
+ function IsEqualTrue(testCase, TimeZone)
+ % Verifies isequal method of arrow.type.TimestampType returns
+ % true if these conditions are met:
+ %
+ % 1. All input arguments have a class type arrow.type.TimestampType
+ % 2. All inputs have the same size
+ % 3. The TimeUnit values of elements at corresponding positions in
the arrays are equal
+ % 3. The TimeZone values of elements at corresponding positions in
the arrays are equal
+
+ % Scalar TimestampType arrays
+ time64Type1 = arrow.timestamp(TimeUnit="Second",
TimeZone=TimeZone);
+ time64Type2 = arrow.timestamp(TimeUnit="Second",
TimeZone=TimeZone);
+
+ time64Type3 = arrow.timestamp(TimeUnit="Millisecond",
TimeZone=TimeZone);
+ time64Type4 = arrow.timestamp(TimeUnit="Millisecond",
TimeZone=TimeZone);
+
+ time64Type5 = arrow.timestamp(TimeUnit="Microsecond",
TimeZone=TimeZone);
+ time64Type6 = arrow.timestamp(TimeUnit="Microsecond",
TimeZone=TimeZone);
+
+ time64Type7 = arrow.timestamp(TimeUnit="Nanosecond",
TimeZone=TimeZone);
+ time64Type8 = arrow.timestamp(TimeUnit="Nanosecond",
TimeZone=TimeZone);
+
+ % Scalar TimestampType arrays
+ testCase.verifyTrue(isequal(time64Type1, time64Type2));
+ testCase.verifyTrue(isequal(time64Type3, time64Type4));
+ testCase.verifyTrue(isequal(time64Type5, time64Type6));
+ testCase.verifyTrue(isequal(time64Type7, time64Type8));
+
+ % Non-scalar TimestampType arrays
+ typeArray1 = [time64Type1 time64Type3 time64Type5 time64Type7];
+ typeArray2 = [time64Type2 time64Type4 time64Type6 time64Type8];
+ testCase.verifyTrue(isequal(typeArray1, typeArray2));
+ end
+
+ function IsEqualFalse(testCase)
+ % Verify isequal returns false when expected.
+
+ time64Type1 = arrow.timestamp(TimeUnit="Second");
+ time64Type2 = arrow.timestamp(TimeUnit="Millisecond");
+ time64Type3 = arrow.timestamp(TimeUnit="Second",
TimeZone="America/New_York");
+ time64Type4 = arrow.timestamp(TimeUnit="Second",
TimeZone="Pacific/Fiji");
+ time64Type5 = arrow.timestamp(TimeUnit="Millisecond",
TimeZone="America/New_York");
+
+ % TimeUnit values differ
+ testCase.verifyFalse(isequal(time64Type1, time64Type2));
+ testCase.verifyFalse(isequal(time64Type4, time64Type5));
+
+ % TimeZone values differ
Review Comment:
Could you modify this comment to clarify that this is comparing (1)
`TimestampType`s that have different TimeZone values, as well as testing (2)
when some `TimestampType`s are "zoned" and some are "unzoned"?
##########
matlab/test/arrow/type/tTimestampType.m:
##########
@@ -23,6 +23,10 @@
ClassName = "arrow.type.TimestampType"
end
+ properties(TestParameter)
+ TimeZone={'America/Anchorage', ''}
Review Comment:
Could you add a comment here like the following?
"Test against both "Zoned" (i.e. non-empty TimeZone value) and "Unzoned"
(i.e. empty TimeZone value)."
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]