You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/09/22 14:05:00 UTC

[jira] [Commented] (AVRO-2079) Add ability to use Java 8 date/time types instead of Joda time.

    [ https://issues.apache.org/jira/browse/AVRO-2079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16176469#comment-16176469 ] 

ASF GitHub Bot commented on AVRO-2079:
--------------------------------------

GitHub user aukevanleeuwen opened a pull request:

    https://github.com/apache/avro/pull/248

    AVRO-2079: Add ability to generate Java8 native date/time classes

    Some remarks:
    * I've added the type (either Joda or Java8) to the constructor of the `SpecificCompiler`. This mainly because it affects the state of the compiler (i.e. it would add/remove converters based on this attribute) and I would rather not do this in a setter. 
    * I have renamed the original class `TimeConversions` to `JodaTimeConversions` for clarity, but it clutters the changeset a bit. I can revert that If needed.
    * I've generated `lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithJava8LogicalTypes.java` with the new compiler switch `-dateTimeLogicalType java8` and created tests for compatibility witgh the already existing generated classes based on the Joda time.
    * I'm defaulting to Joda time for compatibility reasons. In both Maven and the command line generation tool you have the ability to override that default.
    
    Let me know if there's something I'm missing or am overlooking functionally.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aukevanleeuwen/avro use-java8-time

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/avro/pull/248.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #248
    
----
commit 78aae1395cc17e47d73f7595611622535ccc90d3
Author: Auke van Leeuwen <av...@schubergphilis.com>
Date:   2017-09-21T08:01:48Z

    AVRO-2079: Add ability to generate Java8 native date/time classes

----


> Add ability to use Java 8 date/time types instead of Joda time.
> ---------------------------------------------------------------
>
>                 Key: AVRO-2079
>                 URL: https://issues.apache.org/jira/browse/AVRO-2079
>             Project: Avro
>          Issue Type: Improvement
>          Components: java, logical types
>    Affects Versions: 1.8.2
>            Reporter: Auke van Leeuwen
>
> Currently, for the date/time related logical types, we are generating Joda date/time objects. Since we've moved to Java-8 (AVRO-2043) it seems logical to also provide the possibility to generate {{java.time.*}} date/time objects instead of the Joda time variants.
> I propose to make this is a switch in {{SpecificCompiler.java}} which will default to Joda (I think), but can be set to generate the Java 8 versions.
> (I'm currently trying to run through the code to see if I can make it work.)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)