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

Doug Cutting updated AVRO-1268:
-------------------------------

    Attachment: AVRO-1268.patch

The parser-based approach ended up being more complicated than I had hoped, so 
I returned to a simplified map-based approach that only extends specific to 
handle java-class for string schemas and java-key-class for map schemas.

A difference from the prior patches is that, to create an array or map whose 
values are stringables, instead of annotating the array one must annotate the 
value type itself.  So, in IDL, instead of:
{code}
@java-element-class("java.math.BigDecimal") map<string> 
mapWithBigDecimalElements;
{code}
one must now use
{code}
map<@java-class("java.math.BigDecimal")string> mapWithBigDecimalElements;
{code}

The implementation makes no operations slower and makes generic strings a bit 
faster.

With patch:
{code}
           GenericStringsRead:   4183 ms       3.984       424.717       2220873
          GenericStringsWrite:   6310 ms       2.641       281.542       2220873
 FooBarSpecificRecordTestRead:  19585 ms       0.851       142.199       3481319
FooBarSpecificRecordTestWrite:  12903 ms       1.292       215.839       3481319
{code}

Without patch:
{code}
           GenericStringsRead:   4832 ms       3.449       367.626       2220873
          GenericStringsWrite:   6522 ms       2.555       272.395       2220873
 FooBarSpecificRecordTestRead:  19401 ms       0.859       143.549       3481319
FooBarSpecificRecordTestWrite:  12981 ms       1.284       214.536       3481319
{code}

This patch also requires that AVRO-1268.sh is run before it is applied.

                
> Add java-class, java-key-class and java-element-class support for stringable 
> types to SpecificData
> --------------------------------------------------------------------------------------------------
>
>                 Key: AVRO-1268
>                 URL: https://issues.apache.org/jira/browse/AVRO-1268
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.7.4
>            Reporter: Alexandre Normand
>            Assignee: Alexandre Normand
>            Priority: Minor
>             Fix For: 1.7.5
>
>         Attachments: AVRO-1268-MapSolution.patch, AVRO-1268-needs-work.patch, 
> AVRO-1268.patch, AVRO-1268.patch, AVRO-1268.patch, 
> AVRO-1268-performance.patch, AVRO-1268.sh, GenericStringsPerf.patch, 
> pseudo.patch, pseudo.patch
>
>
> Stringable types are java classes that can be serialized through strings 
> (which require a single string constructor and a valid toString() 
> implementation). ReflectData currently has support from stringable types but 
> it would be desirable to get this feature with SpecificData. 
> The work involves changes to the SpecificCompiler (depends on {{@java-class}} 
> support in AVRO-1267) to generate the specific sources with the proper java 
> type as well as moving the ReflectDatumReader and ReflectDatumWriter to read 
> the java-class/java-key-class and java-element-class properties. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to