[connectors] Improve Avro key name validation#6632
Conversation
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
mythical-fred
left a comment
There was a problem hiding this comment.
Clean fix for the view.key rejection: relax the identifier check on relation names to Avro-fullname semantics, then split the trailing segment as the record name and fold the prefix into the namespace (appended to any pre-configured one). The namespace composition rule matches the Avro spec: full name = <namespace>.<name>, and dot-splitting on the input yields exactly that.
Test coverage is thorough for a one-file change: validator positive/negative cases, namespace prefixing with and without a configured namespace, plain-name path preserved, invalid-name rejection, and a round-trip through apache_avro::Schema::parse_str to make sure the generated schema actually parses. Signed-off, no AI trailers, CI green.
Non-blocking nit: the error message enumerates the segment rules, but for inputs like v..key, .key, key. the real failure is "empty segment", not "must start with a letter". Message-only, not worth another round.
LGTM.
anandbraman
left a comment
There was a problem hiding this comment.
Tested with minimal example. Pipeline initializes and runs
The connector validation rejects an Avro key field named like "view.key" because Avro identifiers cannot contain dots. However, "view.key" is not supposed to be an identifier, but a "fullname", which may contain namespaces separated by dots. So the name should be accepted. The PR introduces a "fullname" validation layer for Avro.
Fixes #6629
Checklist