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

Alexandre Normand updated AVRO-1147:
------------------------------------

    Labels: newbie patch  (was: )
    Status: Patch Available  (was: Open)

Not trying to beat you to the punch but I thought I'd share my re-worked 
version of the patch now ;). I may be violating the rules here as the patch is 
actually a superset of your latest patch for AVRO-1146 (I needed it to make 
this work). 

I moved {{TestReflect}} under the {{org.apache.avro.reflect}} package as it 
both seemed like the right place for it and it allowed me to use the 
{{protected}} version of {{ReflectData.compare}} for the new tests. 

Note that I'm adding Integer.class to stringables on ReflectData in the 
{{TestReflect}} unit test and I _did_ pause for a minute to think about 
implications of adding it as the stringableClasses set is shared for both map 
keys as well as straight types. Since {{Integer.class}} is already bucketed as 
a primitive before we check for stringableClasses in a non-map scenario, it 
should be fine though. 

Thoughts?

                
> Allow Stringable Map keys in addition to pure String keys (avro reflection)
> ---------------------------------------------------------------------------
>
>                 Key: AVRO-1147
>                 URL: https://issues.apache.org/jira/browse/AVRO-1147
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.7.0
>            Reporter: Alexandre Normand
>              Labels: newbie, patch
>         Attachments: AVRO-1147.patch
>
>
> I'm using avro reflection for some serialization that doesn't require the 
> best performance for some short-lived data. 
> However, the object I'm trying to serialize uses a {{Map}} with non-String 
> keys (the key class is {{Integer}}) and, because of the strict restriction on 
> Map keys being Strings, it fails. 
> Could we consider allowing Map keys to be *{{Stringable}}* classes (I'm 
> thinking of something similar to Doug's solution in 
> https://issues.apache.org/jira/browse/AVRO-1146)

--
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