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