You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Java] Dictionary.equals is not working correctly #16895
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.
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.
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.
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?
Activity
asfimport commentedon Jul 4, 2017
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.
asfimport commentedon Oct 2, 2017
Wes McKinney / @wesm:
Is this easy to fix?
asfimport commentedon Oct 3, 2017
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.asfimport commentedon Jul 10, 2019
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?
asfimport commentedon Jul 25, 2019
Bryan Cutler / @BryanCutler:
Issue resolved by pull request 4843
#4843