0

I have a Avro Schema as mentioned below.

{"type":"record",
"namespace": "com.test",
"name": "bck",
"fields": [ {"name": "accountid","type": "string"},
{"name":"amendmentpositionid","type": "int"},
{"name":"booking","type":
{"type":"array","items":
{"namespace":"com.test",
"name":"bkkk",
"type":"record",
"fields":
[{"name":"accountid","type":"string"},{"name":"clientid","type":"int"},
{"name":"clientname","type":"string"},{"name":"exerciseid","type":"int"},
{"name":"hedgeid","type":"int"},{"name":"originatingpositionid","type":"int"},
{"name":"positionid","type":"int"},{"name":"relatedpositionid","type":"int"} ]}}}]}

I want to create one more record of same type as mentioned above. OR I mean to say that I want to create list of records where schema of each record is same as above. How can i achieve it in single Avro file schema?

1 Answers1

0

The schema you provided already include an array of records. If my understanding is correct, you want to create another array of records using/containing this schema, which makes it an array of records within an array of records, in one schema file.

I hope this helps.

{
    "type": "record",
    "namespace": "com.test",
    "name": "list",
    "fields": [{
        "name":"listOfBck","type":
        {"type":"array","items":
            {
                "type":         "record",
                "namespace":    "com.test",
                "name":         "bck",
                "fields": [
                    {"name": "accountid","type": "string"},
                    {"name":"amendmentpositionid","type": "int"},
                    {"name":"booking","type":
                        {"type":"array","items":
                            {"namespace":"com.test",
                                "name":"bkkk",
                                "type":"record",
                                "fields": [
                                    {"name":"accountid","type":"string"},{"name":"clientid","type":"int"},
                                    {"name":"clientname","type":"string"},{"name":"exerciseid","type":"int"},
                                    {"name":"hedgeid","type":"int"},{"name":"originatingpositionid","type":"int"},
                                    {"name":"positionid","type":"int"},{"name":"relatedpositionid","type":"int"}
                                ]
                            }
                        }
                    }
                ]
            }
        }
    }]
}
omaistack
  • 3
  • 3