Package org.apache.flink.runtime.operators.testutils

Examples of org.apache.flink.runtime.operators.testutils.UniformStringPairGenerator


  @Test
  public void testVariableLengthStringBuildAndRetrieve() {
    try {
      final int NUM_MEM_PAGES = 40 * NUM_PAIRS / PAGE_SIZE;
     
      MutableObjectIterator<StringPair> buildInput = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
     
      MutableObjectIterator<StringPair> probeTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
     
      MutableObjectIterator<StringPair> updater = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

      MutableObjectIterator<StringPair> updateTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
     
      AbstractMutableHashTable<StringPair> table = new CompactingHashTable<StringPair>(serializerS, comparatorS, getMemory(NUM_MEM_PAGES, PAGE_SIZE));
      table.open();
     
      StringPair target = new StringPair();
      while(buildInput.next(target) != null) {
        table.insert(target);
      }

      AbstractHashTableProber<StringPair, StringPair> prober = table.getProber(comparatorS, pairComparatorS);
      StringPair temp = new StringPair();
      while(probeTester.next(target) != null) {
        assertNotNull("" + target.getKey(), prober.getMatchFor(target, temp));
        assertEquals(temp.getValue(), target.getValue());
      }
     
      while(updater.next(target) != null) {
        target.setValue(target.getValue());
        table.insertOrReplaceRecord(target, temp);
      }
     
      while (updateTester.next(target) != null) {
        assertNotNull(prober.getMatchFor(target, temp));
        assertEquals(target.getValue(), temp.getValue());
      }
     
      table.close();
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.operators.testutils.UniformStringPairGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.