本文整理汇总了Java中org.apache.flink.api.java.DataSet.sortPartition方法的典型用法代码示例。如果您正苦于以下问题:Java DataSet.sortPartition方法的具体用法?Java DataSet.sortPartition怎么用?Java DataSet.sortPartition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.api.java.DataSet
的用法示例。
在下文中一共展示了DataSet.sortPartition方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSortPartitionWithKeySelector1
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@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();
}
}
示例2: testSortPartitionWithKeySelector4
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionWithKeySelector4() {
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[]>, Tuple2<Integer, Long>>() {
@Override
public Tuple2<Integer, Long> getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
return new Tuple2<>(value.f0, value.f1);
}
}, Order.ASCENDING);
} catch (Exception e) {
Assert.fail();
}
}
示例3: testSortPartitionWithExpressionKeys3
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@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);
}
示例4: testSortPartitionPositionKeys1
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionPositionKeys1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);
// should work
try {
tupleDs.sortPartition(0, Order.ASCENDING);
} catch (Exception e) {
Assert.fail();
}
}
示例5: testSortPartitionWithPositionKeys3
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithPositionKeys3() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// must not work
tupleDs.sortPartition(2, Order.ASCENDING);
}
示例6: testSortPartitionWithPositionKeys4
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithPositionKeys4() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// must not work
tupleDs.sortPartition(3, Order.ASCENDING);
}
示例7: testSortPartitionExpressionKeys1
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test
public void testSortPartitionExpressionKeys1() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);
// should work
try {
tupleDs.sortPartition("f1", Order.ASCENDING);
} catch (Exception e) {
Assert.fail();
}
}
示例8: testSortPartitionWithExpressionKeys4
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithExpressionKeys4() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// must not work
tupleDs.sortPartition("f3", Order.ASCENDING);
}
示例9: testSortPartitionWithKeySelector2
import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Test(expected = InvalidProgramException.class)
public void testSortPartitionWithKeySelector2() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple4<Integer, Long, CustomType, Long[]>> tupleDs = env.fromCollection(tupleWithCustomData, tupleWithCustomInfo);
// must not work
tupleDs.sortPartition(new KeySelector<Tuple4<Integer, Long, CustomType, Long[]>, Long[]>() {
@Override
public Long[] getKey(Tuple4<Integer, Long, CustomType, Long[]> value) throws Exception {
return value.f3;
}
}, Order.ASCENDING);
}