@Test(expected = IndexOutOfBoundsException.class) public void testGroupByKeyFields4() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, key out of tuple bounds tupleDs.groupBy(5); }
@Test(expected = InvalidProgramException.class) public void testArrayOrderFull() { List<Object[]> arrayData = new ArrayList<>(); arrayData.add(new Object[0]); final ExecutionEnvironment env = ExecutionEnvironment .getExecutionEnvironment(); DataSet<Object[]> pojoDs = env .fromCollection(arrayData); // must not work pojoDs.writeAsText("/tmp/willNotHappen") .sortLocalOutput("*", Order.ASCENDING); }
@Test(expected = InvalidProgramException.class) public void testDistinctOnNotKeyDataType() throws Exception { /* * should not work. NotComparable data type cannot be used as key */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); NotComparable a = new NotComparable(); List<NotComparable> l = new ArrayList<NotComparable>(); l.add(a); DataSet<NotComparable> ds = env.fromCollection(l); DataSet<NotComparable> reduceDs = ds.distinct(); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsDataset1() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, key out of tuple bounds tupleDs.maxBy(5); }
@Test(expected = InvalidProgramException.class) public void testDistinctOnNotKeyDataTypeOnSelectAllChar() throws Exception { /* * should not work. NotComparable data type cannot be used as key */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); NotComparable a = new NotComparable(); List<NotComparable> l = new ArrayList<NotComparable>(); l.add(a); DataSet<NotComparable> ds = env.fromCollection(l); DataSet<NotComparable> reduceDs = ds.distinct("*"); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsDataset2() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, key out of tuple bounds tupleDs.maxBy(-1); }
/** * This test validates that an InvalidProgramException is thrown when minBy * is used on a custom data type. */ @Test(expected = InvalidProgramException.class) public void testCustomKeyFieldsDataset() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); DataSet<CustomType> customDs = env.fromCollection(customTypeData); // should not work: groups on custom type customDs.minBy(0); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsDataset3() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, key out of tuple bounds tupleDs.maxBy(1, 2, 3, 4, -1); }
@Test public void testGroupByKeyFieldsOnPrimitiveArray() { this.byteArrayData.add(new Tuple2(new byte[]{0}, new byte[]{1})); final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple2<byte[], byte[]>> tupleDs = env.fromCollection(byteArrayData); tupleDs.groupBy(0); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsDataset3() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, key out of tuple bounds tupleDs.minBy(1, 2, 3, 4, -1); }
@Test(expected = InvalidProgramException.class) public void testGroupByKeyFields3() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); DataSet<CustomType> customDs = env.fromCollection(customTypeData); // should not work: groups on custom type customDs.groupBy(0); }
@Test(expected = IndexOutOfBoundsException.class) public void testCrossProjection28() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo); DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, index out of range ds1.cross(ds2) .projectFirst(5); }
/** * This test validates that an InvalidProgramException is thrown when maxBy * is used on a custom data type. */ @Test(expected = InvalidProgramException.class) public void testCustomKeyFieldsDataset() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); DataSet<CustomType> customDs = env.fromCollection(customTypeData); // should not work: groups on custom type customDs.maxBy(0); }
@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); }
@Test(expected = InvalidProgramException.class) public void testGroupByKeyExpressions3() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); DataSet<CustomType> customDs = env.fromCollection(customTypeData); // should not work: tuple selector on custom type customDs.groupBy(0); }
@Test public void testDistinctByKeyFields4() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo); // should work tupleDs.distinct(); }
@Test(expected = InvalidProgramException.class) public void testDistinctByKeyFields3() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); DataSet<CustomType> customDs = env.fromCollection(customTypeData); // should not work: distinct on custom type customDs.distinct(0); }
@Test(expected = IndexOutOfBoundsException.class) public void testCrossProjection9() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo); DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, index out of range ds1.cross(ds2) .projectSecond(5); }
@Test public void testDistinctByKeyFields5() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); DataSet<CustomType> customDs = env.fromCollection(customTypeData); // should work customDs.distinct(); }
@Test(expected = IndexOutOfBoundsException.class) public void testCrossProjection29() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo); DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo); // should not work, index out of range ds1.cross(ds2) .projectSecond(5); }