Search in sources :

Example 6 with VectorMapJoinFastLongHashMap

use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.VectorMapJoinFastLongHashMap in project hive by apache.

the class TestVectorMapJoinFastLongHashMap method testMultipleKeysSingleValue.

@Test
public void testMultipleKeysSingleValue() throws Exception {
    random = new Random(900);
    VectorMapJoinFastLongHashMap map = new VectorMapJoinFastLongHashMap(false, false, HashTableKeyType.LONG, CAPACITY, LOAD_FACTOR, WB_SIZE, -1);
    VerifyFastLongHashMap verifyTable = new VerifyFastLongHashMap();
    int keyCount = 100 + random.nextInt(1000);
    for (int i = 0; i < keyCount; i++) {
        long key;
        while (true) {
            key = random.nextLong();
            if (!verifyTable.contains(key)) {
                // Unique keys for this test.
                break;
            }
        }
        byte[] value = new byte[random.nextInt(MAX_VALUE_LENGTH)];
        random.nextBytes(value);
        map.testPutRow(key, value);
        verifyTable.add(key, value);
    // verifyTable.verify(map);
    }
    verifyTable.verify(map);
}
Also used : VerifyFastLongHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastLongHashMap) Random(java.util.Random) VectorMapJoinFastLongHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.VectorMapJoinFastLongHashMap) Test(org.junit.Test)

Example 7 with VectorMapJoinFastLongHashMap

use of org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.VectorMapJoinFastLongHashMap in project hive by apache.

the class TestVectorMapJoinFastLongHashMap method testMultipleKeysMultipleValue.

@Test
public void testMultipleKeysMultipleValue() throws Exception {
    random = new Random(8);
    // Use a large capacity that doesn't require expansion, yet.
    VectorMapJoinFastLongHashMap map = new VectorMapJoinFastLongHashMap(false, false, HashTableKeyType.LONG, LARGE_CAPACITY, LOAD_FACTOR, LARGE_WB_SIZE, -1);
    VerifyFastLongHashMap verifyTable = new VerifyFastLongHashMap();
    int keyCount = 1000;
    addAndVerifyMultipleKeyMultipleValue(keyCount, map, verifyTable);
}
Also used : VerifyFastLongHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.CheckFastHashTable.VerifyFastLongHashMap) Random(java.util.Random) VectorMapJoinFastLongHashMap(org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast.VectorMapJoinFastLongHashMap) Test(org.junit.Test)

Aggregations

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