Examples of SingleInputSemanticProperties


Examples of eu.stratosphere.api.common.operators.SingleInputSemanticProperties

    {
      String[] readFields = { "1,2" };
 
      TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
          BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
      SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingleFromString(null, null, readFields, type, type);
 
      FieldSet fs = sp.getReadFields();
      Assert.assertTrue(fs.size() == 2);
      Assert.assertTrue(fs.contains(2));
      Assert.assertTrue(fs.contains(1));
    }
   
    // with spaces
    {
      String[] readFields = { "  1  , 2   " };
     
      TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
          BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
      SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingleFromString(null, null, readFields, type, type);
 
      FieldSet fs = sp.getReadFields();
      Assert.assertTrue(fs.size() == 2);
      Assert.assertTrue(fs.contains(2));
      Assert.assertTrue(fs.contains(1));
    }
  }
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

  private static final Pattern PATTERN_LIST = Pattern.compile(REGEX_LIST);

  private static final Pattern PATTERN_DIGIT = Pattern.compile("\\d+");

  public static SingleInputSemanticProperties createProjectionPropertiesSingle(int[] fields) {
    SingleInputSemanticProperties ssp = new SingleInputSemanticProperties();
    for (int i = 0; i < fields.length; i++) {
      ssp.addForwardedField(fields[i], i);
    }
    return ssp;
  }
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

  public static SingleInputSemanticProperties getSemanticPropsSingle(Set<Annotation> set, TypeInformation<?> inType, TypeInformation<?> outType) {
    if (set == null) {
      return null;
    }
    Iterator<Annotation> it = set.iterator();
    SingleInputSemanticProperties result = null;

    //non tuple types are not yet supported for annotations
    if (!inType.isTupleType() || !outType.isTupleType()) {
      return null;
    }

    while (it.hasNext()) {
      if (result == null) {
        result = new SingleInputSemanticProperties();
      }

      Annotation ann = it.next();

      if (ann instanceof ConstantFields) {
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

      }
    }
  }

  public static SingleInputSemanticProperties getSemanticPropsSingleFromString(String[] constantSet, String[] constantSetExcept, String[] readSet, TypeInformation<?> inType, TypeInformation<?> outType) {
    SingleInputSemanticProperties result = new SingleInputSemanticProperties();
    parseConstantFields(constantSet, result, inType, outType);
    parseConstantFieldsExcept(constantSetExcept, result, inType, outType);
    parseReadFields(readSet, result, inType, outType);
    return result;
  }
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

      // set input
      po.setInput(input);
      // set dop
      po.setDegreeOfParallelism(this.getParallelism());
     
      SingleInputSemanticProperties props = new SingleInputSemanticProperties();
     
      for (int i = 0; i < logicalKeyPositions.length; i++) {
        int keyField = logicalKeyPositions[i];
        boolean keyFieldUsedInAgg = false;
       
        for (int k = 0; k < fields.length; k++) {
          int aggField = fields[k];
          if (keyField == aggField) {
            keyFieldUsedInAgg = true;
            break;
          }
        }
       
        if (!keyFieldUsedInAgg) {
          props.addForwardedField(keyField, keyField);
        }
      }
     
      po.setSemanticProperties(props);
     
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

    if (input != 0) {
      throw new IndexOutOfBoundsException();
    }
   
    SingleInputOperator<?, ?, ?> c = getPactContract();
    SingleInputSemanticProperties semanticProperties = c.getSemanticProperties();
   
    if (semanticProperties != null) {
      FieldSet fs;
      if ((fs = semanticProperties.getForwardedField(fieldNumber)) != null) {
        return fs.contains(fieldNumber);
      }
    }
   
    return false;
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

  }
 
 
  protected void extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
    Set<Annotation> annotations = FunctionAnnotation.readSingleConstantAnnotations(udfClass);
    SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingle(annotations, getInputType(), getResultType());
    setSemanticProperties(sp);
  }
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

   *
   * @param constantSet A list of constant field specification Strings.
   * @return This operator with an annotated constant field set.
   */
  public O withConstantSet(String... constantSet) {
    SingleInputSemanticProperties props = SemanticPropUtil.getSemanticPropsSingleFromString(constantSet, null, null, this.getInputType(), this.getResultType());
    this.setSemanticProperties(props);
    @SuppressWarnings("unchecked")
    O returnType = (O) this;
    return returnType;
  }
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

    if (allConstants != null) {
      FieldSet nonConstant = new FieldSet();
      return new ImplicitlyForwardingSingleInputSemanticProperties(nonConstant);
    }
   
    SingleInputSemanticProperties semanticProperties = new SingleInputSemanticProperties();
   
    // extract constantSet from annotation
    if (constantSet != null) {
      for (int value: constantSet.value()) {
        semanticProperties.addForwardedField(value,value);
      }
    }
   
    return semanticProperties;
  }
View Full Code Here

Examples of org.apache.flink.api.common.operators.SingleInputSemanticProperties

      // set input
      po.setInput(input);
      // set dop
      po.setDegreeOfParallelism(this.getParallelism());

      SingleInputSemanticProperties props = new SingleInputSemanticProperties();

      for (int i = 0; i < logicalKeyPositions.length; i++) {
        int keyField = logicalKeyPositions[i];
        boolean keyFieldUsedInAgg = false;

        for (int k = 0; k < fields.length; k++) {
          int aggField = fields[k];
          if (keyField == aggField) {
            keyFieldUsedInAgg = true;
            break;
          }
        }

        if (!keyFieldUsedInAgg) {
          props.addForwardedField(keyField, keyField);
        }
      }

      po.setSemanticProperties(props);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.