Search in sources :

Example 1 with VerifyFastBytesHashMap

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());
}
Also used : VerifyFastBytesHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap) JoinUtil(org.apache.hadoop.hive.ql.exec.JoinUtil) Random(java.util.Random) VectorMapJoinHashMapResult(org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinHashMapResult) Test(org.junit.Test)

Example 2 with VerifyFastBytesHashMap

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);
}
Also used : VerifyFastBytesHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap) Random(java.util.Random) Test(org.junit.Test)

Example 3 with VerifyFastBytesHashMap

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);
}
Also used : VerifyFastBytesHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap) Random(java.util.Random) Test(org.junit.Test)

Example 4 with VerifyFastBytesHashMap

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);
}
Also used : VerifyFastBytesHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap) Random(java.util.Random) Test(org.junit.Test)

Example 5 with VerifyFastBytesHashMap

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);
}
Also used : VerifyFastBytesHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap) Random(java.util.Random) Test(org.junit.Test)

Aggregations

Random (java.util.Random)8 VerifyFastBytesHashMap (org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastBytesHashMap)8 Test (org.junit.Test)8 JoinUtil (org.apache.hadoop.hive.ql.exec.JoinUtil)2 VectorMapJoinHashMapResult (org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinHashMapResult)2