Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/3501#discussion_r105241140 --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/DataStreamTest.java --- @@ -906,6 +919,256 @@ public void testChannelSelectors() { } ///////////////////////////////////////////////////////////// + // KeyBy testing + ///////////////////////////////////////////////////////////// + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void testPrimitiveArrayKeyRejection() { + + KeySelector<Tuple2<Integer[], String>, int[]> keySelector = + new KeySelector<Tuple2<Integer[], String>, int[]>() { + + @Override + public int[] getKey(Tuple2<Integer[], String> value) throws Exception { + int[] ks = new int[value.f0.length]; + for (int i = 0; i < ks.length; i++) { + ks[i] = value.f0[i]; + } + return ks; + } + }; + + testKeyRejection(keySelector, PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO); + } + + @Test + public void testBasicArrayKeyRejection() { + + KeySelector<Tuple2<Integer[], String>, Integer[]> keySelector = + new KeySelector<Tuple2<Integer[], String>, Integer[]>() { + + @Override + public Integer[] getKey(Tuple2<Integer[], String> value) throws Exception { + return value.f0; + } + }; + + testKeyRejection(keySelector, BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO); + } + + @Test + public void testObjectArrayKeyRejection() { + + KeySelector<Tuple2<Integer[], String>, TestClass[]> keySelector = --- End diff -- Do we need a separate class here or could we just throw in an Object[]?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---