Package org.apache.flink.api.common.typeutils.record

Examples of org.apache.flink.api.common.typeutils.record.RecordComparator


        }
      }
    };
   
    final RecordSerializer serializer = RecordSerializer.get();
    @SuppressWarnings("unchecked")
    final RecordComparator comparator = new RecordComparator(new int[] {0}, new Class[] {IntValue.class});
   
    this.psi = new KeyGroupedIterator<Record>(this.sourceIter, serializer, comparator);
  }
View Full Code Here


        }
      }
    };
   
    final RecordSerializer serializer = RecordSerializer.get();
    @SuppressWarnings("unchecked")
    final RecordComparator comparator = new RecordComparator(new int[] {0}, new Class[] {IntValue.class});
   
    this.psi = new KeyGroupedIteratorImmutable<Record>(this.sourceIter, serializer, comparator);
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    final Class<? extends Key<?>>[] keyType = (Class<? extends Key<?>>[]) new Class[] { IntValue.class };
   
    this.recordBuildSideAccesssor = RecordSerializer.get();
    this.recordProbeSideAccesssor = RecordSerializer.get();
    this.recordBuildSideComparator = new RecordComparator(keyPos, keyType);
    this.recordProbeSideComparator = new RecordComparator(keyPos, keyType);
    this.pactRecordComparator = new RecordPairComparatorFirstInt();
   
    this.pairBuildSideAccesssor = new IntPairSerializer();
    this.pairProbeSideAccesssor = new IntPairSerializer();
    this.pairBuildSideComparator = new IntPairComparator();
View Full Code Here

  public void beforeTest() {
    this.memoryManager = new DefaultMemoryManager(MEMORY_SIZE, 1);
    this.ioManager = new IOManager();
   
    this.pactRecordSerializer = RecordSerializerFactory.get();
    this.pactRecordComparator = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
  }
View Full Code Here

  @Before
  public void beforeTest()
  {
    this.serializer1 = RecordSerializer.get();
    this.serializer2 = RecordSerializer.get();
    this.comparator1 = new RecordComparator(new int[] {0}, new Class[]{TestData.Key.class});
    this.comparator2 = new RecordComparator(new int[] {0}, new Class[]{TestData.Key.class});
    this.pairComparator = new RecordPairComparator(new int[] {0}, new int[] {0}, new Class[]{TestData.Key.class});
   
    this.memoryManager = new DefaultMemoryManager(MEMORY_SIZE, 1);
    this.ioManager = new IOManager();
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Before
  public void beforeTest() {
    this.serializer1 = RecordSerializerFactory.get();
    this.serializer2 = RecordSerializerFactory.get();
    this.comparator1 = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
    this.comparator2 = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
    this.pairComparator11 = new RecordPairComparator(new int[] {0}, new int[] {0}, new Class[] {TestData.Key.class});
   
    this.memoryManager = new DefaultMemoryManager(MEMORY_SIZE, PAGE_SIZE);
    this.ioManager = new IOManager();
  }
View Full Code Here

  @Before
  public void beforeTest()
  {
    this.recordSerializer = RecordSerializer.get();
   
    this.record1Comparator = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
    this.record2Comparator = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
    this.recordPairComparator = new RecordPairComparator(new int[] {0}, new int[] {0}, new Class[] {TestData.Key.class});
   
   
    final int[] keyPos = new int[] {0};
    final Class<? extends Key>[] keyType = (Class<? extends Key>[]) new Class[] { IntValue.class };
   
    this.recordBuildSideAccesssor = RecordSerializer.get();
    this.recordProbeSideAccesssor = RecordSerializer.get();
    this.recordBuildSideComparator = new RecordComparator(keyPos, keyType);
    this.recordProbeSideComparator = new RecordComparator(keyPos, keyType);
    this.pactRecordComparator = new HashTableITCase.RecordPairComparatorFirstInt();
   
    this.memoryManager = new DefaultMemoryManager(MEMORY_SIZE,1, PAGE_SIZE);
    this.ioManager = new IOManager();
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Before
  public void beforeTest() {
    this.recordSerializer = RecordSerializer.get();
   
    this.record1Comparator = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
    this.record2Comparator = new RecordComparator(new int[] {0}, new Class[] {TestData.Key.class});
   
    this.recordPairComparator = new RecordPairComparator(new int[] {0}, new int[] {0}, new Class[] {TestData.Key.class});
   
    this.pairSerializer = new IntPairSerializer();
    this.pairComparator = new IntPairComparator();
View Full Code Here

  private static final long SEED = 485213591485399L;
 
  @Test
  public void testPartitionHash() {
    // Test for IntValue
    @SuppressWarnings("unchecked")
    final RecordComparator intComp = new RecordComparator(new int[] {0}, new Class[] {IntValue.class});
    final ChannelSelector<Record> oe1 = new RecordOutputEmitter(ShipStrategyType.PARTITION_HASH, intComp);

    int numChans = 100;
    int numRecs = 50000;
    int[] hit = new int[numChans];

    for (int i = 0; i < numRecs; i++) {
      IntValue k = new IntValue(i);
      Record rec = new Record(k);
     
      int[] chans = oe1.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
      }
    }

    int cnt = 0;
    for (int i = 0; i < hit.length; i++) {
      assertTrue(hit[i] > 0);
      cnt += hit[i];
    }
    assertTrue(cnt == numRecs);

    // Test for StringValue
    @SuppressWarnings("unchecked")
    final RecordComparator stringComp = new RecordComparator(new int[] {0}, new Class[] {StringValue.class});
    ChannelSelector<Record> oe2 = new RecordOutputEmitter(ShipStrategyType.PARTITION_HASH, stringComp);

    numChans = 100;
    numRecs = 10000;
   
View Full Code Here

  }
 
  @Test
  public void testForward() {
    // Test for IntValue
    @SuppressWarnings("unchecked")
    final RecordComparator intComp = new RecordComparator(new int[] {0}, new Class[] {IntValue.class});
    final ChannelSelector<Record> oe1 = new RecordOutputEmitter(ShipStrategyType.FORWARD, intComp);

    int numChannels = 100;
    int numRecords = 50000;
   
    int[] hit = new int[numChannels];

    for (int i = 0; i < numRecords; i++) {
      IntValue k = new IntValue(i);
      Record rec = new Record(k);
     
      int[] chans = oe1.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
      }
    }

    int cnt = 0;
    for (int i = 0; i < hit.length; i++) {
      assertTrue(hit[i] == (numRecords/numChannels) || hit[i] == (numRecords/numChannels)-1);
      cnt += hit[i];
    }
    assertTrue(cnt == numRecords);

    // Test for StringValue
    @SuppressWarnings("unchecked")
    final RecordComparator stringComp = new RecordComparator(new int[] {0}, new Class[] {StringValue.class});
    final ChannelSelector<Record> oe2 = new RecordOutputEmitter(ShipStrategyType.FORWARD, stringComp);

    numChannels = 100;
    numRecords = 10000;
   
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.typeutils.record.RecordComparator

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.