use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class LocalPropertiesFilteringTest method testUniqueFieldsPreserved3.
@Test
public void testUniqueFieldsPreserved3() {
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, new String[] { "0->7;1->6;2->5;3->4;4->3" }, null, null, tupleInfo, tupleInfo);
LocalProperties lProps = new LocalProperties();
lProps = lProps.addUniqueFields(new FieldSet(0, 1, 2));
lProps = lProps.addUniqueFields(new FieldSet(3, 4));
lProps = lProps.addUniqueFields(new FieldSet(4, 5, 6));
LocalProperties filtered = lProps.filterBySemanticProperties(sp, 0);
FieldSet expected1 = new FieldSet(5, 6, 7);
FieldSet expected2 = new FieldSet(3, 4);
assertNull(filtered.getGroupedFields());
assertNull(filtered.getOrdering());
assertNotNull(filtered.getUniqueFields());
assertEquals(2, filtered.getUniqueFields().size());
assertTrue(filtered.getUniqueFields().contains(expected1));
assertTrue(filtered.getUniqueFields().contains(expected2));
}
use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class LocalPropertiesFilteringTest method testUniqueFieldsPreserved1.
@Test
public void testUniqueFieldsPreserved1() {
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, new String[] { "0;1;2;3;4" }, null, null, tupleInfo, tupleInfo);
LocalProperties lProps = new LocalProperties();
lProps = lProps.addUniqueFields(new FieldSet(0, 1, 2));
lProps = lProps.addUniqueFields(new FieldSet(3, 4));
lProps = lProps.addUniqueFields(new FieldSet(4, 5, 6));
LocalProperties filtered = lProps.filterBySemanticProperties(sp, 0);
FieldSet expected1 = new FieldSet(0, 1, 2);
FieldSet expected2 = new FieldSet(3, 4);
assertNull(filtered.getGroupedFields());
assertNull(filtered.getOrdering());
assertNotNull(filtered.getUniqueFields());
assertEquals(2, filtered.getUniqueFields().size());
assertTrue(filtered.getUniqueFields().contains(expected1));
assertTrue(filtered.getUniqueFields().contains(expected2));
}
use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class LocalPropertiesFilteringTest method testUniqueFieldsPreserved2.
@Test
public void testUniqueFieldsPreserved2() {
SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
SemanticPropUtil.getSemanticPropsSingleFromString(sp, new String[] { "0;1;2;3;4" }, null, null, tupleInfo, tupleInfo);
LocalProperties lProps = LocalProperties.forGrouping(new FieldList(1, 2));
lProps = lProps.addUniqueFields(new FieldSet(0, 1, 2));
lProps = lProps.addUniqueFields(new FieldSet(3, 4));
lProps = lProps.addUniqueFields(new FieldSet(4, 5, 6));
LocalProperties filtered = lProps.filterBySemanticProperties(sp, 0);
FieldSet expected1 = new FieldSet(0, 1, 2);
FieldSet expected2 = new FieldSet(3, 4);
assertNull(filtered.getOrdering());
assertNotNull(filtered.getGroupedFields());
assertEquals(2, filtered.getGroupedFields().size());
assertTrue(filtered.getGroupedFields().contains(1));
assertTrue(filtered.getGroupedFields().contains(2));
assertNotNull(filtered.getUniqueFields());
assertEquals(2, filtered.getUniqueFields().size());
assertTrue(filtered.getUniqueFields().contains(expected1));
assertTrue(filtered.getUniqueFields().contains(expected2));
}
use of org.apache.flink.api.common.operators.util.FieldSet 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.util.FieldSet 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());
}
Aggregations