use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyMixing3.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyMixing3() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should not work, incompatible types
ds1.coGroup(ds2).where(2).equalTo(new KeySelector<CustomType, Long>() {
@Override
public Long getKey(CustomType value) {
return value.myLong;
}
});
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyExpressions4.
@Test(expected = IllegalArgumentException.class)
public void testCoGroupKeyExpressions4() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should not work, cogroup key non-existent
ds1.coGroup(ds2).where("myNonExistent").equalTo("myInt");
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyAtomicInvalidExpression2.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyAtomicInvalidExpression2() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Integer> ds1 = env.fromElements(0, 0, 1);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
ds1.coGroup(ds2).where("invalidKey");
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyExpressions1Nested.
@Test
public void testCoGroupKeyExpressions1Nested() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should work
try {
ds1.coGroup(ds2).where("nested.myInt").equalTo("nested.myInt");
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyMixing2.
@Test
public void testCoGroupKeyMixing2() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should work
try {
ds1.coGroup(ds2).where(3).equalTo(new KeySelector<CustomType, Long>() {
@Override
public Long getKey(CustomType value) {
return value.myLong;
}
});
} catch (Exception e) {
Assert.fail();
}
}
Aggregations