use of org.apache.flink.api.java.tuple.Tuple4 in project flink by apache.
the class GroupingTest method testGroupSortByKeyExpression1.
@Test
public void testGroupSortByKeyExpression1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// should work
try {
tupleDs.groupBy("f0").sortGroup("f1", Order.ASCENDING);
} catch (Exception e) {
Assert.fail();
}
}
use of org.apache.flink.api.java.tuple.Tuple4 in project flink by apache.
the class GroupingTest method testGroupSortByKeyExpression6.
@Test(expected = InvalidProgramException.class)
public void testGroupSortByKeyExpression6() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// should not work
tupleDs.groupBy("f0").sortGroup("f3", Order.ASCENDING);
}
use of org.apache.flink.api.java.tuple.Tuple4 in project flink by apache.
the class SortPartitionTest method testSortPartitionWithKeySelector3.
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithKeySelector3() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// must not work
tupleDs.sortPartition("f1", Order.ASCENDING).sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>, CustomType>() {
@Override
public CustomType getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
return value.f2;
}
}, Order.ASCENDING);
}
use of org.apache.flink.api.java.tuple.Tuple4 in project flink by apache.
the class SortPartitionTest method testSortPartitionWithExpressionKeys3.
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithExpressionKeys3() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// must not work
tupleDs.sortPartition("f2.nested", Order.ASCENDING);
}
use of org.apache.flink.api.java.tuple.Tuple4 in project flink by apache.
the class SortPartitionTest method testSortPartitionWithKeySelector1.
@Test
public void testSortPartitionWithKeySelector1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// should work
try {
tupleDs.sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>, Integer>() {
@Override
public Integer getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
return value.f0;
}
}, Order.ASCENDING);
} catch (Exception e) {
Assert.fail();
}
}
Aggregations