michelin / kstreamplify

Kstreamplify is a Java library that brings new features on top of Kafka Streams.
Apache License 2.0
98 stars 17 forks source link

Cannot parse a date / time field in JsonToAvroConverter #148

Closed sipetit closed 7 months ago

sipetit commented 10 months ago

Describe the bug

The JsonToAvroConverter Java utility class is currently unable to parse an AVRO field of type "int" and logical type "date" (corresponding to the LocalDate Java type).

Indeed, in the populateFieldInRecordWithCorrespondingType Java method at line 214, there is no check on the AVRO field logical type :

image

Expected behavior

The corresponding Java field (of type LocalDate) should be set with the right value.

Environment

Steps taken to try and solve the problem

  1. Run a unit test case and make it fail
  2. Add a check on the AVRO field logical type
  3. Run again the unit test case and make it succeed

Additional context

Some AVRO schemas used at Michelin contain fields of type "int" and logical type "date" (corresponding to the LocalDate Java type).

sipetit commented 10 months ago

Please note that the issue described above also applies to an AVRO field of of type "int" and logical type "time-millis" (corresponding to the LocalTime Java type), among other date / time AVRO field types.