-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
…#37236) ### Rationale for this change To simplify the implementation of `Time32Type`, `Time64Type`, `Date32Type`, and `Date64Type`, it would be helpful to create an abstract `arrow.type.TemporalType` class that the date and time types can inherit from. As a first step, we can modify the implementation of `TimestampType` to inherit from `TemporalType`. This mimics the class inheritance hierarchy from the C++ libraries. ### What changes are included in this PR? 1. Added a new MATLAB class called `arrow.type.TemporalType`. It inherits from `arrow.type.FixedWidthType` and defines one read-only property: `TimeUnit`. 2. Modified the MATLAB class `arrow.type.TimestampType` to inherit from `arrow.type.TemporalType` instead of `arrow.type.FixedWidthType`. 3. Renamed the C++ `proxy::TimestampType` methods `timeUnit()` and `timeZone()` to `getTimeUnit()` and `getTimeZone()`. ### Are these changes tested? Yes. The existing tests in `tTimetampType.m` cover these changes. ### Are there any user-facing changes? No. ### Future Directions 1. Add `arrow.type.Time32Type` (#37231) 2. Add `arrow.type.Time64Type` (#37225) 3. Add `arrow.type.Date32Type` (#37229), 4. Add `arrow.type.Time64Type` (#37230). 5. Add `arrow.array.Time32Array` 6. Add `arrow.array.Time64Array` 7. Add `arrow.array.Date32Array` 8. Add `arrow.array.Date64Array` * Closes: #37234 Lead-authored-by: Sarah Gilmore <[email protected]> Co-authored-by: Kevin Gurney <[email protected]> Signed-off-by: Kevin Gurney <[email protected]>
- Loading branch information
1 parent
9fea4ee
commit 5abdc6e
Showing
4 changed files
with
47 additions
and
16 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
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,37 @@ | ||
%TEMPORALTYPE Parent class of all temporal types. | ||
|
||
% 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 TemporalType < arrow.type.FixedWidthType | ||
|
||
properties(Dependent, GetAccess=public, SetAccess=private) | ||
TimeUnit | ||
end | ||
|
||
methods | ||
function obj = TemporalType(proxy) | ||
arguments | ||
proxy(1, 1) libmexclass.proxy.Proxy | ||
end | ||
[email protected](proxy); | ||
end | ||
|
||
function timeUnit = get.TimeUnit(obj) | ||
timeUnitValue = obj.Proxy.getTimeUnit(); | ||
timeUnit = arrow.type.TimeUnit(timeUnitValue); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,11 @@ | |
% implied. See the License for the specific language governing | ||
% permissions and limitations under the License. | ||
|
||
classdef TimestampType < arrow.type.FixedWidthType | ||
classdef TimestampType < arrow.type.TemporalType | ||
%TIMESTAMPTYPE Type class for timestamp data. | ||
|
||
properties(Dependent, SetAccess=private, GetAccess=public) | ||
properties(Dependent, GetAccess=public, SetAccess=private) | ||
TimeZone | ||
TimeUnit | ||
end | ||
|
||
methods | ||
|
@@ -27,16 +26,11 @@ | |
proxy(1, 1) libmexclass.proxy.Proxy {validate(proxy, "arrow.type.proxy.TimestampType")} | ||
end | ||
import arrow.internal.proxy.validate | ||
[email protected](proxy); | ||
end | ||
|
||
function unit = get.TimeUnit(obj) | ||
val = obj.Proxy.timeUnit(); | ||
unit = arrow.type.TimeUnit(val); | ||
[email protected](proxy); | ||
end | ||
|
||
function tz = get.TimeZone(obj) | ||
tz = obj.Proxy.timeZone(); | ||
tz = obj.Proxy.getTimeZone(); | ||
end | ||
end | ||
|
||
|