I have a simple POJO with dates, that will be stored as Avro in storage before imported into Google BigQuery. Dates are converted to long, and I'm trying to use @AvroSchema to override the schema generation for the date fields so that BigQuery understands which type the fields are.
The simple POJO:
public class SomeAvroMessage implements Serializable {
@AvroSchema("{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}")
private long tm;
@AvroSchema("{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}")
private long created;
public SomeAvroMessage() {
}
}
This ends up with the following AVRO-schema:
{"type":"record","name":"SomeAvroMessage",
"namespace":"some.namespace",
"fields":[
{"name":"tm","type":{"type":"long","logicalType":"timestamp-millis"}},
{"name":"created","type":{"type":"long","logicalType":"timestamp-millis"}}
]}
These seems to be wrong, and should be simply {"name":"tm","type":"long","logicalType":"timestamp-millis"}
This is used in Google Dataflow, with Apache Beam 2.22 written in Java.
Am I missing something?