You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Skraba (Jira)" <ji...@apache.org> on 2020/09/23 14:39:00 UTC
[jira] [Resolved] (AVRO-2930) avro-maven-plugin doesn't generate
proper accessors for the logical type timestamp-millis
[ https://issues.apache.org/jira/browse/AVRO-2930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ryan Skraba resolved AVRO-2930.
-------------------------------
Resolution: Not A Bug
> avro-maven-plugin doesn't generate proper accessors for 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)