Search in sources :

Example 36 with DualInputSemanticProperties

use of org.apache.flink.api.common.operators.DualInputSemanticProperties in project flink by apache.

the class RequestedGlobalPropertiesFilteringTest method testDualHashPartitioningPreserved.

@Test
public void testDualHashPartitioningPreserved() {
    DualInputSemanticProperties dprops = new DualInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsDualFromString(dprops, new String[] { "0;2;4" }, new String[] { "1->3;4->6;3->7" }, null, null, null, null, tupleInfo, tupleInfo, tupleInfo);
    RequestedGlobalProperties gprops1 = new RequestedGlobalProperties();
    RequestedGlobalProperties gprops2 = new RequestedGlobalProperties();
    gprops1.setHashPartitioned(new FieldSet(2, 0, 4));
    gprops2.setHashPartitioned(new FieldSet(3, 6, 7));
    RequestedGlobalProperties filtered1 = gprops1.filterBySemanticProperties(dprops, 0);
    RequestedGlobalProperties filtered2 = gprops2.filterBySemanticProperties(dprops, 1);
    assertNotNull(filtered1);
    assertEquals(PartitioningProperty.HASH_PARTITIONED, filtered1.getPartitioning());
    assertNotNull(filtered1.getPartitionedFields());
    assertEquals(3, filtered1.getPartitionedFields().size());
    assertTrue(filtered1.getPartitionedFields().contains(0));
    assertTrue(filtered1.getPartitionedFields().contains(2));
    assertTrue(filtered1.getPartitionedFields().contains(4));
    assertNull(filtered1.getOrdering());
    assertNull(filtered1.getCustomPartitioner());
    assertNull(filtered1.getDataDistribution());
    assertNotNull(filtered2);
    assertEquals(PartitioningProperty.HASH_PARTITIONED, filtered2.getPartitioning());
    assertNotNull(filtered2.getPartitionedFields());
    assertEquals(3, filtered2.getPartitionedFields().size());
    assertTrue(filtered2.getPartitionedFields().contains(1));
    assertTrue(filtered2.getPartitionedFields().contains(3));
    assertTrue(filtered2.getPartitionedFields().contains(4));
    assertNull(filtered2.getOrdering());
    assertNull(filtered2.getCustomPartitioner());
    assertNull(filtered2.getDataDistribution());
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) DualInputSemanticProperties(org.apache.flink.api.common.operators.DualInputSemanticProperties) Test(org.junit.Test)

Aggregations

DualInputSemanticProperties (org.apache.flink.api.common.operators.DualInputSemanticProperties)36 Test (org.junit.Test)24 Plan (org.apache.flink.api.common.Plan)11 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)11 FieldSet (org.apache.flink.api.common.operators.util.FieldSet)8 InnerJoinOperatorBase (org.apache.flink.api.common.operators.base.InnerJoinOperatorBase)7 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)6 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)6 InvalidSemanticAnnotationException (org.apache.flink.api.common.operators.SemanticProperties.InvalidSemanticAnnotationException)4 SingleInputSemanticProperties (org.apache.flink.api.common.operators.SingleInputSemanticProperties)4 Matcher (java.util.regex.Matcher)3 FlatFieldDescriptor (org.apache.flink.api.common.typeutils.CompositeType.FlatFieldDescriptor)3 InvalidFieldReferenceException (org.apache.flink.api.common.typeutils.CompositeType.InvalidFieldReferenceException)3 Annotation (java.lang.annotation.Annotation)2 SemanticProperties (org.apache.flink.api.common.operators.SemanticProperties)2 DualInputOperator (org.apache.flink.api.common.operators.DualInputOperator)1 SelectorFunctionKeys (org.apache.flink.api.common.operators.Keys.SelectorFunctionKeys)1 FunctionAnnotation (org.apache.flink.api.java.functions.FunctionAnnotation)1 ForwardedFields (org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFields)1 ForwardedFieldsFirst (org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFieldsFirst)1