Package org.apache.flink.types

Examples of org.apache.flink.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

 
  private final Value[] createLongValues(int num) {
    Value[] v = new Value[num];
   
    for (int i = 0; i < num; i++) {
      v[i] = new LongValue();
    }
   
    return v;
  }
View Full Code Here

          ConnectedComponentsWithAggregatorProgram.ELEMENTS_IN_COMPONENT);

      int superstep = getIterationRuntimeContext().getSuperstepNumber();

      if (superstep > 1) {
        LongValue val = getIterationRuntimeContext().getPreviousIterationAggregate(
            ConnectedComponentsWithAggregatorProgram.ELEMENTS_IN_COMPONENT);
        ConnectedComponentsWithAggregatorProgram.aggr_value[superstep-2] = val.getValue();
      }
    }
View Full Code Here

    flinkRecord.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

      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

     
      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

  @Override
  protected LongValue[] getTestData() {
    Random rnd = new Random(874597969123412341L);
    long rndLong = rnd.nextLong();
   
    return new LongValue[] {new LongValue(0L), new LongValue(1L), new LongValue(-1L),
              new LongValue(Long.MAX_VALUE), new LongValue(Long.MIN_VALUE),
              new LongValue(rndLong), new LongValue(-rndLong)};
  }
View Full Code Here

    try {
      final Value[][] values = new Value[][] {
        // empty
        {},
        // exactly 8 fields
        {new IntValue(55), new StringValue("Hi there!"), new LongValue(457354357357135L), new IntValue(345), new IntValue(-468), new StringValue("This is the message and the message is this!"), new LongValue(0L), new IntValue(465)},
        // exactly 16 fields
        {new IntValue(55), new StringValue("Hi there!"), new LongValue(457354357357135L), new IntValue(345), new IntValue(-468), new StringValue("This is the message and the message is this!"), new LongValue(0L), new IntValue(465), new IntValue(55), new StringValue("Hi there!"), new LongValue(457354357357135L), new IntValue(345), new IntValue(-468), new StringValue("This is the message and the message is this!"), new LongValue(0L), new IntValue(465)},
        // exactly 8 nulls
        {null, null, null, null, null, null, null, null},
        // exactly 16 nulls
        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
        // arbitrary example
View Full Code Here

      switch (type) {
      case 0:
        values[i] = new IntValue(rnd.nextInt());
        break;
      case 1:
        values[i] = new LongValue(rnd.nextLong());
        break;
      case 2:
        values[i] = new DoubleValue(rnd.nextDouble());
        break;
      case 3:
View Full Code Here

TOP

Related Classes of org.apache.flink.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.