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)
   * @param destinationField the position in the destination record(s)
   */
  public void addForwardedField(int sourceField, int destinationField) {
    FieldSet old = this.forwardedFields.get(sourceField);
    if (old == null) {
      old = FieldSet.EMPTY_SET;
    }
   
    FieldSet fs = old.addField(destinationField);
    this.forwardedFields.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 addForwardedField(int sourceField, FieldSet destinationFields) {
    FieldSet old = this.forwardedFields.get(sourceField);
    if (old == null) {
      old = FieldSet.EMPTY_SET;
    }
   
    FieldSet fs = old.addFields(destinationFields);
    this.forwardedFields.put(sourceField, fs);
  }
View Full Code Here

   */
  public void addUniqueField(int field) {
    if (this.uniqueFields == null) {
      this.uniqueFields = new HashSet<FieldSet>();
    }
    this.uniqueFields.add(new FieldSet(field));
  }
View Full Code Here

      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);
     
      assertTrue(fw1.contains(0));
      assertTrue(fw2.contains(1));
      assertTrue(fw3.contains(2));
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      fail("Exception in test: " + e.getMessage());
View Full Code Here

      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);
     
      assertTrue(fw1.contains(0));
      assertTrue(fw2.contains(1));
      assertTrue(fw3.contains(2));
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      fail("Exception in test: " + e.getMessage());
View Full Code Here

      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);
      assertNotNull(fw22);
     
      assertTrue(fw12.contains(0));
      assertTrue(fw22.contains(1));
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      fail("Exception in test: " + e.getMessage());
View Full Code Here

 
      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

    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);
    SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingleFromString(constantFields, null, null, type, type);

    FieldSet fs = sp.getForwardedField(1);
    Assert.assertTrue(fs.size() == 2);
    Assert.assertTrue(fs.contains(1));
    Assert.assertTrue(fs.contains(2));

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

 
      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));
    }
   
    // wide (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

 
      TypeInformation<?> type = new TupleTypeInfo<Tuple5<Integer, Integer, Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
          BasicTypeInfo.INT_TYPE_INFO, 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() == 1);
      Assert.assertTrue(fs.contains(0));
 
      fs = sp.getForwardedField(2);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
 
      fs = sp.getForwardedField(3);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(3));
 
      Assert.assertNull(sp.getForwardedField(1));
      Assert.assertNull(sp.getForwardedField(4));
    }
   
    // with spaces
    {
      String[] constantFields = {" 2   ","3  ","  0"};
 
      TypeInformation<?> type = new TupleTypeInfo<Tuple5<Integer, Integer, Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
          BasicTypeInfo.INT_TYPE_INFO, 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() == 1);
      Assert.assertTrue(fs.contains(0));
 
      fs = sp.getForwardedField(2);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
 
      fs = sp.getForwardedField(3);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(3));
 
      Assert.assertNull(sp.getForwardedField(1));
      Assert.assertNull(sp.getForwardedField(4));
    }
  }
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.