Hi,

I'm having trouble taking a flat record and building an avro schema that
lets me nest it.
I found this example schema, but after using a ConvertRecord or
UpdateRecord, I receive the equivalent of [{"parent" = null}]

{"type": "record", "name": "CustomerInput", "namespace":
"org.apache.example", "fields": [
        {"name": "id", "type": "string"},
        {"name": "companyName", "type": ["null", "string"], "default":
null},
        {"name": "revenue", "type": ["null", "string"], "default": null},
        {"name" : "parent", "type" : [ "null",
            {"type" : "record", "name" : "parent", "fields" : [
                {"name" : "name", "type" : ["null", "string"], "default" :
null},
                {"name" : "id", "type" : "string"}
            ] }
        ], "default" : null }
]}

This example found online is meant to union a person schema with an address
schema, creating an "Address" type, but this resulted in a "Could not parse
incoming data" error.

[
  {"type": "record", "name": "Address", "fields": [
      {"name": "streetaddress", "type": "string"},
      {"name": "city", "type": "string"}
  ]},
  {"type": "record", "name": "person", "fields": [
      {"name": "firstname","type": "string"},
      {"name": "lastname", "type": "string"},
      {"name": "address", "type": "Address"}
  ]}
]

I would also like to be able to include multiples of these sub-records as
well, such that I could have 0 to n addresses with distinct address types
associated to one person.
Is this possible with the record processors, or do I need to focus on Jolt
/ ConvertAvro?

Thanks,
Charlie

Reply via email to