Package org.apache.flink.api.common.operators

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


    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

 
  @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

        generateProjectionProperties(((ProjectFlatJoinFunction<?, ?, ?>) generatedFunction));
      }
    }

    public void generateProjectionProperties(ProjectFlatJoinFunction<?, ?, ?> pjf) {
      DualInputSemanticProperties props = SemanticPropUtil.createProjectionPropertiesDual(pjf.getFields(), pjf.getIsFromFirst());
      setSemanticProperties(props);
    }
View Full Code Here

      generateProjectionProperties(((ProjectCrossFunction<?, ?, ?>) function));
    }
  }

  public void generateProjectionProperties(ProjectCrossFunction<?, ?, ?> pcf) {
    DualInputSemanticProperties props = SemanticPropUtil.createProjectionPropertiesDual(pcf.getFields(), pcf.getIsFromFirst());
    setSemanticProperties(props);
  }
View Full Code Here

  }
 
  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

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

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

      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

    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

TOP

Related Classes of org.apache.flink.api.common.operators.DualInputSemanticProperties

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.