The default for a union is interpreted as the type of its first branch. https://avro.apache.org/docs/current/spec.html#Unions
Thus, in your example, if you want a nullable byte array, place "null" first in the union, e.g.: {"type":"record","name":"hello","fields":[{"name":"id","type":["null", "bytes"],"default":null}]} Doug On Mon, Jun 4, 2018 at 2:02 AM kant kodali <kanth...@gmail.com> wrote: > Hi All, > > What is the default value I can specify for bytes when it is in union? > > Tried the following and all fail. > > {"type":"record","name":"hello","fields":[{"name":"id","type":["bytes", > "null"],"default":null}]} > {"type":"record","name":"hello","fields":[{"name":"id","type":["bytes", > "null"],"default":"null"}]} > {"type":"record","name":"hello","fields":[{"name":"id","type":["bytes", > "null"],"default":"\u00FF"}]} > > Thanks! > >