Package org.apache.flink.types

Examples of org.apache.flink.types.IntValue


        }
      }

      // emit a new record with the center id and the data point. add a one to ease the
      // implementation of the average function with a combiner
      result.setField(0, new IntValue(centerId));
      result.setField(1, p);
      result.setField(2, one);

      out.collect(result);
    }
View Full Code Here


        p.add(next.getField(1, Point.class));
        count += next.getField(2, IntValue.class).getValue();
      }
     
      next.setField(1, p);
      next.setField(2, new IntValue(count));
      return next;
    }
View Full Code Here

  public void map(Record dataPointRecord, Collector<Record> out) {
   
    CoordVector dataPoint = dataPointRecord.getField(1, CoordVector.class);
   
    for (Record clusterCenterRecord : this.clusterCenters) {
      IntValue clusterCenterId = clusterCenterRecord.getField(0, IntValue.class);
      CoordVector clusterPoint = clusterCenterRecord.getField(1, CoordVector.class);
   
      this.distance.setValue(dataPoint.computeEuclidianDistance(clusterPoint));
     
      // add cluster center id and distance to the data point record
View Full Code Here

        record = records2.next();
        keyString = record.getField(0, keyString);
        valueString = record.getField(1, valueString);
        sum -= Integer.parseInt(valueString.getValue());
      }
      record.setField(1, new IntValue(sum));
     
      out.collect(record);
    }
View Full Code Here

        }
      }

      // emit a new record with the center id and the data point. add a one to ease the
      // implementation of the average function with a combiner
      result.setField(0, new IntValue(centerId));
      result.setField(1, p);
      result.setField(2, one);

      out.collect(result);
    }
View Full Code Here

        p.add(next.getField(1, Point.class));
        count += next.getField(2, IntValue.class).getValue();
      }
     
      next.setField(1, p);
      next.setField(2, new IntValue(count));
      return next;
    }
View Full Code Here

      int boundVal = (int) ((bucketNum + 1) * bucketWidth);
      if (!this.ascendingI1) {
        boundVal = RANGE_I1 - boundVal;
      }

      return new Key[] { new IntValue(boundVal), new IntValue(RANGE_I2), new IntValue(RANGE_I3) };
    }
View Full Code Here

     
     
      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

  @Override
  public Record cross(Record dataPointRecord, Record clusterCenterRecord) throws Exception {

    CoordVector dataPoint = dataPointRecord.getField(1, CoordVector.class);

    IntValue clusterCenterId = clusterCenterRecord.getField(0, IntValue.class);
    CoordVector clusterPoint = clusterCenterRecord.getField(1, CoordVector.class);

    this.distance.setValue(dataPoint.computeEuclidianDistance(clusterPoint));

    // add cluster center id and distance to the data point record
View Full Code Here

  @Override
  public int serializeRecord(Record record, byte[] target) {
   
    line.setLength(0);
   
    IntValue centerId = record.getField(0, IntValue.class);
    CoordVector centerPos = record.getField(1, CoordVector.class);
   
   
    line.append(centerId.getValue());

    for (double coord : centerPos.getCoordinates()) {
      line.append('|');
      line.append(df.format(coord));
    }
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.