Search in sources :

Example 86 with FieldSet

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

the class RequestedGlobalPropertiesFilteringTest method testHashPartitioningPreserved1.

@Test
public void testHashPartitioningPreserved1() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "0;3;4" }, null, null, tupleInfo, tupleInfo);
    RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
    rgProps.setHashPartitioned(new FieldSet(0, 3, 4));
    RequestedGlobalProperties filtered = rgProps.filterBySemanticProperties(sProp, 0);
    assertNotNull(filtered);
    assertEquals(PartitioningProperty.HASH_PARTITIONED, filtered.getPartitioning());
    assertNotNull(filtered.getPartitionedFields());
    assertEquals(3, filtered.getPartitionedFields().size());
    assertTrue(filtered.getPartitionedFields().contains(0));
    assertTrue(filtered.getPartitionedFields().contains(3));
    assertTrue(filtered.getPartitionedFields().contains(4));
    assertNull(filtered.getDataDistribution());
    assertNull(filtered.getCustomPartitioner());
    assertNull(filtered.getOrdering());
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Example 87 with FieldSet

use of org.apache.flink.api.common.operators.util.FieldSet 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)

Example 88 with FieldSet

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

the class RequestedGlobalPropertiesFilteringTest method testHashPartitioningPreserved2.

@Test
public void testHashPartitioningPreserved2() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "2->0;1->3;7->4" }, null, null, tupleInfo, tupleInfo);
    RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
    rgProps.setHashPartitioned(new FieldSet(0, 3, 4));
    RequestedGlobalProperties filtered = rgProps.filterBySemanticProperties(sProp, 0);
    assertNotNull(filtered);
    assertEquals(PartitioningProperty.HASH_PARTITIONED, filtered.getPartitioning());
    assertNotNull(filtered.getPartitionedFields());
    assertEquals(3, filtered.getPartitionedFields().size());
    assertTrue(filtered.getPartitionedFields().contains(1));
    assertTrue(filtered.getPartitionedFields().contains(2));
    assertTrue(filtered.getPartitionedFields().contains(7));
    assertNull(filtered.getDataDistribution());
    assertNull(filtered.getCustomPartitioner());
    assertNull(filtered.getOrdering());
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Example 89 with FieldSet

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

the class RequestedGlobalPropertiesFilteringTest method testEraseAll2.

@Test
public void testEraseAll2() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "3;4" }, null, null, tupleInfo, tupleInfo);
    RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
    rgProps.setAnyPartitioning(new FieldSet(0, 1, 2));
    RequestedGlobalProperties filtered = rgProps.filterBySemanticProperties(sProp, 0);
    assertNull(filtered);
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Example 90 with FieldSet

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

the class RequestedLocalPropertiesFilteringTest method testAllErased.

@Test
public void testAllErased() {
    SingleInputSemanticProperties sProps = new SingleInputSemanticProperties();
    RequestedLocalProperties rlProp = new RequestedLocalProperties();
    rlProp.setGroupedFields(new FieldSet(0, 2, 3));
    RequestedLocalProperties filtered = rlProp.filterBySemanticProperties(sProps, 0);
    assertNull(filtered);
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Aggregations

FieldSet (org.apache.flink.api.common.operators.util.FieldSet)111 Test (org.junit.Test)97 SingleInputSemanticProperties (org.apache.flink.api.common.operators.SingleInputSemanticProperties)57 Plan (org.apache.flink.api.common.Plan)37 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)37 GlobalProperties (org.apache.flink.optimizer.dataproperties.GlobalProperties)28 LocalProperties (org.apache.flink.optimizer.dataproperties.LocalProperties)28 SourcePlanNode (org.apache.flink.optimizer.plan.SourcePlanNode)27 OptimizedPlan (org.apache.flink.optimizer.plan.OptimizedPlan)25 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)24 SinkPlanNode (org.apache.flink.optimizer.plan.SinkPlanNode)24 FieldList (org.apache.flink.api.common.operators.util.FieldList)14 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)14 MapOperatorBase (org.apache.flink.api.common.operators.base.MapOperatorBase)13 DualInputSemanticProperties (org.apache.flink.api.common.operators.DualInputSemanticProperties)9 Ordering (org.apache.flink.api.common.operators.Ordering)9 SemanticProperties (org.apache.flink.api.common.operators.SemanticProperties)5 Channel (org.apache.flink.optimizer.plan.Channel)4 SingleInputPlanNode (org.apache.flink.optimizer.plan.SingleInputPlanNode)4 Configuration (org.apache.flink.configuration.Configuration)3