You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Diógenes Oliveira (Jira)" <ji...@apache.org> on 2020/09/20 03:05:00 UTC

[jira] [Updated] (AVRO-2930) Java maven plugin code generator is ignoring the logical type timestamp-millis

     [ https://issues.apache.org/jira/browse/AVRO-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Diógenes Oliveira updated AVRO-2930:
------------------------------------
    Summary: Java maven plugin code generator is ignoring the logical type timestamp-millis  (was: Java maven plugin code generation is ignoring the logical type timestamp-millis)

> Java maven plugin code generator is ignoring the logical type timestamp-millis
> ------------------------------------------------------------------------------
>
>                 Key: AVRO-2930
>                 URL: https://issues.apache.org/jira/browse/AVRO-2930
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.10.0, 1.9.1, 1.9.2
>            Reporter: Diógenes Oliveira
>            Priority: Major
>
> The relevant field in the schema is:
> {code:json}
> {
>   "name": "server_time",
>   "logicalType": "timestamp-millis",
>   "type": "long"
> }
> {code}
> The plugin section in the pom.xml is as follows:
> {code:xml}
> <plugin>
>     <groupId>org.apache.avro</groupId>
>     <artifactId>avro-maven-plugin</artifactId>
>     <version>${avro.version}</version>
>     <executions>
>         <execution>
>             <phase>generate-sources</phase>
>             <goals>
>                 <goal>schema</goal>
>             </goals>
>             <configuration>
>                 <sourceDirectory>${project.basedir}/src/main/resources/avro/</sourceDirectory>
>                 <outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
>                 <stringType>String</stringType>
>             </configuration>
>         </execution>
>     </executions>
> </plugin>
> {code}
> The generated source does seem to recognize the existence of the conversion:
> {code:java}
>   private static SpecificData MODEL$ = new SpecificData();
> static {
>     MODEL$.addLogicalTypeConversion(new org.apache.avro.data.TimeConversions.TimestampMillisConversion());
>   }
> {code}
> But the getters and setters still refer to a Java Long instead of an Instant:
> {code:java}
>   public long getServerTime() {
>     return server_time;
>   }
>   public void setServerTime(long value) {
>     this.server_time = value;
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)