0

I have an Avro schema with this property:

{"name": "whenDate", "type": ["date", "null"]}

I am using a Python client and the producer

confluent_kafka.avro.AvroProducer

When I load the Avro schema with aforementioned property, I trigger this error:

not a valid Avro schema: Type property "[u'date', u'null']" not a valid 
Avro schema: Union item must be a valid Avro schema: Could not make an Avro Schema object from date.

I presume this error speaks to limitations in the Confluent parser for Avro schema. That is, date is a logical type specified here, but it not as yet supported by the Confluent parser.

Can anyone confirm? More generally, should I assume that the Confluent parser does not handle the logical types for Avro schema? Thanks.

Kode Charlie
  • 1,297
  • 16
  • 32

1 Answers1

1

It is a logical type, I think you just need to declare it as a one.

{"name": "date", "type": "int", "logicalType": "date"}
JSteward
  • 6,833
  • 2
  • 21
  • 30
  • I'm going to credit your answer, but it's not completely correct, as the Avro specification lists the "date" logical type as an annotation for the "int" type. Can you change the "long" to "int" in your response? Thx. – Kode Charlie May 03 '17 at 00:17
  • @KodeCharlie Done. – JSteward May 03 '17 at 14:20