Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-2123: Java duration logical type #2520

Merged
merged 5 commits into from
Oct 5, 2023

Conversation

opwvhk
Copy link
Contributor

@opwvhk opwvhk commented Sep 25, 2023

What is the purpose of the change

Add logical type and conversion for "Duration", in the context of AVRO-2123

This is an alternative implementation for PR #1263.

Core in this change is a new implementation of java.time.TemporalAmount, which combines functionality of both java.time.Period and java.time.Duration. This is needed to cleanly implement the logical type.

Verifying this change

This change adds tests for all changed functionality:

  • org.apache.avro.util.TimePeriodTest
  • org.apache.avro.TestLogicalType#durationExtendsFixed12
  • org.apache.avro.generic.TestGenericLogicalTypes#readWriteDuration
  • org.apache.avro.TestLogicalType#uuidExtendsString (boyscout refactoring)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

This adds a new `java.time.TemporalAmount` implementation, which
supports the Avro `duration` logical type (neither `java.time.Period`
nor `java.time.Duration` support it).
Also refactors logical type "uuid" to include validation.
@github-actions github-actions bot added the Java Pull Requests for Java binding label Sep 25, 2023
Copy link
Contributor

@clesaec clesaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@opwvhk opwvhk merged commit abe6d42 into apache:master Oct 5, 2023
13 checks passed
@opwvhk opwvhk deleted the AVRO-2123-Java-duration-logical-type branch October 5, 2023 08:38
RanbirK pushed a commit to RanbirK/avro that referenced this pull request May 13, 2024
This adds a new `java.time.TemporalAmount` implementation, which
supports the Avro `duration` logical type (neither `java.time.Period`
nor `java.time.Duration` support it).

This type is then used in the conversion for the (new) logical type
implementation "duration".

Last, the logical type "uuid" is refactored to include validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Pull Requests for Java binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants