Search in sources :

Example 1 with SingleInputSemanticProperties

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

the class GlobalPropertiesFilteringTest method testUniqueFieldGroupsErased.

@Test
public void testUniqueFieldGroupsErased() {
    SingleInputSemanticProperties sprops = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sprops, new String[] { "0; 3; 5; 6; 7" }, null, null, tupleInfo, tupleInfo);
    FieldSet set1 = new FieldSet(0, 1, 2);
    FieldSet set2 = new FieldSet(3, 4);
    FieldSet set3 = new FieldSet(4, 5, 6, 7);
    GlobalProperties gprops = new GlobalProperties();
    gprops.addUniqueFieldCombination(set1);
    gprops.addUniqueFieldCombination(set2);
    gprops.addUniqueFieldCombination(set3);
    GlobalProperties result = gprops.filterBySemanticProperties(sprops, 0);
    Assert.assertNull(result.getUniqueFieldCombination());
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Example 2 with SingleInputSemanticProperties

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

the class GlobalPropertiesFilteringTest method testAllErased2.

@Test
public void testAllErased2() {
    SingleInputSemanticProperties semProps = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(semProps, new String[] { "2" }, null, null, tupleInfo, tupleInfo);
    GlobalProperties gprops = new GlobalProperties();
    gprops.setHashPartitioned(new FieldList(0, 1));
    gprops.addUniqueFieldCombination(new FieldSet(3, 4));
    gprops.addUniqueFieldCombination(new FieldSet(5, 6));
    GlobalProperties result = gprops.filterBySemanticProperties(semProps, 0);
    assertEquals(PartitioningProperty.RANDOM_PARTITIONED, result.getPartitioning());
    assertNull(result.getPartitioningFields());
    assertNull(result.getPartitioningOrdering());
    assertNull(result.getUniqueFieldCombination());
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) FieldList(org.apache.flink.api.common.operators.util.FieldList) Test(org.junit.Test)

Example 3 with SingleInputSemanticProperties

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

the class GlobalPropertiesFilteringTest method testAllErased1.

@Test
public void testAllErased1() {
    SingleInputSemanticProperties semProps = new SingleInputSemanticProperties();
    GlobalProperties gprops = new GlobalProperties();
    gprops.setHashPartitioned(new FieldList(0, 1));
    gprops.addUniqueFieldCombination(new FieldSet(3, 4));
    gprops.addUniqueFieldCombination(new FieldSet(5, 6));
    GlobalProperties result = gprops.filterBySemanticProperties(semProps, 0);
    assertEquals(PartitioningProperty.RANDOM_PARTITIONED, result.getPartitioning());
    assertNull(result.getPartitioningFields());
    assertNull(result.getPartitioningOrdering());
    assertNull(result.getUniqueFieldCombination());
}
Also used : FieldSet(org.apache.flink.api.common.operators.util.FieldSet) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) FieldList(org.apache.flink.api.common.operators.util.FieldList) Test(org.junit.Test)

Example 4 with SingleInputSemanticProperties

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

the class GlobalPropertiesFilteringTest method testAnyPartitioningPreserved2.

@Test
public void testAnyPartitioningPreserved2() {
    SingleInputSemanticProperties sprops = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sprops, new String[] { "0->1; 1->2; 4->3" }, null, null, tupleInfo, tupleInfo);
    GlobalProperties gprops = new GlobalProperties();
    gprops.setAnyPartitioning(new FieldList(0, 1, 4));
    GlobalProperties result = gprops.filterBySemanticProperties(sprops, 0);
    assertEquals(PartitioningProperty.ANY_PARTITIONING, result.getPartitioning());
    FieldList pFields = result.getPartitioningFields();
    assertEquals(3, pFields.size());
    assertTrue(pFields.contains(1));
    assertTrue(pFields.contains(2));
    assertTrue(pFields.contains(3));
}
Also used : SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) FieldList(org.apache.flink.api.common.operators.util.FieldList) Test(org.junit.Test)

Example 5 with SingleInputSemanticProperties

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

the class GlobalPropertiesFilteringTest method testRangePartitioningErased.

@Test
public void testRangePartitioningErased() {
    SingleInputSemanticProperties sprops = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sprops, new String[] { "1;5" }, null, null, tupleInfo, tupleInfo);
    Ordering o = new Ordering();
    o.appendOrdering(1, IntValue.class, Order.ASCENDING);
    o.appendOrdering(5, LongValue.class, Order.DESCENDING);
    o.appendOrdering(2, StringValue.class, Order.ASCENDING);
    GlobalProperties gprops = new GlobalProperties();
    gprops.setRangePartitioned(o);
    GlobalProperties result = gprops.filterBySemanticProperties(sprops, 0);
    assertEquals(PartitioningProperty.RANDOM_PARTITIONED, result.getPartitioning());
    assertNull(result.getPartitioningOrdering());
    assertNull(result.getPartitioningFields());
}
Also used : Ordering(org.apache.flink.api.common.operators.Ordering) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Aggregations

SingleInputSemanticProperties (org.apache.flink.api.common.operators.SingleInputSemanticProperties)149 Test (org.junit.Test)131 FieldSet (org.apache.flink.api.common.operators.util.FieldSet)57 FieldList (org.apache.flink.api.common.operators.util.FieldList)26 Ordering (org.apache.flink.api.common.operators.Ordering)15 Plan (org.apache.flink.api.common.Plan)14 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)14 MapOperatorBase (org.apache.flink.api.common.operators.base.MapOperatorBase)12 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)12 DualInputSemanticProperties (org.apache.flink.api.common.operators.DualInputSemanticProperties)5 SemanticProperties (org.apache.flink.api.common.operators.SemanticProperties)5 Internal (org.apache.flink.annotation.Internal)4 SelectorFunctionKeys (org.apache.flink.api.common.operators.Keys.SelectorFunctionKeys)4 InvalidSemanticAnnotationException (org.apache.flink.api.common.operators.SemanticProperties.InvalidSemanticAnnotationException)4 Matcher (java.util.regex.Matcher)3 UnaryOperatorInformation (org.apache.flink.api.common.operators.UnaryOperatorInformation)3 FlatFieldDescriptor (org.apache.flink.api.common.typeutils.CompositeType.FlatFieldDescriptor)3 InvalidFieldReferenceException (org.apache.flink.api.common.typeutils.CompositeType.InvalidFieldReferenceException)3 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)3 Annotation (java.lang.annotation.Annotation)2