You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Martin Kleppmann (JIRA)" <ji...@apache.org> on 2015/12/14 21:48:46 UTC

[jira] [Updated] (AVRO-1663) C Library does not handle enum's namespace

     [ https://issues.apache.org/jira/browse/AVRO-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Kleppmann updated AVRO-1663:
-----------------------------------
    Attachment: AVRO-1663-2.patch

The previous patch doesn't fully address the problem (for example, it does not actually save the namespace in the enum schema struct, so when it comes to writing the schema out to JSON again, the namespace will be omitted).

I'm attaching a more comprehensive patch. It also deals with "fixed" types (which, being named types, should also be namespace-aware), it deals with fully-qualified names appearing in the "name" field (as permitted by the spec), and it correctly round-trips to and from JSON.

In this patch I've made some public API changes: added a function {{avro_schema_namespace}} which returns the namespace of a named schema (as suggested in AVRO-1565), and added a namespace parameter to the {{avro_schema_fixed}} and {{avro_schema_enum}} constructors. What's the policy for such API changes in the C implementation? Rather than changing the existing function signature, would it be better to add alternative versions that take a namespace argument (e.g. {{avro_schema_fixed_ns}} and {{avro_schema_enum_ns}})?

> C Library does not handle enum's namespace
> ------------------------------------------
>
>                 Key: AVRO-1663
>                 URL: https://issues.apache.org/jira/browse/AVRO-1663
>             Project: Avro
>          Issue Type: Bug
>          Components: c
>    Affects Versions: 1.7.7
>            Reporter: Thomas Sanchez
>         Attachments: AVRO-1663-2.patch, AVRO-1663.patch
>
>
> {code}{
>   "type": "record",
>   "name": "EventName",
>   "namespace": "com.company.avro.schemas",
>   "fields": [
>     {"name": "eventname_model",
>      "type": {
>        "type": "enum",
>        "namespace": "com.company.models",
>        "name": "EventName",
>        "symbols": ["XXXX"]
>      }
>     }
>  ]
> }
> {code}
> Such a schema is perfectly valid but the C library does no handle it because it does not parse the namespace field.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)