Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> default values


Copy link to this message
-
default values
i am testing parsing a json string using a record class defined in an .avdl
file.

i was hoping that if a field in the record has a default value that it is
not mandatory to provide it in the json. however i get an exception:

org.apache.avro.AvroTypeException: Expected field name not found: test123

i guess it was silly of me to expect this?
are default values only used in schema resolution (so reader vs writer
schema)? and in this case there is no writer schema, just json data i
created and a reader schema, so the default values will not help me?

too bad because this seemed like a really quick and convenient way to
create configuration objects that can be instantiated from json, but
without "optional" fields with default values it loses a lot of it power.
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB