[ https://issues.apache.org/jira/browse/FLINK-6936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16081940#comment-16081940 ]
ASF GitHub Bot commented on FLINK-6936: --------------------------------------- GitHub user xccui opened a pull request: https://github.com/apache/flink/pull/4297 [FLINK-6936] [streaming] Add multiple targets support for custom partitioner Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration. If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html). In addition to going through the list, please provide a meaningful description of your changes. - [x] General - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text") - The pull request addresses only one issue - Each commit in the PR has a meaningful commit message (including the JIRA id) - [x] Documentation - Documentation has been added for new functionality - Old documentation affected by the pull request has been updated - JavaDoc for public methods has been added - [x] Tests & Build - Functionality added by the pull request is covered by tests - `mvn clean verify` has been executed successfully locally or a Travis build has passed You can merge this pull request into a Git repository by running: $ git pull https://github.com/xccui/flink FLINK-6936 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/4297.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4297 ---- commit 754a8ad7ae316a09edc2bf0ea957006aee02b595 Author: Xingcan Cui <xingc...@gmail.com> Date: 2017-07-07T12:25:39Z [FLINK-6936] [streaming] Add multiple targets support for custom partitioner ---- > Add multiple targets support for custom partitioner > --------------------------------------------------- > > Key: FLINK-6936 > URL: https://issues.apache.org/jira/browse/FLINK-6936 > Project: Flink > Issue Type: Improvement > Components: DataStream API > Reporter: Xingcan Cui > Assignee: Xingcan Cui > Priority: Minor > > The current user-facing Partitioner only allows returning one target. > {code:java} > @Public > public interface Partitioner<K> extends java.io.Serializable, Function { > /** > * Computes the partition for the given key. > * > * @param key The key. > * @param numPartitions The number of partitions to partition into. > * @return The partition index. > */ > int partition(K key, int numPartitions); > } > {code} > Actually, this function should return multiple partitions and this may be a > historical legacy. > There could be at least three approaches to solve this. > # Make the `protected DataStream<T> setConnectionType(StreamPartitioner<T> > partitioner)` method in DataStream public and that allows users to directly > define StreamPartitioner. > # Change the `partition` method in the Partitioner interface to return an int > array instead of a single int value. > # Add a new `multicast` method to DataStream and provide a MultiPartitioner > interface which returns an int array. > Considering the consistency of API, the 3rd approach seems to be an > acceptable choice. [~aljoscha], what do you think? -- This message was sent by Atlassian JIRA (v6.4.14#64029)