Java Code Examples for org.apache.flink.api.java.DataSet#sortPartition()
The following examples show how to use
org.apache.flink.api.java.DataSet#sortPartition() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 6 votes |
@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(); } }
Example 2
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 6 votes |
@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(); } }
Example 3
Source File: SortPartitionTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@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(); } }
Example 4
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 6 votes |
@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(); } }
Example 5
Source File: SortPartitionTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@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(); } }
Example 6
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 7
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 8
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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(); } }
Example 9
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 10
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 11
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 12
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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(); } }
Example 13
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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(); } }
Example 14
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 15
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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(); } }
Example 16
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }
Example 17
Source File: SortPartitionTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@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); }
Example 18
Source File: SortPartitionTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@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); }
Example 19
Source File: SortPartitionTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@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(); } }
Example 20
Source File: SortPartitionTest.java From flink with Apache License 2.0 | 5 votes |
@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); }