Package eu.stratosphere.api.common.operators.util

Examples of eu.stratosphere.api.common.operators.util.FieldSet


 
      TypeInformation<?> type = new TupleTypeInfo<Tuple3<Integer, Integer, Integer>>(BasicTypeInfo.INT_TYPE_INFO,
          BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO);
      SingleInputSemanticProperties sp = SemanticPropUtil.getSemanticPropsSingleFromString(null, null, readFields, type, type);
 
      FieldSet fs = sp.getReadFields();
      Assert.assertTrue(fs.size() == 2);
      Assert.assertTrue(fs.contains(2));
      Assert.assertTrue(fs.contains(1));
    }
   
    // with spaces
    {
      String[] readFields = { "  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(null, null, readFields, type, type);
 
      FieldSet fs = sp.getReadFields();
      Assert.assertTrue(fs.size() == 2);
      Assert.assertTrue(fs.contains(2));
      Assert.assertTrue(fs.contains(1));
    }
  }
View Full Code Here


    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

    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

 
      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

   *
   * @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 fs;
    if((fs = this.forwardedFields.get(sourceField)) != null) {
      fs.addAll(destinationFields);
    } else {
      fs = new FieldSet(destinationFields);
      this.forwardedFields.put(sourceField, fs);
    }
  }
View Full Code Here

   *
   * @param readFields the position(s) in the source record(s)
   */
  public void addReadFields(FieldSet readFields) {
    if(this.readFields == null) {
      this.readFields = new FieldSet(readFields);
    } else {
      this.readFields.addAll(readFields);
    }
  }
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

   *
   * @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 fs;
    if((fs = this.forwardedFields1.get(sourceField)) != null) {
      fs.add(destinationField);
    } else {
      fs = new FieldSet(destinationField);
      this.forwardedFields1.put(sourceField, fs);
    }
  }
View Full Code Here

TOP

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