Conversation
fix enum type deserialization bug
Signed-off-by: Jiakuan Li <jiakuan.li@yitu-inc.com>
fixes broken cargo test and add a new feature that handle the Unknown Record (already define) Signed-off-by: Jiakuan Li <jiakuan.li@yahoo.com>
{
"name":"person",
"type":"record",
"fields":[
{
"name":"firstname",
"type":"string"
},
{
"name":"lastname",
"type":"string"
},
{
"name":"address",
"type":{
"type":"record",
"name":"AddressUSRecord",
"fields":[
{
"name":"streetaddress",
"type":"string"
},
{
"name":"city",
"type":"string"
}
]
}
},
{
"name":"test",
"type":"AddressUSRecord"
}
]
}for the schema like above, avro-rs will throw an Error as unknown type of AddressUSRecord. |
| pub struct RecordField { | ||
| /// Name of the field. | ||
| pub name: String, | ||
| // pub name: String, |
There was a problem hiding this comment.
I think your editor is messing up the linting, which is probably the reason why the tests are failing. Perhaps you could try running cargo fmt?
|
I think this is going to clash quite badly with #99 , being that one such a big rewrite. |
| aliases, | ||
| }; | ||
|
|
||
| // TODO: "type" = "<record name>" |
| for field in fields { | ||
| // This clone is also expensive. See if we can do away with it... | ||
| items.push((field.name.clone(), decode(&field.schema, reader)?)); | ||
| items.push((field.name.name.clone(), decode(&field.schema, reader)?)); |
There was a problem hiding this comment.
I do understand where you are coming from, but name.name sounds pretty weird, honestly...
| impl RecordField { | ||
| /// Parse a `serde_json::Value` into a `RecordField`. | ||
| fn parse(field: &Map<String, Value>, position: usize) -> Result<Self, Error> { | ||
| fn parse(field: &Map<String, Value>, position: usize, parsed_record: &mut HashMap<String, Schema>) -> Result<Self, Error> { |
There was a problem hiding this comment.
I am not sure I like this additional argument that we have to carry around everywhere. It is pretty obscure and it's adding quite a bit of complexity (and clone)...
|
This PR has been open for more than a year and it looks like no progress has been made for a while. Our codebase has quite diverged since this was open, too. 😄 |
when reader_schema specified a
aliasesin anyrecordinfieldof a record, should match them before looking fordefaultifnamecould not find any thing