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

Examples of org.apache.flink.api.common.operators.util.FieldSet


   *
   * @param sourceField the position in the source record(s) from the first input
   * @param destinationField the position in the destination record(s)
   */
  public void addForwardedField1(int sourceField, int destinationField) {
    FieldSet old = this.forwardedFields1.get(sourceField);
    if (old == null) {
      old = FieldSet.EMPTY_SET;
    }
   
    FieldSet fs = old.addField(destinationField);
    this.forwardedFields1.put(sourceField, fs);
  }
View Full Code Here


   *
   * @param sourceField the position in the source record(s)
   * @param destinationFields the position in the destination record(s)
   */
  public void addForwardedField1(int sourceField, FieldSet destinationFields) {
    FieldSet old = this.forwardedFields1.get(sourceField);
    if (old == null) {
      old = FieldSet.EMPTY_SET;
    }
   
    FieldSet fs = old.addFields(destinationFields);
    this.forwardedFields1.put(sourceField, fs);
  }
View Full Code Here

   *
   * @param sourceField the position in the source record(s) from the first input
   * @param destinationField the position in the destination record(s)
   */
  public void addForwardedField2(int sourceField, int destinationField) {
    FieldSet old = this.forwardedFields2.get(sourceField);
    if (old == null) {
      old = FieldSet.EMPTY_SET;
    }
   
    FieldSet fs = old.addField(destinationField);
    this.forwardedFields2.put(sourceField, fs);
  }
View Full Code Here

   *
   * @param sourceField the position in the source record(s)
   * @param destinationFields the position in the destination record(s)
   */
  public void addForwardedField2(int sourceField, FieldSet destinationFields) {
    FieldSet old = this.forwardedFields2.get(sourceField);
    if (old == null) {
      old = FieldSet.EMPTY_SET;
    }
   
    FieldSet fs = old.addFields(destinationFields);
    this.forwardedFields2.put(sourceField, fs);
  }
View Full Code Here

        GlobalProperties gp = new GlobalProperties();
        gp.setHashPartitioned(new FieldList(1, 2));
        LocalProperties lp = LocalProperties.EMPTY;
       
        RequestedGlobalProperties reqGp = new RequestedGlobalProperties();
        reqGp.setAnyPartitioning(new FieldSet(2, 5));
       
        toMap1.setShipStrategy(ShipStrategyType.PARTITION_HASH, new FieldList(2, 5));
        toMap1.setLocalStrategy(LocalStrategy.NONE);
       
        toMap2.setShipStrategy(ShipStrategyType.FORWARD);
        toMap2.setLocalStrategy(LocalStrategy.NONE);
       
       
        toMap1.setRequiredGlobalProps(null);
        toMap1.setRequiredLocalProps(null);
       
        toMap2.setRequiredGlobalProps(reqGp);
        toMap2.setRequiredLocalProps(null);
       
        FeedbackPropertiesMeetRequirementsReport report = map2.checkPartialSolutionPropertiesMet(target, gp, lp);
        assertEquals(MET, report);
      }
     
      // set ship strategy in second channel, so previous non matching global properties void the match
      {
        GlobalProperties gp = new GlobalProperties();
        gp.setHashPartitioned(new FieldList(1, 2));
        LocalProperties lp = LocalProperties.EMPTY;
       
        RequestedGlobalProperties reqGp = new RequestedGlobalProperties();
        reqGp.setAnyPartitioning(new FieldSet(2, 5));
       
        toMap1.setShipStrategy(ShipStrategyType.FORWARD);
        toMap1.setLocalStrategy(LocalStrategy.NONE);
       
        toMap2.setShipStrategy(ShipStrategyType.PARTITION_HASH, new FieldList(2, 5));
        toMap2.setLocalStrategy(LocalStrategy.NONE);
       
       
        toMap1.setRequiredGlobalProps(reqGp);
        toMap1.setRequiredLocalProps(null);
       
        toMap2.setRequiredGlobalProps(null);
        toMap2.setRequiredLocalProps(null);
       
        FeedbackPropertiesMeetRequirementsReport report = map2.checkPartialSolutionPropertiesMet(target, gp, lp);
        assertEquals(NOT_MET, report);
      }
     
      // set local strategy in first channel, so later non matching local properties do not matter
      {
        GlobalProperties gp = new GlobalProperties();
        gp.setHashPartitioned(new FieldList(1, 2));
        LocalProperties lp = LocalProperties.forOrdering(new Ordering(3, null, Order.ASCENDING).appendOrdering(1, null, Order.DESCENDING));
       
        RequestedLocalProperties reqLp = new RequestedLocalProperties();
        reqLp.setGroupedFields(new FieldList(4, 1));
       
        toMap1.setShipStrategy(ShipStrategyType.FORWARD);
        toMap1.setLocalStrategy(LocalStrategy.SORT, new FieldList(5, 7), new boolean[] {false, false});
       
        toMap2.setShipStrategy(ShipStrategyType.FORWARD);
        toMap2.setLocalStrategy(LocalStrategy.NONE);
       
        toMap1.setRequiredGlobalProps(null);
        toMap1.setRequiredLocalProps(null);
       
        toMap2.setRequiredGlobalProps(null);
        toMap2.setRequiredLocalProps(reqLp);
       
        FeedbackPropertiesMeetRequirementsReport report = map2.checkPartialSolutionPropertiesMet(target, gp, lp);
        assertTrue(report != null && report != NO_PARTIAL_SOLUTION && report != NOT_MET);
      }
     
      // set local strategy in second channel, so previous non matching local properties void the match
      {
        GlobalProperties gp = new GlobalProperties();
        gp.setHashPartitioned(new FieldList(1, 2));
        LocalProperties lp = LocalProperties.forOrdering(new Ordering(3, null, Order.ASCENDING).appendOrdering(1, null, Order.DESCENDING));
       
        RequestedLocalProperties reqLp = new RequestedLocalProperties();
        reqLp.setGroupedFields(new FieldList(4, 1));
       
        toMap1.setShipStrategy(ShipStrategyType.FORWARD);
        toMap1.setLocalStrategy(LocalStrategy.NONE);
       
        toMap2.setShipStrategy(ShipStrategyType.FORWARD);
        toMap2.setLocalStrategy(LocalStrategy.SORT, new FieldList(5, 7), new boolean[] {false, false});
       
       
        toMap1.setRequiredGlobalProps(null);
        toMap1.setRequiredLocalProps(reqLp);
       
        toMap2.setRequiredGlobalProps(null);
        toMap2.setRequiredLocalProps(null);
       
        FeedbackPropertiesMeetRequirementsReport report = map2.checkPartialSolutionPropertiesMet(target, gp, lp);
        assertEquals(NOT_MET, report);
      }
     
      // create the properties on the same node as the requirement
      {
        GlobalProperties gp = new GlobalProperties();
        gp.setHashPartitioned(new FieldList(1, 2));
        LocalProperties lp = LocalProperties.forOrdering(new Ordering(3, null, Order.ASCENDING).appendOrdering(1, null, Order.DESCENDING));
       
        RequestedGlobalProperties reqGp = new RequestedGlobalProperties();
        reqGp.setAnyPartitioning(new FieldSet(5, 7));
       
        RequestedLocalProperties reqLp = new RequestedLocalProperties();
        reqLp.setGroupedFields(new FieldList(5, 7));
       
        toMap1.setShipStrategy(ShipStrategyType.PARTITION_HASH, new FieldList(5, 7));
View Full Code Here

        GlobalProperties gp = new GlobalProperties();
        gp.setHashPartitioned(new FieldList(5, 3));
        LocalProperties lp = LocalProperties.EMPTY;
       
        RequestedGlobalProperties reqGp = new RequestedGlobalProperties();
        reqGp.setAnyPartitioning(new FieldSet(2, 3));
       
        toMap1.setShipStrategy(ShipStrategyType.PARTITION_HASH, new FieldList(1, 2));
        toMap1.setLocalStrategy(LocalStrategy.NONE);
       
        toMap2.setShipStrategy(ShipStrategyType.FORWARD);
View Full Code Here

          }
        }
        continue;
      }
      String found = forwardMatcher.group(4);
      FieldSet fs = readFieldSetFromString(found, inType, outType);

      if (sp instanceof SingleInputSemanticProperties) {
        ((SingleInputSemanticProperties) sp).addForwardedField(sourceField, fs);
      } else if (sp instanceof DualInputSemanticProperties) {
        if (input == 0) {
          ((DualInputSemanticProperties) sp).addForwardedField1(sourceField, fs);
        } else if (input == 1) {
          ((DualInputSemanticProperties) sp).addForwardedField2(sourceField, fs);
        }
      }
    }
    s = forwardMatcher.replaceAll("");

    Matcher listMatcher = PATTERN_LIST.matcher(s);

    while (listMatcher.find()) {
      String list = listMatcher.group();
      FieldSet fs = readFieldSetFromString(list, inType, outType);
      for (int i : fs) {
        if (sp instanceof SingleInputSemanticProperties) {
          ((SingleInputSemanticProperties) sp).addForwardedField(i, i);
        } else if (sp instanceof DualInputSemanticProperties) {
          if (input == 0) {
View Full Code Here

    for (String str : cffe) {
      if (str == null) {
        continue;
      }

      FieldSet fs = readFieldSetFromString(str, inType, outType);

      for (int i = 0; i < outType.getArity(); i++) {
        if (!fs.contains(i)) {
          dm.addForwardedField1(i, i);
        }
      }
    }
  }
View Full Code Here

    for (String str : cfse) {
      if (str == null) {
        continue;
      }

      FieldSet fs = readFieldSetFromString(str, inType, outType);

      for (int i = 0; i < outType.getArity(); i++) {
        if (!fs.contains(i)) {
          dm.addForwardedField2(i, i);
        }
      }
    }
  }
View Full Code Here

      return;
    }

    for (String str : rf) {
      if (str != null) {
        FieldSet fs = readFieldSetFromString(str, inType, outType);
        dm.addReadFields1(fs);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.operators.util.FieldSet

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.