Package eu.stratosphere.api.common.operators

Examples of eu.stratosphere.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


  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

      }
    }
  }

  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

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

   *
   * @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

      // 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

    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

      Plan plan = env.createProgramPlan();
     
      GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
      MapOperatorBase<?, ?, ?> mapper = (MapOperatorBase<?, ?, ?>) sink.getInput();
     
      SingleInputSemanticProperties semantics = mapper.getSemanticProperties();
     
      FieldSet fw1 = semantics.getForwardedField(0);
      FieldSet fw2 = semantics.getForwardedField(1);
      FieldSet fw3 = semantics.getForwardedField(2);
     
      assertNotNull(fw1);
      assertNotNull(fw2);
      assertNotNull(fw3);
     
View Full Code Here

      Plan plan = env.createProgramPlan();
     
      GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
      MapOperatorBase<?, ?, ?> mapper = (MapOperatorBase<?, ?, ?>) sink.getInput();
     
      SingleInputSemanticProperties semantics = mapper.getSemanticProperties();
     
      FieldSet fw1 = semantics.getForwardedField(0);
      FieldSet fw2 = semantics.getForwardedField(1);
      FieldSet fw3 = semantics.getForwardedField(2);
     
      assertNotNull(fw1);
      assertNotNull(fw2);
      assertNotNull(fw3);
     
View Full Code Here

    {
      String[] constantFields = { "0->0,1", "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(constantFields, null, null, type, type);
 
      FieldSet fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 2);
      Assert.assertTrue(fs.contains(0));
      Assert.assertTrue(fs.contains(1));
 
      fs = sp.getForwardedField(1);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
    }
   
    // with spaces
    {
      String[] constantFields = { "0 -> 0 ,   1 ", " 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(constantFields, null, null, type, type);
 
      FieldSet fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 2);
      Assert.assertTrue(fs.contains(0));
      Assert.assertTrue(fs.contains(1));
 
      fs = sp.getForwardedField(1);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
    }
  }
View Full Code Here

TOP

Related Classes of eu.stratosphere.api.common.operators.SingleInputSemanticProperties

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.