Package eu.stratosphere.types

Examples of eu.stratosphere.types.LongValue


  private Random random;

  @Override
  public void open(Configuration parameters) {
    record = new Record();
    vertexID = new LongValue();
    partialRank = new DoubleValue();

    workerIndex = getRuntimeContext().getIndexOfThisSubtask();
    currentIteration = getIterationRuntimeContext().getSuperstepNumber();
    failingIteration = ConfigUtils.asInteger("compensation.failingIteration", parameters);
View Full Code Here


    long vertexID = Long.parseLong(tokens[0]);
    boolean isDangling = tokens.length > 1 && Integer.parseInt(tokens[1]) == 1;

    target.clear();
    target.addField(new LongValue(vertexID));
    target.addField(initialRank);
    target.addField(new BooleanValue(isDangling));

    return target;
  }
View Full Code Here

  }
 
  @Test
  public void testSerializationOfEventWithAggregateValues() {
    StringValue stringValue = new StringValue("test string");
    LongValue longValue = new LongValue(68743254);
   
    String stringValueName = "stringValue";
    String longValueName = "longValue";
   
    Aggregator<StringValue> stringAgg = new TestAggregator<StringValue>(stringValue);
View Full Code Here

      }
      return fl;
    case LONG:
      LongListValue ll = new LongListValue();
      for (Object item : avroList) {
        ll.add(new LongValue((Long) item));
      }
      return ll;
    default:
      throw new RuntimeException("Elements of type " + elementType + " are not supported for Avro arrays.");
    }
View Full Code Here

      }
      return fm;
    case LONG:
      LongMapValue lm = new LongMapValue();
      for (Map.Entry<CharSequence, ?> entry : avroMap.entrySet()) {
        lm.put(new StringValue((CharSequence) entry.getKey()), new LongValue((Long) entry.getValue()));
      }
      return lm;

    default:
      throw new RuntimeException("Map values of type " + mapValueType + " are not supported for Avro map.");
View Full Code Here

      break;
    case java.sql.Types.SMALLINT:
      record.setField(pos, new ShortValue(resultSet.getShort(pos + 1)));
      break;
    case java.sql.Types.BIGINT:
      record.setField(pos, new LongValue(resultSet.getLong(pos + 1)));
      break;
    case java.sql.Types.INTEGER:
      record.setField(pos, new IntValue(resultSet.getInt(pos + 1)));
      break;
    case java.sql.Types.FLOAT:
      record.setField(pos, new DoubleValue(resultSet.getDouble(pos + 1)));
      break;
    case java.sql.Types.REAL:
      record.setField(pos, new FloatValue(resultSet.getFloat(pos + 1)));
      break;
    case java.sql.Types.DOUBLE:
      record.setField(pos, new DoubleValue(resultSet.getDouble(pos + 1)));
      break;
    case java.sql.Types.DECIMAL:
      record.setField(pos, new DoubleValue(resultSet.getBigDecimal(pos + 1).doubleValue()));
      break;
    case java.sql.Types.NUMERIC:
      record.setField(pos, new DoubleValue(resultSet.getBigDecimal(pos + 1).doubleValue()));
      break;
    case java.sql.Types.DATE:
      record.setField(pos, new StringValue(resultSet.getDate(pos + 1).toString()));
      break;
    case java.sql.Types.TIME:
      record.setField(pos, new LongValue(resultSet.getTime(pos + 1).getTime()));
      break;
    case java.sql.Types.TIMESTAMP:
      record.setField(pos, new StringValue(resultSet.getTimestamp(pos + 1).toString()));
      break;
    case java.sql.Types.SQLXML:
View Full Code Here

    }

    @Override
    public Record nextRecord(Record record) throws IOException {
      touched = true;
      record.setField(0, new LongValue(26382648));

      if (isBook) {
        Book b = new Book(123, "This is a test book", 26382648);
        record.setField(1, new SBookAvroValue(b));
      } else {
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

    stratosphereRecord.setField(1, convert(hadoopValue));
  }
 
  protected Value convert(Object hadoopType) {
    if(hadoopType instanceof org.apache.hadoop.io.LongWritable ) {
      return new LongValue(((LongWritable)hadoopType).get());
    }
    if(hadoopType instanceof org.apache.hadoop.io.Text) {
      return new StringValue(((Text)hadoopType).toString());
    }
    if(hadoopType instanceof org.apache.hadoop.io.IntWritable) {
View Full Code Here

     
      double extendedPricePerTuple = Double.parseDouble(t.getStringValueAt(5));
      extendedPriceSum += extendedPricePerTuple;
    }
   
    LongValue pactQuantity = new LongValue(quantity);
    returnTuple.addAttribute("" + pactQuantity);
    returnTuple.addAttribute("" + extendedPriceSum);
   
    outRecord.setField(1, returnTuple);
    out.collect(outRecord);
View Full Code Here

TOP

Related Classes of eu.stratosphere.types.LongValue

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.