You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Oscar Westra van Holthe - Kind (Jira)" <ji...@apache.org> on 2022/11/28 08:53:00 UTC

[jira] [Commented] (AVRO-3430) [Spec] Clarify whether a primitive type can have metadata

    [ https://issues.apache.org/jira/browse/AVRO-3430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17639885#comment-17639885 ] 

Oscar Westra van Holthe - Kind commented on AVRO-3430:
------------------------------------------------------

The current Java code ignores any attribute that _can_ have a special meaning, probably to prevent possible confusion. This fits the specification, as no such attribute fits the description "Attributes not defined in this document".

Do we think that it would be "ok" to give (for example) the combination of a {{long}} with logical type {{timestamp-millis}} a name/alias? Or some similarly structured future improvement?

If we do, then the current implementation is buggy (it should be a parsing error). Otherwise, any attribute that does not have a special meaning in its context should be treated as metadata.

> [Spec] Clarify whether a primitive type can have metadata
> ---------------------------------------------------------
>
>                 Key: AVRO-3430
>                 URL: https://issues.apache.org/jira/browse/AVRO-3430
>             Project: Apache Avro
>          Issue Type: Improvement
>            Reporter: Ryan Skraba
>            Priority: Major
>
> Given the following schema:
> {code:java}
> {
>   "name": "a",
>   "namespace": "top",
>   "type": "record",
>   "fields": [
>       {"name": "b", "type": {"name": "c", "type": "string"}}
>   ]
> } {code}
> What does the *{{"name": "c"}}* do and how should it be treated?
> Currently, the Java SDK drops this name silently, since primitive types have no attributes.
> The spec says:
> {quote}"Attributes not defined in this document are permitted as metadata, but must not affect the format of serialized data."
> {quote}
> Should this property be retained in the schema?  Is it correct to drop it?  Should this be a parsing error?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)