avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-249) in reflection, represent Java short as fixed data
Date Fri, 04 Dec 2009 19:35:20 GMT

    [ https://issues.apache.org/jira/browse/AVRO-249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786097#action_12786097

Doug Cutting commented on AVRO-249:

> Could you just call it "Short"?

I'm hesitant to do this now.  It  seems tantamount to extending the specification with a new
type.  We could perhaps add it to a standard "lib" namespace or somesuch.  But, until we've
established that, an application that needs a two-byte quantity should define its schema to
use an application-specific fixed type in its schemas.

The use of java.lang.Short highlights a place where folks are using a java-specific type.
 A mechanism for mapping arbitrary application-specific Avro types to unboxed Java types is
not straightforward today.  I don't want to solve that problem today.  Today I want to make
applications that use shorts work using reflection.  And I don't mind that appearing as a
wart on that application until we solve these harder problems.

> It also seems pretty arbitrary that integers, longs, and floats are represented with
zigzag varint encoding, but shorts are always two bytes.

Yes, it is arbitrary.  We could instead model shorts as a one-field int record.  That would
not restrict its range, and might use more space in some cases.  Six of one.

> Have you considered using an approach similar to the annotation approach in AVRO-242
for this?

Yes.  What type would you annotate?  Would you annotate each field that's a short?  Would
we implement mixin annotations?

> in reflection, represent Java short as fixed data
> -------------------------------------------------
>                 Key: AVRO-249
>                 URL: https://issues.apache.org/jira/browse/AVRO-249
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Doug Cutting
>            Assignee: Doug Cutting
>             Fix For: 1.3.0
>         Attachments: AVRO-249.patch
> Currently the Java reflect API treats shorts as ints.  This fails however to naturally
handle shorts in arrays and other containers.  It would be better if we used a distinct type
for reflected Java short values.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message