use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class GroupingTest method testGroupByKeySelector2.
@Test
@SuppressWarnings("serial")
public void testGroupByKeySelector2() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
this.customTypeData.add(new CustomType());
try {
DataSet<CustomType> customDs = env.fromCollection(customTypeData);
// should work
customDs.groupBy(new KeySelector<GroupingTest.CustomType, Tuple2<Integer, Long>>() {
@Override
public Tuple2<Integer, Long> getKey(CustomType value) {
return new Tuple2<Integer, Long>(value.myInt, value.myLong);
}
});
} catch (Exception e) {
Assert.fail();
}
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class GroupingTest method testGroupSortKeyFields1.
@Test
public void testGroupSortKeyFields1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);
// should work
try {
tupleDs.groupBy(0).sortGroup(0, Order.ASCENDING);
} catch (Exception e) {
Assert.fail();
}
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class JoinOperatorTest method testJoinKeyFields6.
@Test(expected = InvalidProgramException.class)
public void testJoinKeyFields6() {
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, join key fields on custom type
ds1.join(ds2).where(4).equalTo(0);
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class JoinOperatorTest method testJoinKeyExpressions2Nested.
@Test(expected = InvalidProgramException.class)
public void testJoinKeyExpressions2Nested() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<CustomType> ds1 = env.fromCollection(customTypeData);
DataSet<CustomType> ds2 = env.fromCollection(customTypeData);
// should not work, incompatible join key types
ds1.join(ds2).where("nested.myInt").equalTo("nested.myString");
}
use of org.apache.flink.api.java.ExecutionEnvironment in project flink by apache.
the class JoinOperatorTest method testJoinProjection12.
public void testJoinProjection12() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
// should work
ds1.join(ds2).where(0).equalTo(0).projectSecond(2).projectFirst(1);
}
Aggregations