Examples of IntValue


Examples of org.apache.flink.types.IntValue

  public void map(Record record, Collector<Record> out) throws Exception {
    suppKey = record.getField(0, suppKey);
    inputTuple = record.getField(1, inputTuple);
   
    /* Project (suppkey | name, address, nationkey, phone, acctbal, comment): */
    IntValue nationKey = new IntValue(Integer.parseInt(inputTuple.getStringValueAt(3)));
   
    record.setField(0, nationKey);
    record.setField(1, suppKey);
   
    out.collect(record);
View Full Code Here

Examples of org.apache.flink.types.IntValue

  public void join(Record value1, Record value2, Collector<Record> out) throws Exception
  {
    StringIntPair amountYearPair = value1.getField(1, this.amountYearPair);
    StringValue nationName = value2.getField(1, this.nationName);
   
    IntValue year = amountYearPair.getSecond();
    StringValue amount = amountYearPair.getFirst();
    StringIntPair key = new StringIntPair(nationName, year);
    value1.setField(0, key);
    value1.setField(1, amount);
    out.collect(value1);
View Full Code Here

Examples of org.apache.flink.types.IntValue

  @Override
  public IntValue[] getBucketBoundary(int bucketNum, int totalNumBuckets) {
    long diff = ((long) max) - ((long) min) + 1;
    double bucketSize = diff / ((double) totalNumBuckets);
    return new IntValue[] {new IntValue(min + (int) ((bucketNum+1) * bucketSize)) };
  }
View Full Code Here

Examples of org.apache.flink.types.IntValue

     
      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

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

Examples of org.apache.flink.types.IntValue

      // 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

Examples of org.apache.flink.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

Examples of org.apache.flink.types.IntValue

    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

Examples of org.apache.flink.types.IntValue

  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

Examples of org.apache.flink.types.IntValue

    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
TOP
Copyright © 2018 www.massapi.com. 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.