/** * This test validates that an InvalidProgramException is thrown when maxBy * is used on a custom data type. */ @Test(expected = InvalidProgramException.class) public void testCustomKeyFieldsGrouping() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); this.customTypeData.add(new CustomType()); UnsortedGrouping<CustomType> groupDs = env.fromCollection(customTypeData).groupBy(0); // should not work: groups on custom type groupDs.maxBy(0); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsGrouping3() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); UnsortedGrouping<Tuple5<Integer, Long, String, Long, Integer>> groupDs = env.fromCollection(emptyTupleData, tupleTypeInfo).groupBy(0); // should not work, key out of tuple bounds groupDs.maxBy(1, 2, 3, 4, -1); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsGrouping2() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); UnsortedGrouping<Tuple5<Integer, Long, String, Long, Integer>> groupDs = env.fromCollection(emptyTupleData, tupleTypeInfo).groupBy(0); // should not work, key out of tuple bounds groupDs.maxBy(-1); }
/** * This test validates that an index which is out of bounds throws an * IndexOutOfBoundsException. */ @Test(expected = IndexOutOfBoundsException.class) public void testOutOfTupleBoundsGrouping1() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); UnsortedGrouping<Tuple5<Integer, Long, String, Long, Integer>> groupDs = env.fromCollection(emptyTupleData, tupleTypeInfo).groupBy(0); // should not work, key out of tuple bounds groupDs.maxBy(5); }
/** * This test validates that no exceptions is thrown when an empty grouping * calls maxBy(). */ @Test public void testMaxByKeyFieldsGrouping() { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); UnsortedGrouping<Tuple5<Integer, Long, String, Long, Integer>> groupDs = env.fromCollection(emptyTupleData, tupleTypeInfo).groupBy(0); // should work try { groupDs.maxBy(4, 0, 1, 2, 3); } catch (Exception e) { Assert.fail(); } }
trendsParams.getRankThreshold())) .groupBy(0) .maxBy(2) .setParallelism(1);