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 Plain View
Avro >> mail # dev >> GenericRecord.toString does not handle enums properly


Copy link to this message
-
GenericRecord.toString does not handle enums properly
The output from GenericRecord.toString in Java is not valid JSON, for
example a record with the schema:

{
  "type": "record",
  "name": "TestRecord",
  "fields" : [
    {"name":"enum_field",
     "type":{"type":"enum",
                 "symbols":["a", "b"],
                 "name":"MyEnumType"}},
  ]
}

Should be output as
{"enum_field":"a"}
but is output as
{"emum_field":a}

The later is not really JSON. I saw this on 1.4 but I think it exists
on trunk too.

Is this a known issue? I think the fix is just to add another special
case in GenericData.toString()...

-Jay
+
Doug Cutting 2010-12-15, 21:38
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