[ 
https://issues.apache.org/jira/browse/FLINK-2734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14903567#comment-14903567
 ] 

ASF GitHub Bot commented on FLINK-2734:
---------------------------------------

Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1166#discussion_r40152579
  
    --- Diff: 
flink-staging/flink-streaming/flink-streaming-core/src/test/java/org/apache/flink/streaming/util/keys/ArrayKeySelectorTest.java
 ---
    @@ -0,0 +1,74 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.streaming.util.keys;
    +
    +import org.apache.flink.api.java.tuple.Tuple1;
    +import org.apache.flink.api.java.tuple.Tuple2;
    +import org.junit.Test;
    +
    +import static org.junit.Assert.*;
    +
    +public class ArrayKeySelectorTest {
    +
    +   @Test
    +   public void testObjectArrays() {
    +           try {
    +                   Object[] array1 = { "a", "b", "c", "d", "e" };
    +                   Object[] array2 = { "v", "w", "x", "y", "z" };
    +                   
    +                   KeySelectorUtil.ArrayKeySelector<Object[]> 
singleFieldSelector = new KeySelectorUtil.ArrayKeySelector<>(1);
    +                   
    +                   assertEquals(new Tuple1<>("b"), 
singleFieldSelector.getKey(array1));
    +                   assertEquals(new Tuple1<>("w"), 
singleFieldSelector.getKey(array2));
    +
    +                   KeySelectorUtil.ArrayKeySelector<Object[]> 
twoFieldsSelector = new KeySelectorUtil.ArrayKeySelector<>(3, 0);
    +                   
    +                   assertEquals(new Tuple2<>("d", "a"), 
twoFieldsSelector.getKey(array1));
    +                   assertEquals(new Tuple2<>("y", "v"), 
twoFieldsSelector.getKey(array2));
    +                   
    +           }
    +           catch (Exception e) {
    +                   e.printStackTrace();
    +                   fail(e.getMessage());
    +           }
    --- End diff --
    
    I don't think we need the try-catch block here.


> ArrayKeySelector returns wrong positions (or fails)
> ---------------------------------------------------
>
>                 Key: FLINK-2734
>                 URL: https://issues.apache.org/jira/browse/FLINK-2734
>             Project: Flink
>          Issue Type: Bug
>          Components: Streaming
>    Affects Versions: 0.10
>            Reporter: Stephan Ewen
>            Assignee: Stephan Ewen
>            Priority: Critical
>             Fix For: 0.10
>
>
> The {{ArrayKeySelector}} is broken and returns wrong values in all cases 
> except for [0] as a single only key position.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to