Java Code Examples for org.apache.flink.api.java.DataSet#partitionCustom()
The following examples show how to use
org.apache.flink.api.java.DataSet#partitionCustom() .
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: PartitionOperatorTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testRangePartitionCustomPartitionerByKeySelector() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, new KeySelector<CustomPojo, Integer>() { @Override public Integer getKey(CustomPojo value) throws Exception { return value.getNumber(); } }); }
Example 2
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testRangePartitionCustomPartitionerByKeySelector() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, new KeySelector<CustomPojo, Integer>() { @Override public Integer getKey(CustomPojo value) throws Exception { return value.getNumber(); } }); }
Example 3
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testRangePartitionCustomPartitionerByKeySelector() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, new KeySelector<CustomPojo, Integer>() { @Override public Integer getKey(CustomPojo value) throws Exception { return value.getNumber(); } }); }
Example 4
Source File: PartitionOperatorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testRangePartitionCustomPartitionerByFieldId() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, 0); }
Example 5
Source File: PartitionOperatorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = InvalidProgramException.class) public void testRangePartitionInvalidCustomPartitionerByFieldId() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, 1); }
Example 6
Source File: PartitionOperatorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testRangePartitionCustomPartitionerByFieldName() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, "number"); }
Example 7
Source File: PartitionOperatorTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = InvalidProgramException.class) public void testRangePartitionInvalidCustomPartitionerByFieldName() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, "name"); }
Example 8
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testRangePartitionCustomPartitionerByFieldId() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, 0); }
Example 9
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidProgramException.class) public void testRangePartitionInvalidCustomPartitionerByFieldId() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, 1); }
Example 10
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testRangePartitionCustomPartitionerByFieldName() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, "number"); }
Example 11
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidProgramException.class) public void testRangePartitionInvalidCustomPartitionerByFieldName() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, "name"); }
Example 12
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testRangePartitionCustomPartitionerByFieldId() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, 0); }
Example 13
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidProgramException.class) public void testRangePartitionInvalidCustomPartitionerByFieldId() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, 1); }
Example 14
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testRangePartitionCustomPartitionerByFieldName() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, "number"); }
Example 15
Source File: PartitionOperatorTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = InvalidProgramException.class) public void testRangePartitionInvalidCustomPartitionerByFieldName() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<CustomPojo> ds = getPojoDataSet(env); ds.partitionCustom(new Partitioner<Integer>() { @Override public int partition(Integer key, int numPartitions) { return 1; } }, "name"); }