use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap in project hive by apache.
the class TestVectorMapJoinFastBytesHashMap method testGetNonExistent.
@Test
public void testGetNonExistent() throws Exception {
random = new Random(1002);
VectorMapJoinFastMultiKeyHashMap map = new VectorMapJoinFastMultiKeyHashMap(false, CAPACITY, LOAD_FACTOR, WB_SIZE, -1);
VerifyFastBytesHashMap verifyTable = new VerifyFastBytesHashMap();
byte[] key1 = new byte[random.nextInt(MAX_KEY_LENGTH)];
random.nextBytes(key1);
byte[] value = new byte[random.nextInt(MAX_VALUE_LENGTH)];
random.nextBytes(value);
map.testPutRow(key1, value);
verifyTable.add(key1, value);
verifyTable.verify(map);
byte[] key2 = new byte[random.nextInt(MAX_KEY_LENGTH)];
random.nextBytes(key2);
VectorMapJoinHashMapResult hashMapResult = map.createHashMapResult();
JoinUtil.JoinResult joinResult = map.lookup(key2, 0, key2.length, hashMapResult);
assertTrue(joinResult == JoinUtil.JoinResult.NOMATCH);
assertTrue(!hashMapResult.hasRows());
map.testPutRow(key2, value);
verifyTable.add(key2, value);
verifyTable.verify(map);
byte[] key3 = new byte[random.nextInt(MAX_KEY_LENGTH)];
random.nextBytes(key3);
hashMapResult = map.createHashMapResult();
joinResult = map.lookup(key3, 0, key3.length, hashMapResult);
assertTrue(joinResult == JoinUtil.JoinResult.NOMATCH);
assertTrue(!hashMapResult.hasRows());
}
use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap in project hive by apache.
the class TestVectorMapJoinFastBytesHashMap method testMultipleKeysMultipleValue.
@Test
public void testMultipleKeysMultipleValue() throws Exception {
random = new Random(9332);
// Use a large capacity that doesn't require expansion, yet.
VectorMapJoinFastMultiKeyHashMap map = new VectorMapJoinFastMultiKeyHashMap(false, LARGE_CAPACITY, LOAD_FACTOR, LARGE_WB_SIZE, -1);
VerifyFastBytesHashMap verifyTable = new VerifyFastBytesHashMap();
int keyCount = 1000;
addAndVerifyMultipleKeyMultipleValue(keyCount, map, verifyTable);
}
use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap in project hive by apache.
the class TestVectorMapJoinFastBytesHashMap method testReallyBig.
@Test
public void testReallyBig() throws Exception {
random = new Random(42662);
// Use a large capacity that doesn't require expansion, yet.
VectorMapJoinFastMultiKeyHashMap map = new VectorMapJoinFastMultiKeyHashMap(false, LARGE_CAPACITY, LOAD_FACTOR, MODERATE_WB_SIZE, -1);
VerifyFastBytesHashMap verifyTable = new VerifyFastBytesHashMap();
int keyCount = 1000000;
addAndVerifyMultipleKeyMultipleValue(keyCount, map, verifyTable);
}
use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap in project hive by apache.
the class TestVectorMapJoinFastBytesHashMap method testLargeAndExpand.
@Test
public void testLargeAndExpand() throws Exception {
random = new Random(21111);
// Use a large capacity that doesn't require expansion, yet.
VectorMapJoinFastMultiKeyHashMap map = new VectorMapJoinFastMultiKeyHashMap(false, MODERATE_CAPACITY, LOAD_FACTOR, MODERATE_WB_SIZE, -1);
VerifyFastBytesHashMap verifyTable = new VerifyFastBytesHashMap();
int keyCount = 1000;
addAndVerifyMultipleKeyMultipleValue(keyCount, map, verifyTable);
}
use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap in project hive by apache.
the class TestVectorMapJoinFastBytesHashMap method testOneKey.
@Test
public void testOneKey() throws Exception {
random = new Random(82733);
VectorMapJoinFastMultiKeyHashMap map = new VectorMapJoinFastMultiKeyHashMap(false, CAPACITY, LOAD_FACTOR, WB_SIZE, -1);
VerifyFastBytesHashMap verifyTable = new VerifyFastBytesHashMap();
byte[] key = new byte[random.nextInt(MAX_KEY_LENGTH)];
random.nextBytes(key);
byte[] value = new byte[random.nextInt(MAX_VALUE_LENGTH)];
random.nextBytes(value);
map.testPutRow(key, value);
verifyTable.add(key, value);
verifyTable.verify(map);
// Second value.
value = new byte[random.nextInt(MAX_VALUE_LENGTH)];
random.nextBytes(value);
map.testPutRow(key, value);
verifyTable.add(key, value);
verifyTable.verify(map);
// Third value.
value = new byte[random.nextInt(MAX_VALUE_LENGTH)];
random.nextBytes(value);
map.testPutRow(key, value);
verifyTable.add(key, value);
verifyTable.verify(map);
}
Aggregations