AVRO-2123: Java duration logical type#2520
Merged
opwvhk merged 5 commits intoapache:masterfrom Oct 5, 2023
Merged
Conversation
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.
lang/java/avro/src/main/java/org/apache/avro/util/TimePeriod.java
Outdated
Show resolved
Hide resolved
4 tasks
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.
Contributor
Author
|
Thank you for pointing this out, @GFriedrich! I've opened a new PR (#3416) to address this. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 bothjava.time.Periodandjava.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.TimePeriodTestorg.apache.avro.TestLogicalType#durationExtendsFixed12org.apache.avro.generic.TestGenericLogicalTypes#readWriteDurationorg.apache.avro.TestLogicalType#uuidExtendsString(boyscout refactoring)Documentation
yes/ no)docs / JavaDocs / not documented)