[
https://issues.apache.org/jira/browse/AVRO-668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910229#action_12910229
]
Doug Cutting commented on AVRO-668:
-----------------------------------
Scott, have you benchmarked this? If so, how much does it improve things?
Some problems with the current patch:
- it doesn't compile, failing with: ValidatingEncoder is not abstract and does
not override abstract method writeString(java.lang.String)
- once that's fixed, some tests fail for me (e.g., TestBlockIO2)
- the utf8cs constant should be named UTF8_CS. this fails checkstyle.
Should we also add Encoder#writeString(CharSequence s) as a convenience? This
could be implemented as:
{code}
if (s instanceof Utf8)
writeString((Utf8)s);
else
writeString(s.toString());
{code}
That would move this logic from GenericDatumWriter to Encoder. What do you
think? Are there other places that method might be useful?
> Java: Streamline writing of Strings for Encoders and GenericDatumWriter
> -----------------------------------------------------------------------
>
> Key: AVRO-668
> URL: https://issues.apache.org/jira/browse/AVRO-668
> Project: Avro
> Issue Type: Improvement
> Reporter: Scott Carey
> Assignee: Scott Carey
> Fix For: 1.4.1
>
> Attachments: AVRO-668.patch
>
>
> We can streamline writing of strings to minimize object creation during
> writes.
> We can avoid converting a String into Utf8 for Json output, and for Binary
> output we can avoid a Utf8 (but still create a byte[]).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.