0
全部, 我有幸運用一組記錄創建Apache Avro架構,但是當我嘗試製作一個數組記錄,python模式解析器失敗。我做錯了什麼,或者這是一個錯誤?加載模式時,Apache Avro陣列中的記錄陣列在Python中失敗(「不可疊加類型,字典」)
{
"type": "record",
"name": "userInfo",
"namespace": "my.example",
"fields": [
{
"name": "ID",
"type": "string",
"default": "NONE"
},
{
"name": "message_timestamp",
"type": "long"
},
{
"name": "location",
"type": [
"null",
"string"
],
"default": "NONE"
},
{
"name": "AttributeMapping0",
"type": {
"type": "array",
"items": [
{
"name": "timestamp",
"type": "long"
},
{
"name": "AttributeMapping1",
"type": {
"type": "array",
"items": [
{
"name": "AttributeMapping2",
"type": "record",
"fields": [
{
"name": "Name",
"type": "string"
},
{
"name": "Value",
"type": "long"
}
]
}
]
}
}
]
}
}
]
}
的錯誤信息是非常長的 - 對不起:
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1283, in Parse
return SchemaFromJSONData(json_data, names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1254, in SchemaFromJSONData
return parser(json_data, names=names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1182, in _SchemaFromJSONObject
other_props=other_props,
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1061, in __init__
fields = make_fields(names=nested_names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1173, in MakeFields
return tuple(RecordSchema._MakeFieldList(field_desc_list, names))
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 986, in _MakeFieldList
yield RecordSchema._MakeField(index, field_desc, names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 957, in _MakeField
names=names,
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1254, in SchemaFromJSONData
return parser(json_data, names=names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1197, in _SchemaFromJSONObject
items=SchemaFromJSONData(items_desc, names),
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1254, in SchemaFromJSONData
return parser(json_data, names=names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1142, in _SchemaFromJSONArray
return UnionSchema(map(MakeSchema, json_array))
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 866, in __init__
self._schemas = tuple(schemas)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1141, in MakeSchema
return SchemaFromJSONData(json_data=desc, names=names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1254, in SchemaFromJSONData
return parser(json_data, names=names)
File "/usr/local/lib/python3.4/dist-packages/avro_python3-1.8.0-py3.4.egg/avro/schema.py", line 1154, in _SchemaFromJSONObject
if type in PRIMITIVE_TYPES:
TypeError: unhashable type: 'dict'
任何指導,將不勝感激。謝謝。
你能否添加一些你希望你的記錄看起來像什麼的例子? – mtth