0

我只是想在 Confluent Control Center 的 Web 界面中为主题设置一个值模式。我选择了 Avro 格式并尝试了以下架构:

{
  "fields": [
    {"name":"date",
     "type":"dates",
     "doc":"Date of the count"
    },
    {"name":"time",
     "type":"timestamp-millis",
     "doc":"date in ms"
    },
    {"name":"count",
     "type":"int",
     "doc":"Number of Articles"
    }
  ],
  "name": "articleCount",
  "type": "record"
}

但是界面一直说输入模式无效。我不知道为什么。

任何帮助表示赞赏!

4

1 回答 1

0

存在与数据类型相关的问题。

  1. "type":"dates"=>"type": "string"
  2. "type":"timestamp-millis"=>"type": {"type": "long", "logicalType": "timestamp-millis"}

更新的架构将如下所示:

{
  "fields": [
    {
      "name": "date",
      "type": "string",
      "doc": "Date of the count"
    },
    {
      "name": "time",
      "type": {
        "type": "long",
        "logicalType": "timestamp-millis"
      },
      "doc": "date in ms"
    },
    {
      "name": "count",
      "type": "int",
      "doc": "Number of Articles"
    }
  ],
  "name": "articleCount",
  "type": "record"
}

样本有效载荷:

{
    "date": "2020-07-10",
    "time": 12345678900,
    "count": 1473217
}

可以在此处找到与 Avro 数据类型相关的更多参考:

于 2020-07-15T15:58:47.540 回答