Package eu.stratosphere.types

Examples of eu.stratosphere.types.IntValue


  {
    LineItemFilter out = new LineItemFilter();
   
    String shipDate = "1996-03-13";
    Tuple input = createInputTuple(shipDate);
    IntValue inputKey = new IntValue();
    Record rec = new Record();
    rec.setField(0, inputKey);
    rec.setField(1, input);
   
    Collector<Record> collector = new RecordOutputCollector(writerList);
View Full Code Here


    LineItemFilter out = new LineItemFilter();
   
    String shipDate = "1999-03-13";
   
    Tuple input = createInputTuple(shipDate);
    IntValue inputKey = new IntValue();
    Record rec = new Record();
    rec.setField(0, inputKey);
    rec.setField(1, input);
   
    Collector<Record> collector = new RecordOutputCollector(writerList);
View Full Code Here

  public void shouldNotThrowExceptionWhenNullTuple() throws Exception
  {
    LineItemFilter out = new LineItemFilter();
   
    Tuple input = null;
    IntValue inputKey = new IntValue();
    Record rec = new Record();
    rec.setField(0, inputKey);
    rec.setField(1, input);
   
   
View Full Code Here

    LineItemFilter out = new LineItemFilter();
   
    String shipDate = "foobarDate";
   
    Tuple input = createInputTuple(shipDate);
    IntValue inputKey = new IntValue();
    Record rec = new Record();
    rec.setField(0, inputKey);
    rec.setField(1, input);
   
    Collector<Record> collector = new RecordOutputCollector(writerList);
View Full Code Here

    input.addAttribute("" + 0.02);
    input.addAttribute(RETURN_FLAG);
    input.addAttribute("0");
    //the relevant column is missing now
   
    IntValue inputKey = new IntValue();
    Record rec = new Record();
    rec.setField(0, inputKey);
    rec.setField(1, input);
   
    Collector<Record> collector = new RecordOutputCollector(writerList);
View Full Code Here

      v2 = v2        | (0xFF & buf[4]);
      v2 = (v2 << 8) | (0xFF & buf[5]);
      v2 = (v2 << 8) | (0xFF & buf[6]);
      v2 = (v2 << 8) | (0xFF & buf[7]);
     
      reuse.setField(0,new IntValue(v1));
      reuse.setField(1,new IntValue(v2));
     
      this.cnt++;
     
      return reuse;
    }
View Full Code Here

    Assert.assertTrue(ti.isTupleType());
    Assert.assertEquals(StringValue.class, ((TupleTypeInfo<?>) ti).getTypeAt(0).getTypeClass());
    Assert.assertEquals(IntValue.class, ((TupleTypeInfo<?>) ti).getTypeAt(1).getTypeClass());

    // use getForObject()
    Tuple2<StringValue, IntValue> t = new Tuple2<StringValue, IntValue>(new StringValue("x"), new IntValue(1));
    TypeInformation<?> ti2 = TypeExtractor.getForObject(t);

    Assert.assertFalse(ti2.isBasicType());
    Assert.assertTrue(ti2.isTupleType());
    Assert.assertEquals(((TupleTypeInfo<?>) ti2).getTypeAt(0).getTypeClass(), StringValue.class);
View Full Code Here

     
      byte[] tupleBytes = testTuples[i].getBytes();
     
      inFormat.readRecord(rec, tupleBytes, 0, tupleBytes.length);
     
      Assert.assertTrue("Expected Key: "+expectedKeys[i]+" != Returned Key: "+rec.getField(0, IntValue.class), rec.getField(0, IntValue.class).equals(new IntValue(expectedKeys[i])));
      Assert.assertTrue("Expected Attr Cnt: "+expectedAttrCnt[i]+" != Returned Attr Cnt: "+rec.getField(1, Tuple.class), rec.getField(1, Tuple.class).getNumberOfColumns() == expectedAttrCnt[i]);
    }
  }
View Full Code Here

        LOG.debug("Processed: [" + keyString.toString() + "," + valueString.getValue() + "]");
     
      if (Integer.parseInt(keyString.toString()) + Integer.parseInt(valueString.toString()) < 10) {

        record.setField(0, valueString);
        record.setField(1, new IntValue(Integer.parseInt(keyString.toString()) + 10));
       
        out.collect(record);
      }
     
    }
View Full Code Here

      // get length of path
      minLength.setValue(pathRec.getField(2, IntValue.class).getValue());
      // store path and hop count
      path = new StringValue(pathRec.getField(4, StringValue.class));
      shortestPaths.add(path);
      hopCnts.put(path, new IntValue(pathRec.getField(3, IntValue.class).getValue()));
           
      // find shortest path of all input paths
      while (inputRecords.hasNext()) {
        pathRec = inputRecords.next();
        IntValue length = pathRec.getField(2, IntValue.class);
       
        if (length.getValue() == minLength.getValue()) {
          // path has also minimum length add to list
          path = new StringValue(pathRec.getField(4, StringValue.class));
          if(shortestPaths.add(path)) {
            hopCnts.put(path, new IntValue(pathRec.getField(3, IntValue.class).getValue()));
          }
        } else if (length.getValue() < minLength.getValue()) {
          // path has minimum length
          minLength.setValue(length.getValue());
          // clear lists
          hopCnts.clear();
          shortestPaths.clear();
          // get path and add path and hop count
          path = new StringValue(pathRec.getField(4, StringValue.class));
          shortestPaths.add(path);
          hopCnts.put(path, new IntValue(pathRec.getField(3, IntValue.class).getValue()));
        }
      }

      // find shortest path of all input and concatenated paths
      while (concatRecords.hasNext()) {
        pathRec = concatRecords.next();
        IntValue length = pathRec.getField(2, IntValue.class);
       
        if (length.getValue() == minLength.getValue()) {
          // path has also minimum length add to list
          path = new StringValue(pathRec.getField(4, StringValue.class));
          if(shortestPaths.add(path)) {
            hopCnts.put(path, new IntValue(pathRec.getField(3, IntValue.class).getValue()));
          }
        } else if (length.getValue() < minLength.getValue()) {
          // path has minimum length
          minLength.setValue(length.getValue());
          // clear lists
          hopCnts.clear();
          shortestPaths.clear();
          // get path and add path and hop count
          path = new StringValue(pathRec.getField(4, StringValue.class));
          shortestPaths.add(path);
          hopCnts.put(path, new IntValue(pathRec.getField(3, IntValue.class).getValue()));
        }
      }
     
      outputRecord.setField(0, fromNode);
      outputRecord.setField(1, toNode);
View Full Code Here

TOP

Related Classes of eu.stratosphere.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.