avro-kotlin / avro4k

Avro format support for Kotlin
Apache License 2.0
188 stars 36 forks source link

Support duration logical type #206

Open Chuckame opened 1 month ago

Chuckame commented 1 month ago

Added in the latest 1.11 avro spec, duration is a new standard logical type, encoded as a fixed of 12 bytes.

It should handle java.time.Duration and kotlin.time.duration as the kotlin type is not a type alias but a real different class.

Encoding:

In the given order, 3 numbers of 4 bytes each (no zig-zag encoding):

The logical type name must be duration