Определение схемы Avro - PullRequest
0 голосов
/ 04 марта 2020

У меня есть некоторые данные avro, подобные этим, которые напечатаны в терминале.

{"cust_status_id":0, "cust_status_description":{"string":" Approved"}}

Созданная мной схема avro имеет вид

{
  "namespace": "com.thp.report.model",
  "type": "record",
  "name": "PraStatusMaster",
  "fields": [
    {
      "name": "cust_status_id",
      "type": "int"
    },
    {
      "name": "cust_status_description",
      "type": "string",
      "avro.java.string": "String"
    }
  ]
}

Правильна ли схема ??

1 Ответ

0 голосов
/ 04 марта 2020

Правильная схема для вашего json следующая:

{
  "name": "PraStatusMaster",
  "type": "record",
  "namespace": "com.thp.report.model",
  "fields": [
    {
      "name": "cust_status_id",
      "type": "int"
    },
    {
      "name": "cust_status_description",
      "type": {
        "name": "cust_status_description",
        "type": "record",
        "fields": [
          {
            "name": "string",
            "type": "string"
          }
        ]
      }
    }
  ]
}
...