Package org.apache.flink.types

Examples of org.apache.flink.types.IntValue


      // Key 1, Value A
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(1))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 1, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("A"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
     
      // Key 2, Value B
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(2))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 2, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("B"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
     
      // Key 3, Values C, D
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("C"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("D"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
      catch (NoSuchElementException nseex) {}
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
      catch (NoSuchElementException nseex) {}
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Key 4, Values E, F, G
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("E"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("F"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("G"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Key 5, Values H, I, J, K, L
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("H"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("I"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("J"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("K"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("L"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
      catch (NoSuchElementException nseex) {}
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
View Full Code Here


      // Progression first though haNext() and next(), then through hasNext() - Key 3, Values C, D
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("C"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Progression first via next() only, then hasNext() only Key 4, Values E, F, G
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("E"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
     
      // Key 5, Values H, I, J, K, L
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("H"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("I"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue(hasIterator(this.psi.getValues()));
      Assert.assertFalse(hasIterator(this.psi.getValues()));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
View Full Code Here

      int c = sc1.getField(3, IntValue.class).getValue();

      int p_x = p(x, a, b, c);
      int p_y = p(y, a, b, c);
      int min = Math.min(p_x, p_y);
      out.collect(new Record(jn1.getField(0, StringValue.class), new IntValue(min)));
    }
View Full Code Here

  public void setup()
  {
    final ArrayList<IntStringPair> source = new ArrayList<IntStringPair>();
   
    // add elements to the source
    source.add(new IntStringPair(new IntValue(1), new StringValue("A")));
    source.add(new IntStringPair(new IntValue(2), new StringValue("B")));
    source.add(new IntStringPair(new IntValue(3), new StringValue("C")));
    source.add(new IntStringPair(new IntValue(3), new StringValue("D")));
    source.add(new IntStringPair(new IntValue(4), new StringValue("E")));
    source.add(new IntStringPair(new IntValue(4), new StringValue("F")));
    source.add(new IntStringPair(new IntValue(4), new StringValue("G")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("H")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("I")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("J")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("K")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("L")));
   
   
    this.sourceIter = new MutableObjectIterator<Record>() {
      final Iterator<IntStringPair> it = source.iterator();
     
View Full Code Here

  @Test
  public void testNextKeyOnly() throws Exception
  {
    try {
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(1))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 1, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(2))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 2, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      Assert.assertFalse("KeyGroupedIterator must not have another key.", this.psi.nextKey());
      Assert.assertNull("KeyGroupedIterator must not have another value.", this.psi.getValues());
     
View Full Code Here

  {
    try {
      // Key 1, Value A
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(1))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 1, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("A"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 1, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Key 2, Value B
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(2))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 2, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("B"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 2, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Key 3, Values C, D
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("C"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("D"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
      catch (NoSuchElementException nseex) {}
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
      catch (NoSuchElementException nseex) {}
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Key 4, Values E, F, G
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("E"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("F"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("G"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(4))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 4, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Key 5, Values H, I, J, K, L
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("H"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("I"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("J"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("K"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("L"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
      catch (NoSuchElementException nseex) {}
      Assert.assertFalse("KeyGroupedIterator must not have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      try {
        this.psi.getValues().next();
        Assert.fail("A new KeyGroupedIterator must not have any value available and hence throw an exception on next().");
      }
View Full Code Here

      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
     
      // Progression first though haNext() and next(), then through hasNext() - Key 3, Values C, D
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("C"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(3))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 3, this.psi.getCurrent().getField(0, IntValue.class).getValue());
     
      // Progression first via next() only, then hasNext() only Key 4, Values E, F, G
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("E"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
     
      // Key 5, Values H, I, J, K, L
      Assert.assertTrue("KeyGroupedIterator must have another key.", this.psi.nextKey());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("H"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
      Assert.assertTrue("KeyGroupedIterator returned a wrong key.", this.psi.getComparatorWithCurrentReference().equalToReference(new Record(new IntValue(5))));
      Assert.assertEquals("KeyGroupedIterator returned a wrong key.", 5, this.psi.getCurrent().getField(0, IntValue.class).getValue());
      Assert.assertEquals("KeyGroupedIterator returned a wrong value.", new StringValue("I"), this.psi.getValues().next().getField(1, StringValue.class));
      Assert.assertTrue("KeyGroupedIterator must have another value.", this.psi.getValues().hasNext());
     
      // end
View Full Code Here

  /**
   * Returns the record to write at the given position
   */
  protected Record getRecord(int index) {
    return new Record(new IntValue(index), new StringValue(String.valueOf(index)));
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    final RecordComparator intComp = new RecordComparator(new int[] {0}, new Class[] {IntValue.class});
    final ChannelSelector<Record> oe1 = new RecordOutputEmitter(ShipStrategyType.PARTITION_HASH, intComp);

    Record rec = new Record(2);
    rec.setField(1, new IntValue(1));

    try {
      oe1.selectChannels(rec, 100);
    } catch (NullKeyFieldException re) {
      Assert.assertEquals(0, re.getFieldNumber());
View Full Code Here

   
    try {
      out = new DataOutputStream(new PipedOutputStream(pipedInput));
     
      rec = new Record(1);
      rec.setField(0, new IntValue());
     
      rec.write(new OutputViewDataOutputStreamWrapper(out));
      rec = new Record();
      rec.read(new InputViewDataInputStreamWrapper(in));
   
View Full Code Here

TOP

Related Classes of org.apache.flink.types.IntValue

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.