Examples of DualInputSemanticProperties


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

 
  @Override
  public boolean isFieldConstant(int input, int fieldNumber) {
    DualInputOperator<?, ?, ?, ?> c = getPactContract();
    DualInputSemanticProperties semanticProperties = c.getSemanticProperties();
   
    switch(input) {
    case 0:
      if (semanticProperties != null) {
        FieldSet fs;
        if ((fs = semanticProperties.getForwardedField1(fieldNumber)) != null) {
          return fs.contains(fieldNumber);
        }
      }
      break;
    case 1:
      if(semanticProperties != null) {
        FieldSet fs;
        if ((fs = semanticProperties.getForwardedField2(fieldNumber)) != null) {
          return fs.contains(fieldNumber);
        }
      }
      break;
    default:
View Full Code Here

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

    if (set == null) {
      return null;
    }

    Iterator<Annotation> it = set.iterator();
    DualInputSemanticProperties result = null;

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

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

      Annotation ann = it.next();

      if (ann instanceof ConstantFieldsFirst) {
View Full Code Here

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

  }
 
  protected void extractSemanticAnnotationsFromUdf(Class<?> udfClass) {
    Set<Annotation> annotations = FunctionAnnotation.readDualConstantAnnotations(udfClass);
   
    DualInputSemanticProperties dsp = SemanticPropUtil.getSemanticPropsDual(annotations,
          getInput1Type(), getInput2Type(), getResultType());

    setSemanticProperties(dsp);
  }
View Full Code Here

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

   * @return This operator with an annotated constant field set for the first input.
   */
  @SuppressWarnings("unchecked")
  public O withConstantSetFirst(String... constantSetFirst) {
    if (this.udfSemantics == null) {
      this.udfSemantics = new DualInputSemanticProperties();
    }
   
    SemanticPropUtil.getSemanticPropsDualFromString(this.udfSemantics, constantSetFirst, null,
        null, null, null, null, this.getInput1Type(), this.getInput2Type(), this.getResultType());

View Full Code Here

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

   * @return This operator with an annotated constant field set for the second input.
   */
  @SuppressWarnings("unchecked")
  public O withConstantSetSecond(String... constantSetSecond) {
    if (this.udfSemantics == null) {
      this.udfSemantics = new DualInputSemanticProperties();
    }
   
    SemanticPropUtil.getSemanticPropsDualFromString(this.udfSemantics, null, constantSetSecond,
        null, null, null, null, this.getInput1Type(), this.getInput2Type(), this.getResultType());

View Full Code Here

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

      Plan plan = env.createProgramPlan();
     
      GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
      JoinOperatorBase<?, ?, ?, ?> join = (JoinOperatorBase<?, ?, ?, ?>) sink.getInput();
     
      DualInputSemanticProperties semantics = join.getSemanticProperties();
     
      FieldSet fw11 = semantics.getForwardedField1(0);
      FieldSet fw12 = semantics.getForwardedField1(1);
      FieldSet fw21 = semantics.getForwardedField2(0);
      FieldSet fw22 = semantics.getForwardedField2(1);
     
      assertNull(fw11);
      assertNull(fw21);
     
      assertNotNull(fw12);
View Full Code Here

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

    TypeInformation<?> type = new TupleTypeInfo<Tuple4<Integer, Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
        BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
   
   
    DualInputSemanticProperties dsp = new DualInputSemanticProperties();
   
    SemanticPropUtil.getSemanticPropsDualFromString(dsp, constantFieldsFirst, constantFieldsSecond, null,
        null, null, null, type, type, type);

    FieldSet fs = dsp.getForwardedField1(1);
    Assert.assertTrue(fs.size() == 2);
    Assert.assertTrue(fs.contains(1));
    Assert.assertTrue(fs.contains(2));

    fs = dsp.getForwardedField1(2);
    Assert.assertTrue(fs.size() == 1);
    Assert.assertTrue(fs.contains(3));
  }
View Full Code Here

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

  @Test
  public void testFieldsExceptDual() {
    String[] constantFieldsFirstExcept = { "1,2" };
    String[] constantFieldsSecond = { "0->1" };

    DualInputSemanticProperties dsp = new DualInputSemanticProperties();
   
    TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
        BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
    SemanticPropUtil.getSemanticPropsDualFromString(dsp, null, constantFieldsSecond,
        constantFieldsFirstExcept, null, null, null, type, type, type);

    FieldSet fs = dsp.getForwardedField1(0);
    Assert.assertTrue(fs.size() == 1);
    Assert.assertTrue(fs.contains(0));

    fs = dsp.getForwardedField1(1);
    Assert.assertTrue(fs == null);

    fs = dsp.getForwardedField1(2);
    Assert.assertTrue(fs == null);

    fs = dsp.getForwardedField2(0);
    Assert.assertTrue(fs.size() == 1);
    Assert.assertTrue(fs.contains(1));
  }
View Full Code Here

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

    }
    return ssp;
  }

  public static DualInputSemanticProperties createProjectionPropertiesDual(int[] fields, boolean[] isFromFirst) {
    DualInputSemanticProperties dsp = new DualInputSemanticProperties();

    for (int i = 0; i < fields.length; i++) {
      if (isFromFirst[i]) {
        dsp.addForwardedField1(fields[i], i);
      } else {
        dsp.addForwardedField2(fields[i], i);
      }
    }
    return dsp;
  }
View Full Code Here

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

    if (set == null) {
      return null;
    }

    Iterator<Annotation> it = set.iterator();
    DualInputSemanticProperties result = null;

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

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

      Annotation ann = it.next();

      if (ann instanceof ConstantFieldsFirst) {
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.