Package eu.stratosphere.types

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


    }
    if(hadoopType instanceof org.apache.hadoop.io.Text) {
      return new StringValue(((Text)hadoopType).toString());
    }
    if(hadoopType instanceof org.apache.hadoop.io.IntWritable) {
      return new IntValue(((IntWritable)hadoopType).get());
    }
    if(hadoopType instanceof org.apache.hadoop.io.FloatWritable) {
      return new FloatValue(((FloatWritable)hadoopType).get());
    }
    if(hadoopType instanceof org.apache.hadoop.io.DoubleWritable) {
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

        }
      }

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

  @Override
  public void cross(Record dataPointRecord, Record clusterCenterRecord, Collector<Record> out) {
   
    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

      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

    @Override
    public void map(Record record, Collector<Record> out) throws Exception {
      final int d1 = record.getField(2, IntValue.class).getValue();
      final int d2 = record.getField(3, IntValue.class).getValue();
      if (d1 > d2) {
        IntValue first = record.getField(1, IntValue.class);
        IntValue second = record.getField(0, IntValue.class);
        record.setField(0, first);
        record.setField(1, second);
      }
      record.setNumFields(2);
      out.collect(record);
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.