来自avro架构的Kafka Cassandra Connector嵌套列

时间:2017-06-19 07:58:22

标签: cassandra apache-kafka apache-kafka-connect

如何从AVRO架构访问嵌套字段。

例如,我有以下架构:

{
  "type": "record",
  "name": "Person",
  "namespace": "com.datamountaineer.kcql.avro",
  "fields": [
    {
      "name": "name",
      "type": "string"
    },
    {
      "name": "address",
      "type": {
        "type": "record",
        "name": "Address",
        "fields": [
          {
            "name": "street",
            "type": {
              "type": "record",
              "name": "Street",
              "fields": [
                {
                  "name": "name",
                  "type": "string"
                }
              ]
            }
          },
          {
            "name": "street2",
            "type": [
              "null",
              "Street"
            ]
          },
          {
            "name": "city",
            "type": "string"
          },
          {
            "name": "state",
            "type": "string"
          },
          {
            "name": "zip",
            "type": "string"
          },
          {
            "name": "country",
            "type": "string"
          }
        ]
      }
    }
  ]
}

我想在这里访问嵌套字段所以我在下面尝试过 查询:

SELECT name, address.street.*, address.street2.name as streetName2 FROM topic

但低于错误:

  

Address.street。*在架构中不可用

任何人都可以帮助我。我怎么得到?

0 个答案:

没有答案