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 2008/09/19 21:48:44 UTC

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

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
            Priority: Minor


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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury resolved THRIFT-144.
----------------------------------

    Resolution: Fixed

I just committed this.

> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Attachment: thrift-144-v2.patch

Oops, forgot to include the TBaseHelper class in the last patch.

I took a look at CompareToBuilder, and I think it would be less efficient than the method I've implemented in sparse structs. It also doesn't compare Lists, so I'd still have to write some code.

I plan on committing this later today if no one has any objections.

> 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.


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

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Evans reopened THRIFT-144:
-------------------------------


I can confirm this as well...

{noformat}
[javac] /home/eevans/git/cassandra/interface/gen-java/org/apache/cassandra/service/BatchMutation.java:229: cannot find symbol
[javac] symbol  : method compareTo(java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.service.Column>>,java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.service.Column>>)
[javac] location: class org.apache.thrift.TBaseHelper
[javac]     lastComparison = TBaseHelper.compareTo(cfmap, typedOther.cfmap);
[javac]                                 ^
[javac] /home/eevans/git/cassandra/interface/gen-java/org/apache/cassandra/service/BatchMutationSuper.java:229: cannot find symbol
[javac] symbol  : method compareTo(java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.service.SuperColumn>>,java.util.Map<java.lang.String,java.util.List<org.apache.cassandra.service.SuperColumn>>)
[javac] location: class org.apache.thrift.TBaseHelper
[javac]     lastComparison = TBaseHelper.compareTo(cfmap, typedOther.cfmap);
[javac]
{noformat}

> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743396#action_12743396 ] 

Bryan Duxbury commented on THRIFT-144:
--------------------------------------

I have created THRIFT-565 to address this issue.

> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Attachment: thrift-144.patch

This patch makes thrift structs comparable if and only if none of their members is a set or map, recursively. This is because there is no really sensible natural way to compare two maps or sets. This should allow all key-like thrift structs to be compared and thus sorted.

> 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
>            Priority: Minor
>             Fix For: 0.2
>
>         Attachments: 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Comment: was deleted

(was: This patch addresses the issues David raised. )

> 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.


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

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736985#action_12736985 ] 

David Reiss commented on THRIFT-144:
------------------------------------

Not sure if you would be interested in using this helper class <http://commons.apache.org/lang/api-release/index.html>.  Probably much less important than the hash version, but I figured I'd throw it out there anyway.

> 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.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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Fix Version/s: 0.2

> 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
>            Priority: Minor
>             Fix For: 0.2
>
>
> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Patch Info: [Patch Available]
      Assignee: Bryan Duxbury

> 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.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.


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

Posted by "Robey Pointer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743012#action_12743012 ] 

Robey Pointer commented on THRIFT-144:
--------------------------------------

i think this is the patch that broke returing a map from a method:

typedef map<string, i64> StatsGroup
typedef map<string, double> StatsDGroup
typedef map<string, Timing> TimingStats

struct StatsResult {
  1: StatsGroup jvm
  2: StatsGroup counters
  3: TimingStats timings
  4: StatsDGroup gauges  
}

...

    [javac] /Users/robey/twitter/thrift-admin/target/gen-java/com/twitter/service/admin/StatsResult.java:333: cannot find symbol
    [javac] symbol  : method compareTo(java.util.Map<java.lang.String,java.lang.Long>,java.util.Map<java.lang.String,java.lang.Long>)
    [javac] location: class org.apache.thrift.TBaseHelper
    [javac]     lastComparison = TBaseHelper.compareTo(jvm, typedOther.jvm);
    [javac]                                 ^


> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Attachment: thrift-115-v4.patch

This patch addresses the issues David raised. 

> 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-115-v4.patch, 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.


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

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736984#action_12736984 ] 

David Reiss commented on THRIFT-144:
------------------------------------

FWIW, the C++ set and map classes are sorted (red-black trees in one popular implementation), so they can be lexicographically compared.  I suspect the unordered versions in TR1 are not LessThanComparable, though.

> 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.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.


[jira] Issue Comment Edited: (THRIFT-144) Generated classes should implement Comparable

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736985#action_12736985 ] 

David Reiss edited comment on THRIFT-144 at 7/29/09 9:21 PM:
-------------------------------------------------------------

Not sure if you would be interested in using this helper class <http://commons.apache.org/lang/api-release/org/apache/commons/lang/builder/CompareToBuilder.html>.  Probably much less important than the hash version, but I figured I'd throw it out there anyway.

      was (Author: dreiss):
    Not sure if you would be interested in using this helper class <http://commons.apache.org/lang/api-release/index.html>.  Probably much less important than the hash version, but I figured I'd throw it out there anyway.
  
> 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.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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-144:
---------------------------------

    Attachment:     (was: thrift-115-v4.patch)

> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743016#action_12743016 ] 

Bryan Duxbury commented on THRIFT-144:
--------------------------------------

Hm, I thought I avoided generating the compareTo method for structs that contained maps. This is perplexing.

> 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.


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

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12748851#action_12748851 ] 

Hudson commented on THRIFT-144:
-------------------------------

Integrated in Cassandra #180 (See [http://hudson.zones.apache.org/hudson/job/Cassandra/180/])
    update to thrift trunk and rename jar after the svn revision (806014).  inline our map typedef to work around regression introduced in .  add slf4j dependencies (required since THRIFT-558).  regenerate thrift structs with new version.
patch by jbellis for CASSANDRA-308, CASSANDRA-387


> 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.


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

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736986#action_12736986 ] 

David Reiss commented on THRIFT-144:
------------------------------------

Didn't run it.  Code looks sensible.  LG.

> 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.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.