【问题标题】:how to create a map in avro json schema如何在 avro json 模式中创建地图
【发布时间】:2023-01-27 23:41:22
【问题描述】:

嗨,我正在尝试创建地图 Map<String, int>,按照我看到的示例设置我的 json

{
  "name": "MapRecord",
  "type": "record",
  "fields": [
    {
      "name": "map",
      "type": {
        "type": "map",
        "values": "int"
      }
    }
  ]
}

但我不断收到的错误如下:

"record" is not a defined name. The type of the "MapRecord" field must be a defined name or a {"type": ...} expression.

我也试过规范中的这个例子。

{
  "name": "example",
  "type": "map",
  "values": "long",
  "default": {}
}

“地图”不是定义的名称。使用 1.10.2 编译 im 时

【问题讨论】:

    标签: apache-kafka avro


    【解决方案1】:

    这应该做..

    {"name": "example", "type": {"type": "map", "values": "string"}}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多