You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Nico Kruber (JIRA)" <ji...@apache.org> on 2018/10/09 15:46:00 UTC

[jira] [Commented] (FLINK-10468) Potential missing break for PARTITION_CUSTOM in OutputEmitter ctor

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

Nico Kruber commented on FLINK-10468:
-------------------------------------

I'd agree with [~Tison] after looking at the code.

However, several parts in this class seem a bit too defensive, like this one:
{code}
	private int[] customPartition(T record, int numberOfChannels) {
		if (channels == null) {
			channels = new int[1];
			extractedKeys = new Object[1];
		}
{code}
-> this can only be called for {{PARTITION_CUSTOM}} and for this, we made sure that these two properties are set. But maybe I'm wrong here - at least, I wouldn't touch it unless it is actually needed.

> Potential missing break for PARTITION_CUSTOM in OutputEmitter ctor
> ------------------------------------------------------------------
>
>                 Key: FLINK-10468
>                 URL: https://issues.apache.org/jira/browse/FLINK-10468
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is related code:
> {code}
>     switch (strategy) {
>     case PARTITION_CUSTOM:
>       extractedKeys = new Object[1];
>     case FORWARD:
> {code}
> It seems a 'break' is missing prior to FORWARD case.
> {code}
>     if (strategy == ShipStrategyType.PARTITION_CUSTOM && partitioner == null) {
>       throw new NullPointerException("Partitioner must not be null when the ship strategy is set to custom partitioning.");
>     }
> {code}
> Since the above check is for PARTITION_CUSTOM, it seems we can place the check in the switch statement.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)