@Test public void testRangePartitionWithOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionByRange(0).withOrders(Order.ASCENDING); }
@Test(expected = IllegalStateException.class) public void testHashPartitionWithOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionByHash(1).withOrders(Order.ASCENDING); }
@Test public void testRangePartitionBySelectorComplexKeyWithOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<NestedPojo> ds = getNestedPojoDataSet(env); ds.partitionByRange(new KeySelector<NestedPojo, CustomPojo>() { @Override public CustomPojo getKey(NestedPojo value) throws Exception { return value.getNested(); } }).withOrders(Order.ASCENDING); }
@Test(expected = IllegalArgumentException.class) public void testRangePartitionBySelectorComplexKeyWithTooManyOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<NestedPojo> ds = getNestedPojoDataSet(env); ds.partitionByRange(new KeySelector<NestedPojo, CustomPojo>() { @Override public CustomPojo getKey(NestedPojo value) throws Exception { return value.getNested(); } }).withOrders(Order.ASCENDING, Order.DESCENDING); }
@Test(expected = IllegalStateException.class) public void testRebalanceWithOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.rebalance().withOrders(Order.ASCENDING); }
@Test(expected = IllegalArgumentException.class) public void testRangePartitionWithTooManyOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSet<Tuple2<Integer, String>> ds = getTupleDataSet(env); ds.partitionByRange(0).withOrders(Order.ASCENDING, Order.DESCENDING); }
@Test public void testRangePartitionByComplexKeyWithOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSource<Tuple2<Tuple2<Integer, Integer>, Integer>> ds = env.fromElements( new Tuple2<>(new Tuple2<>(1, 1), 1), new Tuple2<>(new Tuple2<>(2, 2), 2), new Tuple2<>(new Tuple2<>(2, 2), 2) ); ds.partitionByRange(0, 1).withOrders(Order.ASCENDING, Order.DESCENDING); }
@Test(expected = IllegalArgumentException.class) public void testRangePartitionByComplexKeyWithTooManyOrders() throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); final DataSource<Tuple2<Tuple2<Integer, Integer>, Integer>> ds = env.fromElements( new Tuple2<>(new Tuple2<>(1, 1), 1), new Tuple2<>(new Tuple2<>(2, 2), 2), new Tuple2<>(new Tuple2<>(2, 2), 2) ); ds.partitionByRange(0).withOrders(Order.ASCENDING, Order.DESCENDING); }
.withOrders(Order.ASCENDING, Order.DESCENDING) .mapPartition(minMaxSelector) .collect();
.withOrders(Order.ASCENDING) .mapPartition(new MinMaxSelector<>(new ComparablePojoComparator())) .mapPartition(new ExtractComparablePojo())
.withOrders(Order.ASCENDING) .mapPartition(new MapPartitionFunction<Tuple2<Tuple2<Long, Long>, Long>, Tuple2<Long, Long>>() { @Override