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

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


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

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

 
      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() == 2);
      Assert.assertTrue(fs.contains(1));
      Assert.assertTrue(fs.contains(4));
 
      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));
 
      fs = sp.getForwardedField(4);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
    }
   
    // with spaces
    {
      String[] constantFields = {" 2  ,  3   ;  0 -> 1  , 4 ; 4 ->  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() == 2);
      Assert.assertTrue(fs.contains(1));
      Assert.assertTrue(fs.contains(4));
 
      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));
 
      fs = sp.getForwardedField(4);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
    }
  }
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(1);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(1));
 
      fs = sp.getForwardedField(2);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
 
      fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
    }
   
//    // with spaces
//    {
//      String[] constantFields = { "   *   " };
View Full Code Here

      String[] constantFields = { "1->*" };
      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(1);
      Assert.assertTrue(fs.size() == 3);
      Assert.assertTrue(fs.contains(0));
      Assert.assertTrue(fs.contains(1));
      Assert.assertTrue(fs.contains(2));
      Assert.assertTrue(sp.getForwardedField(0) == null);
      Assert.assertTrue(sp.getForwardedField(2) == null);
    }
   
//    // with spaces
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(null, constantFieldsExcept, null, type, type);
 
      FieldSet fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
 
      Assert.assertNull(sp.getForwardedField(1));
     
      fs = sp.getForwardedField(2);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
    }
   
    // with spaces
    {
      String[] constantFieldsExcept = { " 1  "};
     
      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, constantFieldsExcept, null, type, type);
 
      FieldSet fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
 
      Assert.assertNull(sp.getForwardedField(1));
     
      fs = sp.getForwardedField(2);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(2));
    }
  }
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(null, constantFieldsExcept, null, type, type);
 
      FieldSet fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
 
      Assert.assertNull(sp.getForwardedField(1));
      Assert.assertNull(sp.getForwardedField(2));
    }
   
    // with spaces
    {
      String[] constantFieldsExcept = { " 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, constantFieldsExcept, null, type, type);
 
      FieldSet fs = sp.getForwardedField(0);
      Assert.assertTrue(fs.size() == 1);
      Assert.assertTrue(fs.contains(0));
 
      Assert.assertNull(sp.getForwardedField(1));
      Assert.assertNull(sp.getForwardedField(2));
    }
  }
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(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

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.