use of org.apache.flink.api.common.InvalidProgramException in project flink by apache.
the class GroupingPojoTranslationTest method testCustomPartitioningTupleInvalidTypeSorted.
@Test
public void testCustomPartitioningTupleInvalidTypeSorted() {
try {
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Pojo3> data = env.fromElements(new Pojo3()).rebalance().setParallelism(4);
try {
data.groupBy("a").sortGroup("b", Order.ASCENDING).withPartitioner(new TestPartitionerLong());
fail("Should throw an exception");
} catch (InvalidProgramException e) {
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.api.common.InvalidProgramException in project flink by apache.
the class JoinCustomPartitioningTest method testJoinWithKeySelectorsWrongType.
@Test
public void testJoinWithKeySelectorsWrongType() {
try {
final Partitioner<Long> partitioner = new TestPartitionerLong();
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Pojo2> input1 = env.fromElements(new Pojo2());
DataSet<Pojo3> input2 = env.fromElements(new Pojo3());
try {
input1.join(input2, JoinHint.REPARTITION_HASH_FIRST).where(new Pojo2KeySelector()).equalTo(new Pojo3KeySelector()).withPartitioner(partitioner);
fail("should throw an exception");
} catch (InvalidProgramException e) {
// expected
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.api.common.InvalidProgramException in project flink by apache.
the class JoinCustomPartitioningTest method testJoinWithTuplesWrongType.
@Test
public void testJoinWithTuplesWrongType() {
try {
final Partitioner<Integer> partitioner = new TestPartitionerInt();
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple2<Long, Long>> input1 = env.fromElements(new Tuple2<Long, Long>(0L, 0L));
DataSet<Tuple3<Long, Long, Long>> input2 = env.fromElements(new Tuple3<Long, Long, Long>(0L, 0L, 0L));
try {
input1.join(input2, JoinHint.REPARTITION_HASH_FIRST).where(1).equalTo(0).withPartitioner(partitioner);
fail("should throw an exception");
} catch (InvalidProgramException e) {
// expected
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.api.common.InvalidProgramException in project flink by apache.
the class CoGroupCustomPartitioningTest method testCoGroupWithPojosWrongType.
@Test
public void testCoGroupWithPojosWrongType() {
try {
final Partitioner<Long> partitioner = new TestPartitionerLong();
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Pojo2> input1 = env.fromElements(new Pojo2());
DataSet<Pojo3> input2 = env.fromElements(new Pojo3());
try {
input1.coGroup(input2).where("a").equalTo("b").withPartitioner(partitioner);
fail("should throw an exception");
} catch (InvalidProgramException e) {
// expected
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.api.common.InvalidProgramException in project flink by apache.
the class CustomPartitioningTest method testPartitionTuplesInvalidType.
@Test
public void testPartitionTuplesInvalidType() {
try {
final int parallelism = 4;
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(parallelism);
DataSet<Tuple2<Integer, Integer>> data = env.fromElements(new Tuple2<Integer, Integer>(0, 0)).rebalance();
try {
data.partitionCustom(new TestPartitionerLong(), 0);
fail("Should throw an exception");
} catch (InvalidProgramException e) {
// expected
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations