java - How to specify a default value for an enum using avro IDL? -
i haven't found in documentation this, generic bla default values. assumption should work this:
enum myenum { unspecified, specified } record test { myenum e = "unspecified"; }
the genericdatumreader in java unfortunately complains finding string expects myenum.
can confirm correct way use enum default value using avro idl? in case have bug elsewhere. can confirm not way , correct me? input appreciated!
update: in real world version of this, seems newly added enum record causing issue though has default value. means reader schema expects enum, whereas record not contain one. schema evolution should able resolve this, seems fail. more detail: working pig here, not direct java.
ok, turns out indeed correct way specify default value enum in avro idl. in case union {null, string} had been replaced enum causing trouble. remember: do not change type of field in avro!
Comments
Post a Comment