avro.io.AvroTypeException:数据[对象]不是架构的示例

时间:2019-03-15 06:54:18

标签: apache-kafka avro confluent

一段时间以来,我一直在努力解决这个问题。我正在使用AvroProducer(confluent kafka)并收到与定义的架构相关的错误。 这是我遇到的问题的完整堆栈跟踪:

<!--language: lang-none-->
raise AvroTypeException(self.writer_schema, datum)
  avro.io.AvroTypeException: The datum {'totalDifficulty': 2726165051, 'stateRoot': '0xf09bd6730b3ae7f5728836564837d7f776a8f7333628c8b84cb57d7c6d48ebba', 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', 'size': 538, 'logs': [], 'gasLimit': 8000000, 'mixHash': '0x410b2b19519be16496727c93515f399072ffecf06defe4913d00eb4d10bb7351', 'logsBloom': '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'nonce': '0x18dc6c0d30839c91', 'proofOfAuthorityData': '0xd883010817846765746888676f312e31302e34856c696e7578', 'number': 5414, 'timestamp': 1552577641, 'difficulty': 589091, 'gasUsed': 0, 'miner': '0x48FA5EBc2f0D82B5D52faAe624Fa2426998ab492', 'hash': '0x71259991acb407a85befa8b3c5df26a94a11a6c08f92f3e3b7c9c0e8e1f5916d', 'transactionsRoot': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', 'receiptsRoot': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', 'transactions': [], 'parentHash': '0x9f0c25eeab86fc144296cb034c94857beed331936016d60c0986a35ac07d9c68', 'uncles': []} is not an example of the schema {
    "type": "record",
    "name": "value",
    "namespace": "exporter.value.opsnetBlock",
    "fields": [
      {
        "type": "int",
        "name": "difficulty"
      },
      {
        "type": "string",
        "name": "proofOfAuthorityData"
      },
      {
        "type": "int",
        "name": "gasLimit"
      },
      {
        "type": "int",
        "name": "gasUsed"
      },
      {
        "type": "string",
        "name": "hash"
      },
      {
        "type": "string",
        "name": "logsBloom"
      },
      {
        "type": "int",
        "name": "size"
      },
      {
        "type": "string",
        "name": "miner"
      },
      {
        "type": "string",
        "name": "mixHash"
      },
      {
        "type": "string",
        "name": "nonce"
      },
      {
        "type": "int",
        "name": "number"
      },
      {
        "type": "string",
        "name": "parentHash"
      },
      {
        "type": "string",
        "name": "receiptsRoot"
      },
      {
        "type": "string",
        "name": "sha3Uncles"
      },
      {
        "type": "string",
        "name": "stateRoot"
      },
      {
        "type": "int",
        "name": "timestamp"
      },
      {
        "type": "int",
        "name": "totalDifficulty"
      },
      {
        "type": "string",
        "name": "transactionsRoot"
      },
      {
        "type": {
          "type": "array",
          "items": "string"
        },
        "name": "transactions"
      },
      {
        "type": {
          "type": "array",
          "items": "string"
        },
        "name": "uncles"
      },
      {
        "type": {
          "type": "array",
          "items": {
            "type": "record",
            "name": "Child",
            "namespace": "exporter.value.opsnetBlock",
            "fields": [
              {
                "type": "string",
                "name": "address"
              },
              {
                "type": "string",
                "name": "blockHash"
              },
              {
                "type": "int",
                "name": "blockNumber"
              },
              {
                "type": "string",
                "name": "data"
              },
              {
                "type": "int",
                "name": "logIndex"
              },
              {
                "type": "boolean",
                "name": "removed"
              },
              {
                "type": {
                  "type": "array",
                  "items": "string"
                },
                "name": "topics"
              },
              {
                "type": "string",
                "name": "transactionHash"
              },
              {
                "type": "int",
                "name": "transactionIndex"
              }
            ]
          }
        },
        "name": "logs"
      }
    ]
  }

有人可以告诉我我在哪里出错了吗? 预先感谢

0 个答案:

没有答案