use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType 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();
}
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyExpressions3Nested.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyExpressions3Nested() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should not work, incompatible number of cogroup keys
ds1.coGroup(ds2).where("nested.myInt", "nested.myString").equalTo("nested.myString");
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyAtomicExpression2.
@Test
public void testCoGroupKeyAtomicExpression2() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Integer> ds1 = env.fromElements(0, 0, 1);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
ds1.coGroup(ds2).where("*").equalTo("myInt");
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeyExpressions3.
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyExpressions3() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should not work, incompatible number of cogroup keys
ds1.coGroup(ds2).where("myInt", "myString").equalTo("myString");
}
use of org.apache.flink.api.java.operator.JoinOperatorTest.CustomType in project flink by apache.
the class CoGroupOperatorTest method testCoGroupKeySelectors1.
@Test
public void testCoGroupKeySelectors1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should work
try {
ds1.coGroup(ds2).where(new KeySelector<CustomType, Long>() {
@Override
public Long getKey(CustomType value) {
return value.myLong;
}
}).equalTo(new KeySelector<CustomType, Long>() {
@Override
public Long getKey(CustomType value) {
return value.myLong;
}
});
} catch (Exception e) {
Assert.fail();
}
}
Aggregations