You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sharad Agarwal (JIRA)" <ji...@apache.org> on 2009/05/13 10:38:45 UTC

[jira] Created: (AVRO-32) Generated classes should override equals and hashcode

Generated classes should override equals and hashcode
-----------------------------------------------------

                 Key: AVRO-32
                 URL: https://issues.apache.org/jira/browse/AVRO-32
             Project: Avro
          Issue Type: Improvement
          Components: java
            Reporter: Sharad Agarwal


It would be good to have equals and hashcode implementation generated as well.

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


[jira] Commented: (AVRO-32) Generated classes should override equals and hashcode

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709460#action_12709460 ] 

Doug Cutting commented on AVRO-32:
----------------------------------

> applications may need different ordering with same record objects.

That's certainly true, but a lot of applications only require a single ordering, and automatically implementing a by-field ordering would simplify many applications.  So, as a start, I'd vote for implementing Comparable without any modifiers.  If this is contentious, let's move it to a separate issue.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Commented: (AVRO-32) Generated classes should override equals and hashcode

Posted by "Sharad Agarwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709274#action_12709274 ] 

Sharad Agarwal commented on AVRO-32:
------------------------------------

Are you suggesting we add "order" with each field in record schema ? I am worried it may complicate the schema syntax. Moreover applications may need different ordering with same record objects. Java anyways has good way of providing the comparators while dealing with ordering.  So rather application write it on its own.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Updated: (AVRO-32) Generated classes should override equals and hashcode

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

Doug Cutting updated AVRO-32:
-----------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

I just committed this.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>            Assignee: Doug Cutting
>             Fix For: 1.0
>
>         Attachments: AVRO-32.patch
>
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Commented: (AVRO-32) Generated classes should override equals and hashcode

Posted by "Arvind Jayaprakash (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12714818#action_12714818 ] 

Arvind Jayaprakash commented on AVRO-32:
----------------------------------------

We should stick having a way to distinguish one object from an another. Being able to order them should be taken up as a separate issue.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Commented: (AVRO-32) Generated classes should override equals and hashcode

Posted by "Sharad Agarwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715379#action_12715379 ] 

Sharad Agarwal commented on AVRO-32:
------------------------------------

+1 patch looks good.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>            Assignee: Doug Cutting
>             Fix For: 1.0
>
>         Attachments: AVRO-32.patch
>
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Commented: (AVRO-32) Generated classes should override equals and hashcode

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708978#action_12708978 ] 

Doug Cutting commented on AVRO-32:
----------------------------------

If we add equals and hashCode we should probably also implement Comparable, no?  We might even then add an "order" or somesuch option to fields, with values like "ignore" and "decreasing" that determine how the compareTo method is implemented.  And we'd probably also need GenericComparator, to implement the equivalent for generic data.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Updated: (AVRO-32) Generated classes should override equals and hashcode

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

Doug Cutting updated AVRO-32:
-----------------------------

    Fix Version/s: 1.0
         Assignee: Doug Cutting
           Status: Patch Available  (was: Open)

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>            Assignee: Doug Cutting
>             Fix For: 1.0
>
>         Attachments: AVRO-32.patch
>
>
> It would be good to have equals and hashcode implementation generated as well.

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


[jira] Updated: (AVRO-32) Generated classes should override equals and hashcode

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

Doug Cutting updated AVRO-32:
-----------------------------

    Attachment: AVRO-32.patch

Here's a patch that implements equals and hashCode for generated classes and adds a test case for them.  Does this look okay?

Comparable can be left to a subsequent patch.

> Generated classes should override equals and hashcode
> -----------------------------------------------------
>
>                 Key: AVRO-32
>                 URL: https://issues.apache.org/jira/browse/AVRO-32
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Sharad Agarwal
>             Fix For: 1.0
>
>         Attachments: AVRO-32.patch
>
>
> It would be good to have equals and hashcode implementation generated as well.

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