[
https://issues.apache.org/jira/browse/AVRO-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13641696#comment-13641696
]
Leo Romanoff commented on AVRO-1282:
------------------------------------
Scott, your Maven advice has helped! I can reproduce your avro-ipc errors.
I analyzed them and most/all of them seem to be related to the
getOrCreateFieldsArray code snipped that you correctly posted above. The reason
for this is:
- This code does not handle GenericRecord properly. In case of a generic
record, Class c would always point to the org.apache.avro.generic.Record.
So,to solve it we need to distinguish between types of different objects based
on something else rather than their Class. My first idea was to use a string,
which is actually either a class name or GenericRecord name. But it turns out
that GenericRecord objects/schemas do not always have a name for a record, e.g.
I see something like this, where the top-level record has no name.
{"type":"record","fields":[{"name":"TestRecord0","type":{"type":"record","name":"TestRecord",
"namespace":"org.apache.avro.TestProtocolReflect$","fields":[{"name":"name","type":"string"}]}}]}
The other idea could be to use schema object as a key in this method. But I'm
not sure if it would really solve all of our problems. Any suggestions on what
to use as a key to make this mapping unique?
> Make use of the sun.misc.Unsafe class during serialization if a JDK supports
> it
> -------------------------------------------------------------------------------
>
> Key: AVRO-1282
> URL: https://issues.apache.org/jira/browse/AVRO-1282
> Project: Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.7.4
> Reporter: Leo Romanoff
> Priority: Minor
> Attachments: avro-1282-v1.patch, avro-1282-v2.patch,
> avro-1282-v3.patch, avro-1282-v4.patch, avro-1282-v5.patch,
> avro-1282-v6.patch, avro-1282-v7.patch, avro-1282-v8.patch,
> TestUnsafeUtil.java
>
>
> Unsafe can be used to significantly speed up serialization process, if a JDK
> implementation supports java.misc.Unsafe properly. Most JDKs running on PCs
> support it. Some platforms like Android lack a proper support for Unsafe yet.
> There are two possibilities to use Unsafe for serialization:
> 1) Very quick access to the fields of objects. It is way faster than with the
> reflection-based approach using Field.get/set
> 2) Input and Output streams can be using Unsafe to perform very quick
> input/output.
>
> 3) More over, Unsafe makes it possible to serialize to/deserialize from
> off-heap memory directly and very quickly, without any intermediate buffers
> allocated on heap. There is virtually no overhead compared to the usual byte
> arrays.
--
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