use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class FieldSetTest method testImmutability.
@Test
public void testImmutability() {
FieldSet s1 = new FieldSet();
FieldSet s2 = new FieldSet(5);
FieldSet s3 = new FieldSet(Integer.valueOf(7));
FieldSet s4 = new FieldSet(5, 4, 7, 6);
s1.addFields(s2).addFields(s3);
s2.addFields(s4);
s4.addFields(s1);
s1.addField(Integer.valueOf(14));
s2.addFields(78, 13, 66, 3);
assertEquals(0, s1.size());
assertEquals(1, s2.size());
assertEquals(1, s3.size());
assertEquals(4, s4.size());
}
use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class FieldSetTest method testFieldSetConstructors.
@Test
public void testFieldSetConstructors() {
check(new FieldSet());
check(FieldSet.EMPTY_SET);
check(new FieldSet(14), 14);
check(new FieldSet(Integer.valueOf(3)), 3);
check(new FieldSet(7, 4, 1), 1, 4, 7);
check(new FieldSet(7, 4, 1, 4, 7, 1, 4, 2), 1, 4, 2, 7);
}
use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class SemanticPropertiesPrecedenceTest method testFunctionSkipCodeAnalysisAnnotationPrecedence.
@Test
public void testFunctionSkipCodeAnalysisAnnotationPrecedence() {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setCodeAnalysisMode(CodeAnalysisMode.OPTIMIZE);
@SuppressWarnings("unchecked") DataSet<Tuple3<Long, String, Integer>> input = env.fromElements(Tuple3.of(3l, "test", 42));
input.map(new WildcardForwardedMapperWithSkipAnnotation<Tuple3<Long, String, Integer>>()).output(new DiscardingOutputFormat<Tuple3<Long, String, Integer>>());
Plan plan = env.createProgramPlan();
GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
MapOperatorBase<?, ?, ?> mapper = (MapOperatorBase<?, ?, ?>) sink.getInput();
SingleInputSemanticProperties semantics = mapper.getSemanticProperties();
FieldSet fw1 = semantics.getForwardingTargetFields(0, 0);
FieldSet fw2 = semantics.getForwardingTargetFields(0, 1);
FieldSet fw3 = semantics.getForwardingTargetFields(0, 2);
assertNotNull(fw1);
assertNotNull(fw2);
assertNotNull(fw3);
assertFalse(fw1.contains(0));
assertFalse(fw2.contains(1));
assertFalse(fw3.contains(2));
}
use of org.apache.flink.api.common.operators.util.FieldSet in project flink by apache.
the class SemanticPropertiesPrecedenceTest method testFunctionAnalyzerPrecedence.
@Test
public void testFunctionAnalyzerPrecedence() {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setCodeAnalysisMode(CodeAnalysisMode.OPTIMIZE);
@SuppressWarnings("unchecked") DataSet<Tuple3<Long, String, Integer>> input = env.fromElements(Tuple3.of(3l, "test", 42));
input.map(new WildcardForwardedMapper<Tuple3<Long, String, Integer>>()).output(new DiscardingOutputFormat<Tuple3<Long, String, Integer>>());
Plan plan = env.createProgramPlan();
GenericDataSinkBase<?> sink = plan.getDataSinks().iterator().next();
MapOperatorBase<?, ?, ?> mapper = (MapOperatorBase<?, ?, ?>) sink.getInput();
SingleInputSemanticProperties semantics = mapper.getSemanticProperties();
FieldSet fw1 = semantics.getForwardingTargetFields(0, 0);
FieldSet fw2 = semantics.getForwardingTargetFields(0, 1);
FieldSet fw3 = semantics.getForwardingTargetFields(0, 2);
assertNotNull(fw1);
assertNotNull(fw2);
assertNotNull(fw3);
assertTrue(fw1.contains(0));
assertTrue(fw2.contains(1));
assertTrue(fw3.contains(2));
}
use of org.apache.flink.api.common.operators.util.FieldSet 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());
}
Aggregations