You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Michal Klempa (JIRA)" <ji...@apache.org> on 2019/08/08 12:58:00 UTC

[jira] [Commented] (AVRO-803) Java generated Avro classes make using Avro painful and surprising

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

Michal Klempa commented on AVRO-803:
------------------------------------

Hi everybody, fairly old issue, but still came across.

Would it be possible to make it clear in Specification ([http://avro.apache.org/docs/1.9.0/spec.html#Maps)], there is no mention of "avro.java.string":"String".

Also the maven plugin [https://avro.apache.org/docs/current/gettingstartedjava.html] does not specify <stringType>String</stringType>

 

Nevertheless, what is expected with Maps? I was only able to change global behavior using maven plugin configuration.

Should it be possible to specify something like this in schema:

 
{code:java}
{
   "name": "items",
   "type": {
     "type": "map",
     "values": "int",
     "avro.java.string":"String"
   }
}{code}
It did not crashed the schema parser (calling manually with `new Schema.Parser().parse(...)`) nor it made any changes to generated Java classes when using Maven plugin.

 

> Java generated Avro classes make using Avro painful and surprising
> ------------------------------------------------------------------
>
>                 Key: AVRO-803
>                 URL: https://issues.apache.org/jira/browse/AVRO-803
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.5.0
>         Environment: Any
>            Reporter: Sam Pullara
>            Assignee: Joseph Adler
>            Priority: Major
>             Fix For: 1.6.0
>
>         Attachments: AVRO-803.patch, AVRO-803.patch, Foo.java
>
>
> Currently the Avro generated Java classes expose CharSequence in their API. However, you cannot use any old CharSequence when interacting with them. In fact, you have to use the Utf8 class if you want to get consistent results. I think that Avro should work with any CharSequence if that is the API. Here is an example where this happens:
> https://github.com/spullara/avro-generated-code/blob/master/src/test/java/AnnoyingTest.java
> That prints out 'false' three times unexpectedly. If you can't get it to print 'true' three times then you should probably change it back to Utf8.



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