use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class RequestedGlobalPropertiesFilteringTest method testInvalidInputIndex.
@Test(expected = IndexOutOfBoundsException.class)
public void testInvalidInputIndex() {
SingleInputSemanticProperties sprops = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sprops, new String[] { "0;1" }, null, null, tupleInfo, tupleInfo);
RequestedGlobalProperties gprops = new RequestedGlobalProperties();
gprops.setHashPartitioned(new FieldSet(0, 1));
gprops.filterBySemanticProperties(sprops, 1);
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class RequestedGlobalPropertiesFilteringTest method testAnyPartitioningPreserved2.
@Test
public void testAnyPartitioningPreserved2() {
SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "2->0;1->3;7->4" }, null, null, tupleInfo, tupleInfo);
RequestedGlobalProperties rgProps = new RequestedGlobalProperties();
rgProps.setAnyPartitioning(new FieldSet(0, 3, 4));
RequestedGlobalProperties filtered = rgProps.filterBySemanticProperties(sProp, 0);
assertNotNull(filtered);
assertEquals(PartitioningProperty.ANY_PARTITIONING, 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());
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class RequestedGlobalPropertiesFilteringTest method testRangePartitioningPreserved1.
@Test
public void testRangePartitioningPreserved1() {
SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "1;3;6" }, 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);
assertNotNull(filtered);
assertEquals(PartitioningProperty.RANGE_PARTITIONED, filtered.getPartitioning());
assertNotNull(filtered.getOrdering());
assertEquals(3, filtered.getOrdering().getNumberOfFields());
assertEquals(3, filtered.getOrdering().getFieldNumber(0).intValue());
assertEquals(1, filtered.getOrdering().getFieldNumber(1).intValue());
assertEquals(6, 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));
assertNull(filtered.getPartitionedFields());
assertNull(filtered.getDataDistribution());
assertNull(filtered.getCustomPartitioner());
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties 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());
}
use of org.apache.flink.api.common.operators.SingleInputSemanticProperties in project flink by apache.
the class RequestedGlobalPropertiesFilteringTest method testRangePartitioningPreserved2.
@Test
public void testRangePartitioningPreserved2() {
SingleInputSemanticProperties sProp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sProp, new String[] { "7->3;1->1;2->6" }, 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);
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));
assertNull(filtered.getPartitionedFields());
assertNull(filtered.getDataDistribution());
assertNull(filtered.getCustomPartitioner());
}
Aggregations