congbobo184 edited a comment on issue #5112: How to Date type -> AVRO -> Presto
URL: https://github.com/apache/pulsar/issues/5112#issuecomment-529901574
 
 
   @KannarFr First, AvroSchema only support org.joda.time. The second, you 
should use Avro logicalType like 
   ```    
       @Data
       private static class SchemaLogicalType{
           @org.apache.avro.reflect.AvroSchema("{\n" +
                   "  \"type\": \"bytes\",\n" +
                   "  \"logicalType\": \"decimal\",\n" +
                   "  \"precision\": 4,\n" +
                   "  \"scale\": 2\n" +
                   "}")
           BigDecimal decimal;
           
@org.apache.avro.reflect.AvroSchema("{\"type\":\"int\",\"logicalType\":\"date\"}")
           LocalDate date;
           
@org.apache.avro.reflect.AvroSchema("{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}")
           DateTime timestampMillis;
           
@org.apache.avro.reflect.AvroSchema("{\"type\":\"int\",\"logicalType\":\"time-millis\"}")
           LocalTime timeMillis;
           
@org.apache.avro.reflect.AvroSchema("{\"type\":\"long\",\"logicalType\":\"timestamp-micros\"}")
           long timestampMicros;
           
@org.apache.avro.reflect.AvroSchema("{\"type\":\"long\",\"logicalType\":\"time-micros\"}")
           long timeMicros;
       }
   ``` 
   in your class

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to