Invalid Schema on Confluent Controlcenter

293 Views Asked by At

I am just trying to set up a Value-Schema for a Topic in the Web interface of Confluent Control Center. I chose the Avro-format and tried the following schema:

{
  "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"
}

But the interface keeps on saying the input schema is invalid. I have no idea why.

Any help is appreciated!

1

There are 1 best solutions below

0
On

There are issues related to datatypes.

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

Updated schema will be like:

{
  "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"
}

Sample Payload:

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

More reference related to Avro datatypes can be found here: