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