use of org.apache.flink.api.common.typeutils.CompositeType in project flink by apache.
the class SemanticPropUtilTest method testSingleProjectionProperties.
// --------------------------------------------------------------------------------------------
// Projection Operator Properties
// --------------------------------------------------------------------------------------------
@Test
public void testSingleProjectionProperties() {
int[] pMap = new int[] { 3, 0, 4 };
SingleInputSemanticProperties sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) fiveIntTupleType);
assertTrue(sp.getForwardingTargetFields(0, 0).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(2));
pMap = new int[] { 2, 2, 1, 1 };
sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) fiveIntTupleType);
assertTrue(sp.getForwardingTargetFields(0, 1).size() == 2);
assertTrue(sp.getForwardingTargetFields(0, 1).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(3));
assertTrue(sp.getForwardingTargetFields(0, 2).size() == 2);
assertTrue(sp.getForwardingTargetFields(0, 2).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(1));
pMap = new int[] { 2, 0 };
sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) nestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 4).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 0).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(3));
pMap = new int[] { 2, 0, 1 };
sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) deepNestedTupleType);
assertTrue(sp.getForwardingTargetFields(0, 6).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 0).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 2).contains(3));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(4));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(5));
assertTrue(sp.getForwardingTargetFields(0, 5).contains(6));
pMap = new int[] { 2, 1 };
sp = SemanticPropUtil.createProjectionPropertiesSingle(pMap, (CompositeType<?>) pojoInTupleType);
assertTrue(sp.getForwardingTargetFields(0, 2).contains(0));
assertTrue(sp.getForwardingTargetFields(0, 3).contains(1));
assertTrue(sp.getForwardingTargetFields(0, 4).contains(2));
assertTrue(sp.getForwardingTargetFields(0, 5).contains(3));
assertTrue(sp.getForwardingTargetFields(0, 1).contains(4));
}
use of org.apache.flink.api.common.typeutils.CompositeType in project flink by apache.
the class JoinOperatorTest method testJoinKeyNestedTuplesWithCustom.
@Test
public void testJoinKeyNestedTuplesWithCustom() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<CustomType, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyNestedCustomTupleData, nestedCustomTupleTypeInfo);
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
try {
TypeInformation<?> t = ds1.join(ds2).where("f0.myInt").equalTo(4).getType();
assertTrue("not a composite type", t instanceof CompositeType);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
Aggregations