Package org.apache.flink.types

Examples of org.apache.flink.types.IntValue


      String line = record.getField(0, StringValue.class).getValue();
      String [] element = line.split(" ");
      String word = element[0];
      int count = Integer.parseInt(element[1]);
      if (stringList.contains(word)) {
        collector.collect(new Record(new StringValue(word), new IntValue(count)));
      }
    }
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

  {
    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

    public void reduce(Iterator<Record> records, Collector<Record> out) {
     
      Record next = records.next();
     
      // Increments the first field of the first record of the reduce group by 100 and emit it
      IntValue incrVal = next.getField(0, IntValue.class);
      incrVal.setValue(incrVal.getValue() + 100);
      next.setField(0, incrVal);
      out.collect(next);
     
      // emit all remaining records
      while (records.hasNext()) {
View Full Code Here

      double epsilon = 0.05;
      double criterion = rank.getValue() - newRank.getValue();
     
      if(Math.abs(criterion) > epsilon)
      {
        record.setField(0, new IntValue(1));
        out.collect(record);
      }
    }
View Full Code Here

    boundaries = new IntValue[len][];
   
    for (int i = 0; i < len; i++) {
      IntValue[] bucket = new IntValue[dim];
      for (int d = 0; d < dim; d++) {
        bucket[d] = new IntValue(in.readInt());
      }
     
      boundaries[i] = bucket;
    }
  }
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.