Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Avro] Add support for @Stringable annotation #57

Merged

Conversation

baharclerode
Copy link
Contributor

This adds support for the @Stringable annotation, and adds support for stringable classes (Those with @Stringable, and URL/URI/File/BigInteger/BigDecimal). This fixes BigInteger/BigDecimal compatibility with the apache implementation.

Of particular note, BigDecimal is no longer a Type.DOUBLE in schema generation, nor is BigInteger a Type.LONG in schema generation (since they are "stringable" to avro), but they should continue to serialize/deserialize properly from int/long/float/double scalars in existing avro schemas.

I treated @Stringable on a class as having a creator annotation on the constructor which takes a single string argument. I'm not sure if there is a better way to do this.


Rebased onto master as per this comment.

@cowtowncoder cowtowncoder merged commit ca58cfc into FasterXML:master Mar 10, 2017
@cowtowncoder cowtowncoder added this to the 2.9.0.pr2 milestone Mar 10, 2017
@cowtowncoder
Copy link
Member

Hmmh. This change seems to have nasty performance downside: serialization 30% slower, deserialization 5-15%...

@cowtowncoder
Copy link
Member

Ok, was able to make minor changes to get serialization perf back: I do not think @Stringable check ought to be needed on actual write path (since annotation lookups are remarkable ineffecient). May do more tweaks, but works fine for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants