use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testForwardedInvalidString.
@Test(expected = InvalidSemanticAnnotationException.class)
public void testForwardedInvalidString() {
String[] forwardedFields = { "notValid" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, threeIntTupleType);
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testForwardedNoArrowOneStringInvalidDelimiter.
@Test(expected = InvalidSemanticAnnotationException.class)
public void testForwardedNoArrowOneStringInvalidDelimiter() {
String[] forwardedFields = { "f2,f3,f0" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, fiveIntTupleType, fiveIntTupleType);
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testReadFieldsOneString.
@Test
public void testReadFieldsOneString() {
String[] readFields = { "f1;f2" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType);
FieldSet fs = sp.getReadFields(0);
assertTrue(fs.size() == 2);
assertTrue(fs.contains(2));
assertTrue(fs.contains(1));
readFields[0] = "f1;f2;";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, null, null, readFields, threeIntTupleType, threeIntTupleType);
fs = sp.getReadFields(0);
assertTrue(fs.size() == 2);
assertTrue(fs.contains(2));
assertTrue(fs.contains(1));
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testForwardedNestedTuples.
@Test
public void testForwardedNestedTuples() {
String[] forwardedFields = { "f0->f0.f0; f1->f0.f1; f2->f0.f2" };
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, threeIntTupleType, nestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(2));
forwardedFields[0] = "f0.f0->f1.f0.f2; f0.f1->f2; f2->f1.f2; f1->f0";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedTupleType, deepNestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(3));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(6));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(5));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(0));
forwardedFields[0] = "0.0->1.0.2; 0.1->2; 2->1.2; 1->0";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, nestedTupleType, deepNestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(3));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(6));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(5));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(0));
forwardedFields[0] = "f1.f0.*->f0.*; f0->f2";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 1).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 0).contains(4));
forwardedFields[0] = "1.0.*->0.*; 0->2";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 1).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 0).contains(4));
forwardedFields[0] = "f1.f0->f0; f0->f2";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 1).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 0).contains(4));
forwardedFields[0] = "1.0->0; 0->2";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, nestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 1).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 0).contains(4));
forwardedFields[0] = "f1.f0.f1; f1.f1; f2";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, deepNestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 2).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(4));
assertTrue(sp.getForwardingTargetFields(0, 6).contains(6));
assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 1).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 3).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 5).size() == 0);
forwardedFields[0] = "f1.f0.*; f1.f2";
sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, forwardedFields, null, null, deepNestedTupleType, deepNestedTupleType);
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, 5).contains(5));
assertTrue(sp.getForwardingTargetFields(0, 0).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 4).size() == 0);
assertTrue(sp.getForwardingTargetFields(0, 6).size() == 0);
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class SemanticPropUtilTest method testNonForwardedSpaces.
@Test
public void testNonForwardedSpaces() {
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);
}
Aggregations