-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Rationale for this change In support of adding `arrow.type.Date32Type` and `arrow.type.Date64Type`, this pull request adds a `arrow.type.DateUnit` enumeration class mirroring the `arrow.type.TimeUnit` enumeration class. `arrow.type.DateUnit` will have two values: `Day` and `Millisecond`. ### What changes are included in this PR? 1. Added a new enumeration class `arrow.type.DateUnit` which mirrors the `arrow.type.TimeUnit` enumeration class. **Example**: ```matlab >> day = arrow.type.DateUnit.Day day = DateUnit enumeration Day >> millisecond = arrow.type.DateUnit.Millisecond millisecond = DateUnit enumeration Millisecond ``` ### Are these changes tested? Yes. 1. Added a new test class `tDateUnit` for `arrow.type.DateUnit` tests. 2. Updated code for `tTimeUnit` for consistency with `tDateUnit`. ### Are there any user-facing changes? Yes. 1. There is now a new user-facing `arrow.type.DateUnit` enumeration class. ### Future Directions 1. Add an `arrow.internal.validate.temporal.dateUnit` helper function that mirrors `arrow.internal.validate.temporal.timeUnit`. 2. #37229 3. #37230 * Closes: #37252 Lead-authored-by: Kevin Gurney <[email protected]> Co-authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Kevin Gurney <[email protected]>
- Loading branch information
1 parent
94bd0d2
commit 3262deb
Showing
4 changed files
with
95 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
% Enumeration class representing Date Units. | ||
|
||
% 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 DateUnit < uint8 | ||
|
||
enumeration | ||
Day (0) | ||
Millisecond (1) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
% Tests for the arrow.type.DateUnit enumeration class | ||
|
||
% 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 tDateUnit < matlab.unittest.TestCase | ||
|
||
properties (Constant) | ||
ClassName = "arrow.type.DateUnit"; | ||
EnumerationValues = [ ... | ||
arrow.type.DateUnit.Day; ... | ||
arrow.type.DateUnit.Millisecond ... | ||
]; | ||
end | ||
|
||
methods (Test) | ||
|
||
function SupportedValues(testCase) | ||
% Verify there are two supported DateUnit enumeration values. | ||
|
||
actualEnumerationValues = enumeration(testCase.ClassName); | ||
|
||
testCase.verifyEqual(actualEnumerationValues, testCase.EnumerationValues); | ||
end | ||
|
||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters