lulitao1997 edited a comment on pull request #1393:
URL: https://github.com/apache/avro/pull/1393#issuecomment-966756569
Sorry, i missied your message, somehow it did't send the notification by
email :P
I checked and ur solution seems to be wrong if we have a union like this
["A", "B"]
where A and B are like this --
```
// A and B are the same except the name.
let schema_str_1 = r#"{
"name": "A",
"type": "record",
"fields": [
{"name": "field_one", "type": "float"}
]
}"#;
let schema_str_2 = r#"{
"name": "B",
"type": "record",
"fields": [
{"name": "field_one", "type": "float"}
]
}"#;
```
in this case, the schema found by a value will always be "A"'s schema.
this also applies to A, B being "fixed" type, which seems plausible in
reallife (for example `A = {"name": "fieldA", "type": "fixed", "size": 10}, B =
{"name": "fieldB", "type": "fixed", "size": 10}`)
here is my PR for these scenario . https://github.com/apache/avro/pull/1396
to solve that, we can change `Value::Union` to `(index in the type list,
value
it holds)`, Similiar to `Value::Enum`.
this allows us to get Union's inner_schema for named types
directly, without validating the schema.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]