Skip to content

Commit ea6375e

Browse files
elharosdruzkin
authored andcommitted
Fix hashcode bug
1 parent 152f962 commit ea6375e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/HiveBloomFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public boolean equals(Object o)
6767
@Override
6868
public int hashCode()
6969
{
70-
return Objects.hash(numBits, numHashFunctions, bitSet.getData());
70+
return Objects.hash(numBits, numHashFunctions, Arrays.hashCode(bitSet.getData()));
7171
}
7272

7373
@Override
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package com.facebook.presto.orc.metadata.statistics;
15+
16+
import com.google.common.collect.ImmutableList;
17+
import org.testng.annotations.Test;
18+
19+
import java.util.List;
20+
21+
import static org.testng.Assert.assertEquals;
22+
23+
public class TestHiveBloomFilter
24+
{
25+
@Test
26+
public void testHashCode()
27+
{
28+
List<Long> bitset1 = ImmutableList.of(2L);
29+
List<Long> bitset2 = ImmutableList.of(2L);
30+
HiveBloomFilter filter1 = new HiveBloomFilter(bitset1, 1, 1);
31+
HiveBloomFilter filter2 = new HiveBloomFilter(bitset2, 1, 1);
32+
assertEquals(filter1, filter2);
33+
assertEquals(filter1.hashCode(), filter2.hashCode());
34+
}
35+
}

0 commit comments

Comments
 (0)