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

Ryan Skraba resolved AVRO-2876.
-------------------------------
    Resolution: Duplicate

AVRO-2471 looks like the same problem.  I checked {{avrotools compile}} with 
that fix and your schema and it generates TimestampMicrosConversion.  Thanks 
for the detailed example!

> TimestampMillisConversion added incorrectly to generated java for 
> timestamp-micros logicalType
> ----------------------------------------------------------------------------------------------
>
>                 Key: AVRO-2876
>                 URL: https://issues.apache.org/jira/browse/AVRO-2876
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.9.2
>         Environment: * Apache Avro Version [1.10.0]
>  * Java Version [11]
>            Reporter: Pádraig de Buitléar
>            Priority: Critical
>
> Steps to reproduce :
>  # Using the avro-compiler jar generate code with the following avsc:
>     
> {code:java}
> {
>   "type": "record",
>   "name": "Messages",
>   "namespace": "com.somedomain",
>   "fields": [
>     {
>       "name": "not_optional_micros",
>       "type": {
>         "type": "long",
>         "logicalType": "timestamp-micros"
>       }
>     },
>     {
>       "name": "optional_date_micros",
>       "type": [
>         "null",
>         {
>           "type": "long",
>           "logicalType": "timestamp-micros"
>         }
>       ],
>       "default": null
>     }
>       ]
> }
> {code}
>  
> *Actual results:*
>  In the generated code, the conversion type added to the MODEL$ object 
> incorrect. Timestamp*Millis*Conversion is added instead of 
> *TimestampMicrosConversion*.
>   
> {code:java}
> static {
>     MODEL$.addLogicalTypeConversion(new 
> org.apache.avro.data.TimeConversions.TimestampMillisConversion());
>   }
> {code}
>  
> *Expected results:*
>  Based on the above avsc the following is expected.
>   
> {code:java}
>   static {
>     MODEL$.addLogicalTypeConversion(new 
> org.apache.avro.data.TimeConversions.TimestampMicrosConversion());
>   }
> {code}
>  



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

Reply via email to