auraseb opened a new pull request, #11730: URL: https://github.com/apache/arrow-rs/pull/11730
# Which issue does this PR close? - Closes #NNN # Rationale for this change Per the Avro spec, a name containing a dot is a full name. Its namespace attribute is ignored and nested types inherit the namespace taken from the name. The named type resolver in `codec.rs` did not apply this rule when registering types, so a type declared as `ns.Status` could not be referenced as `ns.Status`, and a type nested in a record named `com.example.Event` could not be referenced as `com.example.Kind`. Both fail with `Failed to resolve ...`. # What changes are included in this PR? - `Resolver::register` splits a dotted name into namespace and name, the same way `Resolver::resolve` already does. - A small `named_type_namespace` helper returns the namespace of a named type, taking it from the name when the name is dotted. It replaces the `x.namespace.or(namespace)` expressions for records, enums and fixed types in both `parse_type` and the schema resolution paths, so nested types inherit the right namespace. # Are these changes tested? Yes. `test_named_type_reuse_with_full_name` covers both a dotted enum name referenced by its full name and a nested record referenced through the namespace of a dotted enclosing record name. It fails on `main` with `Failed to resolve enum_ns.Status`. # Are there any significant user-facing changes? No API changes. Schemas that use dotted names now parse instead of returning an error. For a named type declared with a dotted name, the `avro.namespace` field metadata now holds the namespace from that name rather than the enclosing one. Fixes #11729 AI tools were used to find this bug and to write the fix, the test and this description. The tests were run locally before and after the change. -- 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]
