Hi Folks,
We have the following avsc (below). The problem we are having though is
that when we want to reach a 'map' type field e.g. outlinks, field value
comes null (not with an empty map object). To prevent this, we have to set
an empty map object before we do any operation in order not to get any NPE.
We therefore have to set empty map objects before any serialization...
Is there a better default value for this field (and other similar
scenarios)?
Thanks in advance, any guidance is greatly appreciated.
Lewis

{
  "type": "record",
  "name": "WebPage","default":null,
  "namespace": "org.apache.gora.examples.generated",
  "fields" : [
    {"name": "url", "type": ["null","string"], "default":null},
    {"name": "content", "type": ["null","bytes"],"default":null},
    {"name": "parsedContent", "type": {"type":"array", "items":
"string"}, "default":null},
    {"name": "outlinks", "type": {"type":"map", "values":"string"},
"default":null},
    {"name": "metadata", "default":null, "type": {
      "name": "Metadata",
      "type": "record",
      "namespace": "org.apache.gora.examples.generated",
      "fields" : [
        {"name":"version","type":"int","default":0},
        {"name":"data","type":{"type":"map","values":"string"}, "default":null}
      ]
    }}
  ]
}



-- 
*Lewis*
  • [no subject] Lewis John Mcgibbney
    • Re: Martin Kleppmann
      • Re: Lewis John Mcgibbney
      • Re: Lewis John Mcgibbney

Reply via email to