Package eu.stratosphere.types

Examples of eu.stratosphere.types.StringValue


    numRecs = 10000;
   
    hit = new int[numChans];

    for (int i = 0; i < numRecs; i++) {
      StringValue k = new StringValue(i + "");
      Record rec = new Record(k);
       
      int[] chans = oe2.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
View Full Code Here


    numRecords = 10000;
   
    hit = new int[numChannels];

    for (int i = 0; i < numRecords; i++) {
      StringValue k = new StringValue(i + "");
      Record rec = new Record(k);
       
      int[] chans = oe2.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
View Full Code Here

    numRecords = 5000;
   
    hit = new int[numChannels];

    for (int i = 0; i < numRecords; i++) {
      StringValue k = new StringValue(i + "");
      Record rec = new Record(k);
       
      int[] chans = oe2.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
View Full Code Here

    int[] hit = new int[numChannels];

    for (int i = 0; i < numRecords; i++) {
      Record rec = new Record(4);
      rec.setField(0, new IntValue(i));
      rec.setField(1, new StringValue("AB"+i+"CD"+i));
      rec.setField(3, new DoubleValue(i*3.141d));
     
      int[] chans = oe1.selectChannels(rec, hit.length);
      for(int j=0; j < chans.length; j++) {
        hit[chans[j]]++;
View Full Code Here

  }
 
  public static List<Tuple2<StringValue, IntValue>> createReduceMutableData() {
    List<Tuple2<StringValue, IntValue>> data = new ArrayList<Tuple2<StringValue, IntValue>>();
   
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("a"), new IntValue(1)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("b"), new IntValue(2)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("c"), new IntValue(3)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("d"), new IntValue(4)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("d"), new IntValue(5)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("e"), new IntValue(6)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("e"), new IntValue(7)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("e"), new IntValue(8)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(9)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(10)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(11)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("f"), new IntValue(12)));
   
    return data;
  }
View Full Code Here

  }
 
  public static List<Tuple2<StringValue, IntValue>> createReduceMutableDataGroupedResult() {
    List<Tuple2<StringValue, IntValue>> data = new ArrayList<Tuple2<StringValue, IntValue>>();
   
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("a"), new IntValue(1)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("b"), new IntValue(2)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("c"), new IntValue(3)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("dd"), new IntValue(9)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("eee"), new IntValue(21)));
    data.add(new Tuple2<StringValue, IntValue>(new StringValue("ffff"), new IntValue(42)));
   
    return data;
  }
View Full Code Here

    Record record = null;
    float amount = 0;

    while (records.hasNext()) {
      record = records.next();
      StringValue value = record.getField(1, StringValue.class);
      amount += Float.parseFloat(value.toString());
    }

    value.setValue(String.valueOf(amount));
    record.setField(1, value);
    out.collect(record);
  }
View Full Code Here

   */
  @Override
  public void join(Record value1, Record value2, Collector<Record> out)
      throws Exception {
    IntPair partAndSupplierKey = value1.getField(0, this.partAndSupplierKey);
    StringValue supplyCostStr = value1.getField(1, this.supplyCostStr);
    Tuple ordersValue = value2.getField(1, this.ordersValue);
   
    IntValue year = new IntValue(Integer.parseInt(ordersValue.getStringValueAt(0)));
    float quantity = Float.parseFloat(ordersValue.getStringValueAt(1));
    float price = Float.parseFloat(ordersValue.getStringValueAt(2));
    float supplyCost = Float.parseFloat(supplyCostStr.toString());
    float amount = price - supplyCost * quantity;
   
    /* Push (supplierKey, (amount, year)): */
    value1.setField(0, partAndSupplierKey.getSecond());
    value1.setField(1, new StringIntPair(new StringValue("" + amount), year));
    out.collect(value1);
  }
View Full Code Here

   
    IntPair newKey = new IntPair(partKey, new IntValue(Integer.parseInt(partSuppValue.getStringValueAt(0))));
    String supplyCost = partSuppValue.getStringValueAt(1);
   
    value1.setField(0, newKey);
    value1.setField(1, new StringValue(supplyCost));
    out.collect(value1);
   
  }
View Full Code Here

  public void join(Record value1, Record value2, Collector<Record> out)
      throws Exception {
    suppKey = value1.getField(1, suppKey);
    nationVal = value2.getField(1, nationVal);
   
    StringValue nationName = new StringValue(nationVal.getStringValueAt(1));
   
    value1.setField(0, suppKey);
    value1.setField(1, nationName);
   
    out.collect(value1);
View Full Code Here

TOP

Related Classes of eu.stratosphere.types.StringValue

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.