use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testForwardedWithArrowSpaces.
@Test
public void testForwardedWithArrowSpaces() {
String[] forwardedFields = { " f0 -> f0 ; f1 -> f2 " };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, fiveIntTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(2));
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testNonForwardedInvalidTypes1.
@Test(expected = InvalidSemanticAnnotationException.class)
public void testNonForwardedInvalidTypes1() {
String[] nonForwardedFields = { "f1; f2" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, nestedPojoType);
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testNonForwardedSingleString.
@Test
public void testNonForwardedSingleString() {
String[] nonForwardedFields = { "f1;f2" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0);
nonForwardedFields[0] = "f1;f2;";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, nonForwardedFields, null, threeIntTupleType, threeIntTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 2).size() == 0);
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testReadFieldsNestedPojo.
@Test
public void testReadFieldsNestedPojo() {
String[] readFields = { "pojo1.int2; string1; pojo1.string1" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedPojoType, intType);
FieldSet fs = sp.getReadFields(0);
assertTrue(fs.size() == 3);
assertTrue(fs.contains(2));
assertTrue(fs.contains(4));
assertTrue(fs.contains(5));
readFields[0] = "pojo1.*";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedPojoType, intType);
fs = sp.getReadFields(0);
assertTrue(fs.size() == 4);
assertTrue(fs.contains(1));
assertTrue(fs.contains(2));
assertTrue(fs.contains(3));
assertTrue(fs.contains(4));
readFields[0] = "pojo1";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, nestedPojoType, intType);
fs = sp.getReadFields(0);
assertTrue(fs.size() == 4);
assertTrue(fs.contains(1));
assertTrue(fs.contains(2));
assertTrue(fs.contains(3));
assertTrue(fs.contains(4));
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testForwardedWildCard.
@Test
public void testForwardedWildCard() {
String[] forwardedFields = { "*" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0);
forwardedFields[0] = "*";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, deepNestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(3));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(4));
}
Aggregations