Search in sources :

Example 26 with SingleInputSemanticProperties

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

the class RequestedGlobalPropertiesFilteringTest method testRangePartitioningPreserved3.

@Test
public void testRangePartitioningPreserved3() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "7->3;1->1;2->6" }, null, null, tupleInfo, tupleInfo);
    DataDistribution dd = new MockDistribution();
    Ordering o = new Ordering();
    o.appendOrdering(3, LongValue.class, Order.DESCENDING);
    o.appendOrdering(1, IntValue.class, Order.ASCENDING);
    o.appendOrdering(6, ByteValue.class, Order.DESCENDING);
    RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
    rgProps.setRangePartitioned(o, dd);
    RequestedGlobalProperties filtered = rgProps.filterBySemanticProperties(sProp, 0);
    assertNotNull(filtered);
    assertEquals(PartitioningProperty.RANGE_PARTITIONED, filtered.getPartitioning());
    assertNotNull(filtered.getOrdering());
    assertEquals(3, filtered.getOrdering().getNumberOfFields());
    assertEquals(7, filtered.getOrdering().getFieldNumber(0).intValue());
    assertEquals(1, filtered.getOrdering().getFieldNumber(1).intValue());
    assertEquals(2, filtered.getOrdering().getFieldNumber(2).intValue());
    assertEquals(LongValue.class, filtered.getOrdering().getType(0));
    assertEquals(IntValue.class, filtered.getOrdering().getType(1));
    assertEquals(ByteValue.class, filtered.getOrdering().getType(2));
    assertEquals(Order.DESCENDING, filtered.getOrdering().getOrder(0));
    assertEquals(Order.ASCENDING, filtered.getOrdering().getOrder(1));
    assertEquals(Order.DESCENDING, filtered.getOrdering().getOrder(2));
    assertNotNull(filtered.getDataDistribution());
    assertEquals(dd, filtered.getDataDistribution());
    assertNull(filtered.getPartitionedFields());
    assertNull(filtered.getCustomPartitioner());
}
Also used : DataDistribution(org.apache.flink.api.common.distributions.DataDistribution) Ordering(org.apache.flink.api.common.operators.Ordering) SingleInputSemanticProperties(org.apache.flink.api.common.operators.SingleInputSemanticProperties) Test(org.junit.Test)

Example 27 with SingleInputSemanticProperties

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

the class RequestedGlobalPropertiesFilteringTest method testCustomPartitioningErased.

@Test
public void testCustomPartitioningErased() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "0;1;2" }, null, null, tupleInfo, tupleInfo);
    RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
    rgProps.setCustomPartitioned(new FieldSet(0, 1, 2), new MockPartitioner());
    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 28 with SingleInputSemanticProperties

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

the class RequestedGlobalPropertiesFilteringTest method testEraseAll1.

@Test
public void testEraseAll1() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    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 29 with SingleInputSemanticProperties

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

the class RequestedGlobalPropertiesFilteringTest method testRebalancingErased.

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

Example 30 with SingleInputSemanticProperties

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

the class RequestedGlobalPropertiesFilteringTest method testRangePartitioningErased.

@Test
public void testRangePartitioningErased() {
    SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
    SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "1;2" }, null, null, tupleInfo, tupleInfo);
    Ordering o = new Ordering();
    o.appendOrdering(3, LongValue.class, Order.DESCENDING);
    o.appendOrdering(1, IntValue.class, Order.ASCENDING);
    o.appendOrdering(6, ByteValue.class, Order.DESCENDING);
    RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
    rgProps.setRangePartitioned(o);
    RequestedGlobalProperties filtered = rgProps.filterBySemanticProperties(sProp, 0);
    assertNull(filtered);
}
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