Package org.apache.flink.api.java.tuple

Examples of org.apache.flink.api.java.tuple.Tuple


    edgesUsed = true;
   
    outValue.f1 = m;
   
    while (edges.hasNext()) {
      Tuple next = (Tuple) edges.next();
      VertexKey k = next.getField(1);
      outValue.f0 = k;
      out.collect(outValue);
    }
  }
View Full Code Here


  private <X> TypeInformation<X> privateGetForObject(X value) {
    Validate.notNull(value);
   
    // check if we can extract the types from tuples, otherwise work with the class
    if (value instanceof Tuple) {
      Tuple t = (Tuple) value;
      int numFields = t.getArity();
      if(numFields != countFieldsInClass(value.getClass())) {
        // not a tuple since it has more fields.
        return analyzePojo((Class<X>) value.getClass(), new ArrayList<Type>(), null); // we immediately call analyze Pojo here, because
        // there is currently no other type that can handle such a class.
      }
     
      TypeInformation<?>[] infos = new TypeInformation[numFields];
      for (int i = 0; i < numFields; i++) {
        Object field = t.getField(i);
       
        if (field == null) {
          throw new InvalidTypesException("Automatic type extraction is not possible on candidates with null values. "
              + "Please specify the types directly.");
        }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public T reduce(T value1, T value2) throws Exception {
    if (isTuple) {
      Tuple t1 = (Tuple) value1;
      Tuple t2 = (Tuple) value2;

      compare(t1, t2);

      return (T) returnTuple;
    } else if (isArray) {
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public T reduce(T value1, T value2) throws Exception {
    if (isTuple) {
      Tuple tuple1 = (Tuple) value1;
      Tuple tuple2 = (Tuple) value2;

      returnTuple = tuple2;
      returnTuple.setField(add(tuple1.getField(position), tuple2.getField(position)),
          position);

      return (T) returnTuple;
    } else if (isArray) {
      Object v1 = Array.get(value1, position);
View Full Code Here

    if (expected.length != found.length) {
      Assert.assertEquals("Length of result is wrong", expected.length, found.length);
    }
   
    for (int i = 0; i < expected.length; i++) {
      Tuple v1 = (Tuple) expected[i];
      Tuple v2 = (Tuple) found[i];
     
      for (int k = 0; k < v1.getArity(); k++) {
        Object o1 = v1.getField(k);
        Object o2 = v2.getField(k);
        Assert.assertEquals(o1, o2);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.api.java.tuple.Tuple

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.