You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Skraba (JIRA)" <ji...@apache.org> on 2019/07/31 14:49:00 UTC

[jira] [Commented] (AVRO-2492) Remove deprecated Schema createRecord from list method

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

Ryan Skraba commented on AVRO-2492:
-----------------------------------

Hello!  There's a remaining use for this method in protocol / messages.  I linked the original discussion from JIRA -- I stumbled across this.

It looks like the *implementation* of Schema.createRecord(List<Fields) method works: you can use the resulting anonymous record schema to serialize and deserialize data, but you can't share the schema via its JSON representation because it doesn't meet the specification name requirements.

For example, with the protocol defined in the spec: https://avro.apache.org/docs/1.9.0/spec.html#Sample+Protocol

The {{request}} attribute contains a list of "parameters" (a.k.a. fields) and the [implementation of the message|https://github.com/apache/avro/blob/2d3b1fe7efd865639663ba785877182e7e038c45/lang/java/avro/src/main/java/org/apache/avro/Protocol.java#L602] creates an anonymous record in order to send the data... BUT the schema is never sent between the caller and callee; they've already agreed via the protocol and they both know what to send/expect.  The Schema JSON representation is invalid, but the Java implementation of the Schema itself is usable.

We've stumbled across this more than a couple of times in our projects when creating an ephemeral schema that we only care about during the lifetime of a distributed job.  Unit tests and (sometimes) single-jvm operation appear to work, but when run on a cluster and the schema is actually turned to a string on one node and reparsed at another, we get a parser exception.

I think that it is a reasonable requirement to require users to name their records, and that it is probably reasonable to autogenerate a unique record name for protocol message parameters.


> Remove deprecated Schema createRecord from list method
> ------------------------------------------------------
>
>                 Key: AVRO-2492
>                 URL: https://issues.apache.org/jira/browse/AVRO-2492
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Ismaël Mejía
>            Assignee: Ismaël Mejía
>            Priority: Minor
>             Fix For: 1.10.0
>
>
> This is a follow up of AVRO-2491 for the 1.10.0 release



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)