You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "glywk (via GitHub)" <gi...@apache.org> on 2024/08/28 21:40:08 UTC

[PR] [AVRO-4043] Add time-nanos logical type [avro]

glywk opened a new pull request, #3125:
URL: https://github.com/apache/avro/pull/3125

   AVRO-4043
   <!--
   
   *Thank you very much for contributing to Apache Avro - we are happy that you want to help us improve Avro. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Avro a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/AVRO/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "AVRO-XXXX: [component] Title of the pull request", where *AVRO-XXXX* should be replaced by the actual issue number. 
       The *component* is optional, but can help identify the correct reviewers faster: either the language ("java", "python") or subsystem such as "build" or "doc" are good candidates.  
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests. You can [build the entire project](https://github.com/apache/avro/blob/main/BUILD.md) or just the [language-specific SDK](https://avro.apache.org/project/how-to-contribute/#unit-tests).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Every commit message references Jira issues in their subject lines. In addition, commits follow the guidelines from [How to write a good git commit message](https://chris.beams.io/posts/git-commit/)
       1. Subject is separated from body by a blank line
       1. Subject is limited to 50 characters (not including Jira issue reference)
       1. Subject does not end with a period
       1. Subject uses the imperative mood ("add", not "adding")
       1. Body wraps at 72 characters
       1. Body explains "what" and "why", not "how"
   
   -->
   
   ## What is the purpose of the change
   
   This pull request describes the time of day specification with a nano seconds precision as requested in AVRO-4043
   
   
   ## Verifying this change
   
   This change is a specification description.
   
   ## Documentation
   
   - Does this pull request introduce a new feature? (yes)
   - If yes, how is the feature documented? (docs)
   


-- 
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: dev-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2345612129

   > Hi @martin-g, I'll let you discuss among yourselves
   
   There is no such thing! Everything is open at the ASF and should be discussed in the mailing lists where everyone could participate!
   I have no personal interest in this feature, so I won't lead a discussion. If you need it then **you** need to explain why it is useful and and convince others that the specification needs to be updated.


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "glywk (via GitHub)" <gi...@apache.org>.
glywk commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2320992602

   > Changes to the specification should be discussed at [dev@avro.apache.org](mailto:dev@avro.apache.org) first.
   
   Sorry, I ignore this aspect. How to register to [dev@avro.apache.org](mailto:dev@avro.apache.org) to submit this proposal?
   


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "glywk (via GitHub)" <gi...@apache.org>.
glywk commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2323515202

   > Changes to the specification should be discussed at [dev@avro.apache.org](mailto:dev@avro.apache.org) first.
   
   Hi @martin-g, I'll let you discuss among yourselves whether you want all time scales to support nanoseconds or not.
   Time is just a timestamp subset. As request, I have also add timestamp limit for each scale. This PR can help you in your decision.
   
   There is also the `duration` logical type but it involves a breaking change.
   
   Regards


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "glywk (via GitHub)" <gi...@apache.org>.
glywk commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2320997533

   > The consistency is good (minor nitpick: the anchor should no longer have the `_ms` suffix) . Thank you.
   > 
   > However, increasing the granularity of a timestamp a 1000/million-fold also reduces its range by the same factor. As such, I'd like us to document the possible maximum timestamp values as well.
   
   I have kept 'time_ms' link to preserve backward compatibility. But I will remove 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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "glywk (via GitHub)" <gi...@apache.org>.
glywk commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2904191137

   > > > Hi @martin-g, I'll let you discuss among yourselves
   > > 
   > > 
   > > There is no such thing! Everything is open at the ASF and should be discussed in the mailing lists where everyone could participate! I have no personal interest in this feature, so I won't lead a discussion. If you need it then **you** need to explain why it is useful and and convince others that the specification needs to be updated.
   > 
   > Like Martin mentioned, spec changes like this one is better do discuss with the community, not sure if that already happened, but I encourage to do it. Although I don't have a personal interest on this feature either, I think it sounds like a reasonable addition, other file formats like Parquet have nanosecond precision time format.
   
   Thank you for the interest in this proposal. It has been discussed in the following threads:
   
   https://lists.apache.org/thread/z4pprlnltoom19gvm1jd6w5w8sqlodvm
   https://lists.apache.org/thread/11h1wcyr0tx8f3pb7rpc241qh1wrj849
   
   The discussion shows the interest in proposing this evolution, but I do not have the power to decide to add this proposal to the specification.
   Feel free to add a comment in these discussion threads to support this improvement.
   
   King Regards


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2320949294

   Changes to the specification should be discussed at dev@avro.apache.org first.


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2321005551

   > How to register to [dev@avro.apache.org](mailto:dev@avro.apache.org) to submit this proposal?
   
   You can click on "Subscribe to mailing list" at https://lists.apache.org/list.html?dev@avro.apache.org
   Or directly send a dummy email to dev+subscribe@avro.apache.org and then just Reply on the confirmation email.


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "nandorKollar (via GitHub)" <gi...@apache.org>.
nandorKollar commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2899140671

   > > Hi @martin-g, I'll let you discuss among yourselves
   > 
   > There is no such thing! Everything is open at the ASF and should be discussed in the mailing lists where everyone could participate! I have no personal interest in this feature, so I won't lead a discussion. If you need it then **you** need to explain why it is useful and and convince others that the specification needs to be updated.
   
   Like Marin mentioned, spec changes like this one is better do discuss with the community, not sure if that already happened, but I encourage to do it. Although I don't have a personal interest on this feature either, I think it sounds like a reasonable addition, other file formats like Parquet have nanosecond precision time format.


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-2345616700

   I am going to set all of your PRs related to time-nanos to `Draft` state, so they don't get merged accidentally before the discussion.


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [AVRO-4043] Add time-nanos logical type [avro]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #3125:
URL: https://github.com/apache/avro/pull/3125#issuecomment-4757474467

   From the Apache Spark side, +1 on adding a `time-nanos` logical type - this would close a real interoperability gap for us.
   
   Spark is about to support `TIME(p)` for `p` in `[0, 9]` (i.e. up to nanosecond precision), to match its existing nanosecond `TIMESTAMP`/`TIMESTAMP_NTZ` support and to stay ANSI-consistent (ISO/IEC 9075-2 requires the maximum `<time precision>` to equal the maximum `<timestamp precision>`, which Spark already has at 9).
   
   The problem: Avro today has `timestamp-nanos` and `local-timestamp-nanos`, but no nanosecond time-of-day type. The most precise standard option is `time-micros`. That means Spark cannot store `TIME(7)`, `TIME(8)`, or `TIME(9)` values into Avro without truncating them to microseconds - the sub-microsecond digits are lost (or, worse, mislabeled if written as raw nanos under `time-micros`). By contrast, Parquet already offers `TIME(NANOS)`, so Avro ends up strictly lower-fidelity than the equivalent Parquet file for the same column.
   
   Adding `time-nanos` (a `long` of nanoseconds-since-midnight; max time-of-day 86,400,000,000,000 ns fits comfortably in `int64`, as noted in AVRO-4043) would let Spark round-trip `TIME(7-9)` through Avro losslessly and in a way that external readers can interpret correctly.
   
   For reference, the Spark-side tracking is SPARK-57581 (making the Avro TIME encoding unit-correct); the nanosecond precision extension is SPARK-57551. Happy to help validate from the Spark consumer side once a Java implementation lands.
   


-- 
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: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org