You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2024/01/22 09:54:12 UTC
[PR] Enhance Date64 type documentation [arrow-rs]
Jefffrey opened a new pull request, #5323:
URL: https://github.com/apache/arrow-rs/pull/5323
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #5288
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Update docs of Date64 to hopefully clear up any confusion on its details.
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enhance Date64 type documentation [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #5323:
URL: https://github.com/apache/arrow-rs/pull/5323#discussion_r1461698330
##########
arrow-schema/src/datatype.rs:
##########
@@ -145,10 +145,30 @@ pub enum DataType {
/// ```
Timestamp(TimeUnit, Option<Arc<str>>),
/// A signed 32-bit date representing the elapsed time since UNIX epoch (1970-01-01)
- /// in days (32 bits).
+ /// in days.
Date32,
/// A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01)
- /// in milliseconds (64 bits). Values are evenly divisible by 86400000.
+ /// in milliseconds.
+ ///
+ /// According to the specification (see [Schema.fbs]), this should be treated as the number of
+ /// days, in milliseconds, since the UNIX epoch. Therefore, values must be evenly divisible by
+ /// `86_400_000` (the number of milliseconds in a standard day).
+ ///
+ /// The reason for this is historically for compatibility with other languages native libraries,
Review Comment:
```suggestion
/// The reason for this is for compatibility with other language's native libraries,
```
##########
arrow-schema/src/datatype.rs:
##########
@@ -145,10 +145,30 @@ pub enum DataType {
/// ```
Timestamp(TimeUnit, Option<Arc<str>>),
/// A signed 32-bit date representing the elapsed time since UNIX epoch (1970-01-01)
- /// in days (32 bits).
+ /// in days.
Date32,
/// A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01)
- /// in milliseconds (64 bits). Values are evenly divisible by 86400000.
+ /// in milliseconds.
+ ///
+ /// According to the specification (see [Schema.fbs]), this should be treated as the number of
+ /// days, in milliseconds, since the UNIX epoch. Therefore, values must be evenly divisible by
+ /// `86_400_000` (the number of milliseconds in a standard day).
+ ///
+ /// The reason for this is historically for compatibility with other languages native libraries,
+ /// such as Java when it used to store dates as timestamps.
Review Comment:
```suggestion
/// such as Java, which historically lacked a dedicated date type
/// and only supported timestamps.
```
##########
arrow-schema/src/datatype.rs:
##########
@@ -145,10 +145,30 @@ pub enum DataType {
/// ```
Timestamp(TimeUnit, Option<Arc<str>>),
/// A signed 32-bit date representing the elapsed time since UNIX epoch (1970-01-01)
- /// in days (32 bits).
+ /// in days.
Date32,
/// A signed 64-bit date representing the elapsed time since UNIX epoch (1970-01-01)
- /// in milliseconds (64 bits). Values are evenly divisible by 86400000.
+ /// in milliseconds.
+ ///
+ /// According to the specification (see [Schema.fbs]), this should be treated as the number of
+ /// days, in milliseconds, since the UNIX epoch. Therefore, values must be evenly divisible by
+ /// `86_400_000` (the number of milliseconds in a standard day).
+ ///
+ /// The reason for this is historically for compatibility with other languages native libraries,
+ /// such as Java when it used to store dates as timestamps.
+ ///
+ /// Practically, validation that values of this type are evenly divisible by `86_400_000` is not enforced
+ /// by this library for performance and usability reasons. Date64 values will be treated similar to the
Review Comment:
```suggestion
/// by this library for performance and usability reasons. Date64 values will be treated similarly to the
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enhance Date64 type documentation [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #5323:
URL: https://github.com/apache/arrow-rs/pull/5323#issuecomment-1903629995
I think doc update is sufficient to close the issue, can add in optional validation later if there is a use case for it
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Enhance Date64 type documentation [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #5323:
URL: https://github.com/apache/arrow-rs/pull/5323
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org