合流controlcenter上的架构无效

nsc4cvqm  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(296)

我只是想在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"
}

但是接口一直说输入模式无效。我不知道为什么。
感谢您的帮助!

r7knjye2

r7knjye21#

存在与数据类型相关的问题。 "type":"dates" =>
"type": "string" "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数据类型的更多参考可在此处找到:
https://docs.oracle.com/database/nosql-12.1.3.0/gettingstartedguide/avroschemas.html

相关问题