[
https://issues.apache.org/jira/browse/HIVE-13953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15317062#comment-15317062
]
Yongzhi Chen edited comment on HIVE-13953 at 6/6/16 8:18 PM:
-------------------------------------------------------------
The fix looks good,
+1 pending the testing.
http://introcs.cs.princeton.edu/java/11precedence/
was (Author: ychena):
The fix looks good,
+1 pending the testing.
> Issues in HiveLockObject equals method
> --------------------------------------
>
> Key: HIVE-13953
> URL: https://issues.apache.org/jira/browse/HIVE-13953
> Project: Hive
> Issue Type: Bug
> Components: Locking
> Reporter: Chaoyu Tang
> Assignee: Chaoyu Tang
> Attachments: HIVE-13953.patch
>
>
> There are two issues in equals method in HiveLockObject:
> {code}
> @Override
> public boolean equals(Object o) {
> if (!(o instanceof HiveLockObject)) {
> return false;
> }
> HiveLockObject tgt = (HiveLockObject) o;
> return Arrays.equals(pathNames, tgt.pathNames) &&
> data == null ? tgt.getData() == null :
> tgt.getData() != null && data.equals(tgt.getData());
> }
> {code}
> 1. Arrays.equals(pathNames, tgt.pathNames) might return false for the same
> path in HiveLockObject since in current Hive, the pathname components might
> be stored in two ways, taking a dynamic partition path db/tbl/part1/part2 as
> an example, it might be stored in the pathNames as an array of four elements,
> db, tbl, part1, and part2 or as an array only having one element
> db/tbl/part1/part2. It will be safer to comparing the pathNames using
> StringUtils.equals(this.getName(), tgt.getName())
> 2. The comparison logic is not right.
> {code}
> @Override
> public boolean equals(Object o) {
> if (!(o instanceof HiveLockObject)) {
> return false;
> }
> HiveLockObject tgt = (HiveLockObject) o;
> return StringUtils.equals(this.getName(), tgt.getName()) &&
> (data == null ? tgt.getData() == null : data.equals(tgt.getData()));
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)