-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.apache.avro.SchemaParseException: Can't redefine: test #182
Comments
This issue is fixed in apache_avro crate. There one can use schema references: {
"type": "record",
"name": "test",
"fields": [
{"name": "a", "type": "long", "default": 42},
{"name": "b", "type": "string"},
{"name": "test", "type": "test"}
]
} apache_avro is a fork/donation of this project to Apache Avro project. |
@martin-g Thanks for the pointer! There still seems to be an issue with fn main() {
let schema = r#"
{
"name": "test.test",
"type": "record",
"fields": [
{
"name": "bar",
"type": { "name": "test.foo", "type": "record", "fields": [{ "name": "id", "type": "long" }] }
},
{ "name": "baz", "type": "test.foo" }
]
}
"#;
let schema = apache_avro::schema::Schema::parse_str(&schema).unwrap();
println!("{}", serde_json::to_string(&schema).unwrap());
} This prints the following (the same thing happens if the
Which will cause the Java tooling to fail with the |
@travisbrown I've logged https://issues.apache.org/jira/browse/AVRO-3433 for the issue! |
@martin-g Thanks very much! |
@travisbrown Please try https://github.com/apache/avro/tree/avro-3433-preserve-schema-ref-in-json |
apache/avro#1580 is ready for review! |
Having issues writing data with avro_rs and reading it with apache avro java. I was able to create one example that is close to what i am experiencing. I have a pretty complicated schema, so trying to boil it down the problem bits.
This code works just fine, but went read into avro tools i get an error.
Seems like there might be a validation that apache avro is doing that avro_rs is not. How I found this error is using the parse_list or load a directory of schema files. I have a record type that is used more that once in a parent record type and because it in lines the child schemas in the record I get an error this like the one above. In apache avro when it inlines the child schemas in parent it only defines the child record type once and then uses it by name the subsequent times. In my example, this is sort of the same issues, the record type name is the same "test" and avro_rs is ok with that, but apache avro is not.
The text was updated successfully, but these errors were encountered: