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 >> Serializing nested records


Copy link to this message
-
Re: Serializing nested records
Thanks very much Doug and Rob for the quick and accurate replies.   Doug's
suggestion helped make sense of the error, and Rob's suggestion got me most
of the way to resolving it.   It turned out there was a second error in the
definition of the first "components" field - instead of:

  {"name": "components", "type":
     [{ "type": "array", "items" :
          [{ "type": "record",

It needed to be:

  {"name": "components", "type":
    ["null",
      { "type": "array", "items":
        { "type": "record",

This, along with Doug's suggestion, resulted in the working schema:

{
  "namespace": "com.wily.apm.blackjack",
  "type": "record",
  "name": "TransactionStatic",
  "fields":
   [
       {"name": "id", "type": "int"},
       {"name": "isIdLocal", "type": "boolean", "default": "true"},
       {"name": "contextPath", "type": [{ "type": "array", "items": "string"
},"null"] },
       {"name": "components", "type":
          ["null",
           { "type": "array", "items":
              { "type": "record",
                "name": "TransactionStaticComponent",
                "fields":
                [                      
                    {"name": "id", "type": "int"},
                    {"name": "isIdLocal", "type": "boolean", "default":
"true"},
                    {"name": "contextPath", "type": [{ "type": "array",
"items": "string" },"null"] },
                    {"name": "application", "type" : ["string","null"]},
                    {"name": "class", "type" :  ["string","null"]},
                    {"name": "method", "type" :  ["string","null"]},
                    {"name": "lineNumber", "type" :  ["int","null"]},
                    {"name": "payload", "type": [{"type": "map", "values":
"string"},"null"] },
                    {"name": "components", "type": [{"type": "array",
"items": "TransactionStaticComponent"},"null"], "default": "null"}
                ]
              }
           }]
        }
    ]
}

--
View this message in context: http://apache-avro.679487.n3.nabble.com/Serializing-nested-records-tp4025992p4026005.html
Sent from the Avro - Users mailing list archive at Nabble.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