You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2009/08/14 22:06:14 UTC

[jira] Closed: (THRIFT-144) Generated classes should implement Comparable

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

Bryan Duxbury closed THRIFT-144.
--------------------------------

    Resolution: Fixed

I opened THRIFT-565 to resolve the new bugs.

> Generated classes should implement Comparable
> ---------------------------------------------
>
>                 Key: THRIFT-144
>                 URL: https://issues.apache.org/jira/browse/THRIFT-144
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>            Priority: Minor
>             Fix For: 0.2
>
>         Attachments: thrift-144-v2.patch, thrift-144.patch
>
>
> We use our Thrift types in Hadoop map/reduce, sometimes as keys. As such, they need to be compared to other keys to be sorted. Right now, the only way to compare two Thrift objects is to serialize them and do byte comparison. It'd be nice if we could compare two objects directly. 
> The implementation of such a compareTo would look a lot like the equals() implementation already present, and delegate to the subtypes' compareTo methods appropriately. The ordering of the field declarations in the .thrift file would indicate the sort order between fields. In some situations this would make the sorting somewhat arbitrary, but it would be stable, and if you really needed the sorting to take into account fields in a specific order, you could order your fields appropriately. 

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