use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyAtomicInvalidExpression4.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyAtomicInvalidExpression4() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<Integer> ds2 = env.fromElements(0, 0, 1);
ds1.coGroup(ds2).where("myInt").equalTo("*", "invalidKey");
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyMixing1.
@Test
public void testCoGroupKeyMixing1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
// should work
try {
ds1.coGroup(ds2).where(new KeySelector<CustomType, Long>() {
@Override
public Long getKey(CustomType value) {
return value.myLong;
}
}).equalTo(3);
} catch (Exception e) {
Assert.fail();
}
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyFields6.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyFields6() {
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, cogroup key fields on custom type
ds1.coGroup(ds2).where(4).equalTo(0);
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyAtomicInvalidExpression3.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyAtomicInvalidExpression3() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<Integer> ds2 = env.fromElements(0, 0, 1);
ds1.coGroup(ds2).where("myInt").equalTo("invalidKey");
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyMixing4.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyMixing4() {
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, more than one key field position
ds1.coGroup(ds2).where(1, 3).equalTo(new KeySelector<CustomType, Long>() {
@Override
public Long getKey(CustomType value) {
return value.myLong;
}
});
}
Aggregations