sgilmore10 opened a new pull request, #37256:
URL: https://github.com/apache/arrow/pull/37256
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's
Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing
Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor
PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes).
Could you open an issue for this pull request on GitHub?
https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the
[Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.)
of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
The original motivation for adding the super-class `arrow.type.TemporalType`
in #37236 was to define a common implementation for extracting the `Unit`
property from `TimestampType`, `Time32Type`, `Time64Type`, `Date32Type`, and
`Date64Type`. However, this approach doesn't work because the `Unit` property
on `Date32Type` and `Date64Type` is a `DateUnit`, while the `Unit` property on
the other three types is a`TimeUnit`. As a result, we cannot define a shared
method for extracting the `Unit` property in `TemporalType`.
Instead, we plan on making `arrow.type.TemporalType` a "tag"-class (i.e. it
has no properties or methods) so it can be used to group the "temporal" types
together to ease authoring conditional logical in client code. In a future PR,
we plan on adding functions like `arrow.type.isTemporal`,
`arrow.type.isNumeric`, etc. so that clients don't need to query the class type
information directly (i.e. call `isa(type, "arrow.type.TemporalType")`).
```matlab
function doStuff(arrowArray)
import arrow.*
arrowType = arrowArray.Type;
if type.isTemporal(arrowType)
...
else if type.isNumeric(arrowType)
...
else
...
end
end
```
### What changes are included in this PR?
1. Removed the `TimeUnit` property from `arrow.type.TemporalType`
2. Added `TimeUnit` back as a property on `arrow.type.TimestampType` and
`arrow.type.Time32Type`
### Are these changes tested?
Yes, the existing tests cover these changes.
### Are there any user-facing changes?
No.
### Future Directions
1. #37232
2. #37229
3. #37230
--
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]