Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Support for import in avpr file from avsc schema file

I have two schema file

First is position.avsc

{
"type":"enum", "name": "Position", "namespace": "avro.examples.baseball",
    "symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"]
}

Second is player.avsc

{
"type":"record", "name":"Player", "namespace": "avro.examples.baseball",
  "fields": [
   {"name": "number", "type": "int"},
   {"name": "first_name", "type": "string"},
   {"name": "last_name", "type": "string"},
   {"name": "position", "type": {"type": "array", "items": "avro.examples.baseball.Position"} }
  ]
}

I can import these schemas in avdl

@namespace("avro.examples.baseball")
protocol Baseball {
   import schema "position.avsc";
   import schema "player.avsc";
}

But I want to define above protocol in json and import those schemas in protocol file. This will be helpful for reusability of schema

like image 467
Mac Avatar asked Nov 16 '25 11:11

Mac


1 Answers

Avro idl schema can be specified with two type of files

  1. avpr
  2. avdl

In case of avpr file, we can not import external schema. All required schemas must present in same file.

For avdl , we can import external schemas from avsc file.

I have verified this for avro 1.7.7

like image 134
sdk Avatar answered Nov 18 '25 00:11

sdk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!