Skip to content

[Java] Dictionary.equals is not working correctly #16895

Closed

Description

@asfimport

The Dictionary.equals method does not return True when the dictionaries are equal. This is because equals is not implemented for FieldVector and so that comparison defaults to comparing the two objects only and not the vector data.

Reporter: Bryan Cutler / @BryanCutler
Assignee: Ji Liu / @tianchen92

PRs and other links:

Note: This issue was originally created as ARROW-1184. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Jul 4, 2017

    @asfimport
    Author

    Bryan Cutler / @BryanCutler:
    I think that comparing any 2 FieldVectors could get pretty complicated, especially with nested types, so maybe that's why FieldVector.equals() is not implemented. Validator.java has a comparison but I think that would probably fail for some cases. I'm not sure we can assume flat fields only for the dictionary vector to try to make it easier.

  2. asfimport commented on Oct 2, 2017

    @asfimport
    Author

    Wes McKinney / @wesm:
    Is this easy to fix?

  3. asfimport commented on Oct 3, 2017

    @asfimport
    Author

    Bryan Cutler / @BryanCutler:
    It's not difficult, just a good bit of work to add the ability to compare contents of vectors for all the types. Some of that is done in integration tests, but not for complex types. This would also need to add an API for equals() somewhere in the vector class hierarchy. So I wouldn't call it an easy fix either.

  4. asfimport commented on Jul 10, 2019

    @asfimport
    Author

    Ji Liu / @tianchen92:
    @BryanCutler Now for Struct and List type, getObject returns JsonStringHashMap and JsonStringArrayList which support hashCode & equals well, I think we could simply apply compare logic in Validator to Dicitionary#equals, and make some change to make it work (e.g. add a wrapper for byte[] get from BinaryVector, now Object.equals(byte[], byte[]) I think is not correct). In this way, we need not add API for equals. What do you think?

     

  5. asfimport commented on Jul 25, 2019

    @asfimport
    Author

    Bryan Cutler / @BryanCutler:
    Issue resolved by pull request 4843
    #4843

  6. added this to the 0.15.0 milestone on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions