uuidavro

Best way to represent a UUID in Avro?


I am curious to understand the best practice for encoding one very specific type of data within Avro: UUIDs.


Solution

  • So far, the only way I found is defining a custom UUID:

    {
      "namespace" : "your.namespace",
      "type" : "fixed",
      "name" : "UUID",
      "size" : 16
    }
    

    I'm using Scala, so I also defined an implicit conversion between java.util.UUID and my custom UUID, so it's not that much of a hassle to use it.