Package eu.stratosphere.types

Examples of eu.stratosphere.types.StringValue


      Assert.assertEquals("Field 2 should be String", StringValue.class, record.getField(2, StringValue.class).getClass());
      Assert.assertEquals("Field 3 should be float", DoubleValue.class, record.getField(3, DoubleValue.class).getClass());
      Assert.assertEquals("Field 4 should be int", IntValue.class, record.getField(4, IntValue.class).getClass());

      int[] pos = {0, 1, 2, 3, 4};
      Value[] values = {new IntValue(), new StringValue(), new StringValue(), new DoubleValue(), new IntValue()};
      Assert.assertTrue(record.equalsFields(pos, dbData[recordCount], values));

      recordCount++;
    }
    Assert.assertEquals(5, recordCount);
View Full Code Here


      StringTokenizer tokenizer = new StringTokenizer(line);
      while (tokenizer.hasMoreTokens()) {
        String word = tokenizer.nextToken();

        // we emit a (word, 1) pair
        collector.collect(new Record(new StringValue(word), new IntValue(1)));
      }
    }
View Full Code Here

    }
  }
 
  @SuppressWarnings("unchecked")
  private static final DataSet<Tuple3<Double, StringValue, LongValue>> getSourceDataSet(ExecutionEnvironment env) {
    return env.fromElements(new Tuple3<Double, StringValue, LongValue>(3.141592, new StringValue("foobar"), new LongValue(77)))
        .setParallelism(1);
  }
View Full Code Here

      StringTokenizer tokenizer = new StringTokenizer(line);
      while (tokenizer.hasMoreTokens()) {
        String word = tokenizer.nextToken();
       
        // we emit a (word, 1) pair
        collector.collect(new Record(new StringValue(word), new IntValue(1)));
      }
    }
View Full Code Here

      final int DOP = 8;
      ExecutionEnvironment env = ExecutionEnvironment.createLocalEnvironment(DOP);
     
      @SuppressWarnings("unchecked")
      DataSet<Tuple3<Double, StringValue, Long>> initialData =
          env.fromElements(new Tuple3<Double, StringValue, Long>(3.141592, new StringValue("foobar"), new Long(77)));
     
      initialData.groupBy(0).aggregate(Aggregations.MIN, 1).and(Aggregations.SUM, 2).print();
     
      Plan p = env.createProgramPlan();
     
View Full Code Here

   
    @Override
    public void map(Record record, Collector<Record> collector) {
      this.cntNumLines.add(1);
     
      StringValue line = record.getField(0, StringValue.class);
      SimpleStringUtils.replaceNonWordChars(line, ' ');
      SimpleStringUtils.toLowerCase(line);
      this.tokenizer.setStringToTokenize(line);
      int wordsPerLine = 0;
      this.word = new StringValue();
      while (tokenizer.next(this.word))
      {
        // Use custom counter
        distinctWords.add(new StringRecord(this.word.getValue()));
 
View Full Code Here

    private final IntValue integer = new IntValue();

    @Override
    public void map(Record record, Collector<Record> out) throws Exception {
     
      final StringValue keyString = record.getField(0, this.string);
      final int key = Integer.parseInt(keyString.toString());
     
      final StringValue valueString = record.getField(1, this.string);
      final int value = Integer.parseInt(valueString.toString());
     
      if (key + value < 10) {
        record.setField(0, valueString);
        this.integer.setValue(key + 10);
        record.setField(1, this.integer);
View Full Code Here

      while (it.hasNext()) {
        Integer value = Integer.parseInt(it.next().getField(0, StringValue.class).getValue());
        sum += value;
        testCounter.add(value);
      }
      out.collect(new Record(new StringValue(Integer.toString(sum))));
    }
View Full Code Here

      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

      }
     
      Record r = new Record(2);
     
      try {
        r.setField(0, new StringValue("Hello World"));
        r.setField(1, new IntValue(42));
        format.writeRecord(r);
       
        r.setField(0, new StringValue("AbCdE"));
        r.setField(1, new IntValue(13));
        format.writeRecord(r);
       
        format.close();
       
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.