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

mingleizhang edited comment on FLINK-6422 at 6/20/17 1:21 PM:
--------------------------------------------------------------

Thanks for your report Ted. :) . Actually, The code stream can not come to 
{{Long.MAX_VALUE}}. Suppose that it can reach {{Long.MAX_VALUE}}, below code 
{{Math.min(maxSplitSize, blockSize)}} always return a blockSize. I think it 
seems to be very do not understand. Strange... So I would fix the code  like 
the following. [~Zentol] If would be great helpful if you can take a look at 
this. What do you think ? Also, cc Ted Yu. And I will give a PR to this issue 
soon.
{code:java}
final long maxSplitSize = totalLength / minNumSplits + (totalLength % 
minNumSplits == 0 ? 0 : 1);
{code}





was (Author: mingleizhang):
Thanks for your report Ted. :) . Actually, The code stream can not come to 
{{Long.MAX_VALUE}}. Suppose that it can reach {{Long.MAX_VALUE}}, below code 
{{Math.min(maxSplitSize, blockSize)}} always return a blockSize as splitSize. I 
think it seems to be very do not understand. Strange... So I would fix the code 
 like the following. [~Zentol] If would be great helpful if you can take a look 
at this. What do you think ? Also, cc Ted Yu. And I will give a PR to this 
issue soon.
{code:java}
final long maxSplitSize = totalLength / minNumSplits + (totalLength % 
minNumSplits == 0 ? 0 : 1);
{code}




> Unreachable code in FileInputFormat#createInputSplits
> -----------------------------------------------------
>
>                 Key: FLINK-6422
>                 URL: https://issues.apache.org/jira/browse/FLINK-6422
>             Project: Flink
>          Issue Type: Bug
>          Components: Batch Connectors and Input/Output Formats
>            Reporter: Ted Yu
>            Assignee: mingleizhang
>            Priority: Minor
>
> Here is related code:
> {code}
>     if (minNumSplits < 1) {
>       throw new IllegalArgumentException("Number of input splits has to be at 
> least 1.");
>     }
> ...
>     final long maxSplitSize = (minNumSplits < 1) ? Long.MAX_VALUE : 
> (totalLength / minNumSplits +
>           (totalLength % minNumSplits == 0 ? 0 : 1));
> {code}
> minNumSplits wouldn't be less than 1 getting to the assignment of 
> maxSplitSize.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to